Skip to content

Commit

Permalink
Revert "feat(atomic): replace getAssetPath (#4844)"
Browse files Browse the repository at this point in the history
This reverts commit 4aa0206.
  • Loading branch information
y-lakhdar committed Jan 17, 2025
1 parent 856acde commit 933158d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/atomic/src/components/common/interface/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {getAssetPath} from '@stencil/core';
import DOMPurify from 'dompurify';
import Backend, {HttpBackendOptions} from 'i18next-http-backend';
import availableLocales from '../../../generated/availableLocales.json';
import {getAssetPath} from '../../../utils/utils';
import {AnyEngineType} from './bindings';
import {BaseAtomicInterface} from './interface-common';

Expand Down
12 changes: 4 additions & 8 deletions packages/atomic/src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {getAssetPath} from '@stencil/core';
import {NODE_TYPES} from '@stencil/core/mock-doc';
import DOMPurify from 'dompurify';

/**
Expand Down Expand Up @@ -55,11 +57,11 @@ export function parseHTML(string: string) {
}

export function isElementNode(node: Node): node is Element {
return node.nodeType === Node.ELEMENT_NODE;
return node.nodeType === NODE_TYPES.ELEMENT_NODE;
}

export function isTextNode(node: Node): node is Text {
return node.nodeType === Node.TEXT_NODE;
return node.nodeType === NODE_TYPES.TEXT_NODE;
}

export function isVisualNode(node: Node) {
Expand All @@ -82,12 +84,6 @@ export function containsVisualElement(node: Node) {
return false;
}

export function getAssetPath(path: string): string {
const baseUrl = window.location.origin;
const assetUrl = new URL(path, baseUrl);
return assetUrl.origin !== baseUrl ? assetUrl.href : assetUrl.pathname;
}

export function parseAssetURL(url: string, assetPath = './assets') {
const [, protocol, remainder] =
url.match(/^([a-z]+):\/\/(.*?)(\.svg)?$/) || [];
Expand Down

0 comments on commit 933158d

Please sign in to comment.