@yahoo/uds-create-loader 2.21.2 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/loader.js +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/loader.test.ts +68 -0
- package/src/loader.ts +19 -0
package/dist/loader.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getLoaderProjection, loadUdsConfig } from "./loader/artifacts.js";
|
|
2
2
|
import { parse } from "@babel/parser";
|
|
3
3
|
import _traverse from "@babel/traverse";
|
|
4
|
+
import { resolveRegistryDir } from "@yahoo/uds-create-config";
|
|
4
5
|
//#region src/loader.ts
|
|
5
6
|
const traverse = _traverse.default ?? _traverse;
|
|
6
7
|
/**
|
|
@@ -24,9 +25,12 @@ const transformLoader = function(source) {
|
|
|
24
25
|
const { dataPath, isDev, skipWatchDependencies } = loaderContext.getOptions();
|
|
25
26
|
const resourcePath = loaderContext.resourcePath ?? "";
|
|
26
27
|
if (resourcePath.includes(".uds/")) return source;
|
|
28
|
+
if (resourcePath.includes(".uds-registry/")) return source;
|
|
27
29
|
if (!skipWatchDependencies) loaderContext.addDependency?.(dataPath);
|
|
28
30
|
const config = loadUdsConfig(dataPath, isDev);
|
|
29
31
|
if (!config) return source;
|
|
32
|
+
const registryRel = resolveRegistryDir(config.buildOptions);
|
|
33
|
+
if (resourcePath.replace(/\\/g, "/").includes(`/${registryRel}/`)) return source;
|
|
30
34
|
const projection = getLoaderProjection(config);
|
|
31
35
|
let hasComponentReference = false;
|
|
32
36
|
for (const name of projection.componentNames) if (source.includes(name)) {
|