@animus-ui/vite-plugin 0.1.0-next.30 → 0.1.0-next.31
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/index.d.ts.map +1 -1
- package/dist/index.mjs +53 -30
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6LD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6LD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAw+BnE;AAED,eAAe,aAAa,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -169,6 +169,8 @@ function animusExtract(options) {
|
|
|
169
169
|
let layerDeclaration = "";
|
|
170
170
|
const fileCache = /* @__PURE__ */ new Map();
|
|
171
171
|
let packageMap = {};
|
|
172
|
+
let externalPackageDirs = [];
|
|
173
|
+
const externalSourceEntries = /* @__PURE__ */ new Map();
|
|
172
174
|
let bridgeInjected = false;
|
|
173
175
|
let resolvedSystemPath = null;
|
|
174
176
|
/**
|
|
@@ -353,44 +355,60 @@ function animusExtract(options) {
|
|
|
353
355
|
const localFileCount = fileEntries.length;
|
|
354
356
|
const packageSpecifiers = extractSystemFilePackages(resolvedSystemPath);
|
|
355
357
|
packageMap = {};
|
|
358
|
+
externalSourceEntries.clear();
|
|
359
|
+
const collectedPkgDirs = [];
|
|
356
360
|
for (const specifier of packageSpecifiers) try {
|
|
357
361
|
const resolved = await this.resolve(specifier);
|
|
358
362
|
if (resolved && resolved.id) {
|
|
359
363
|
const absPath = resolved.id;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
364
|
+
let pkgRoot = dirname(absPath);
|
|
365
|
+
while (pkgRoot !== dirname(pkgRoot) && !existsSync(join(pkgRoot, "package.json"))) pkgRoot = dirname(pkgRoot);
|
|
366
|
+
const srcDir = join(pkgRoot, "src");
|
|
367
|
+
if (existsSync(srcDir)) {
|
|
368
|
+
collectedPkgDirs.push(srcDir);
|
|
369
|
+
const pkgFiles = discoverFiles(srcDir, rootDir, excludePatterns);
|
|
370
|
+
for (const pkgFile of pkgFiles) {
|
|
371
|
+
const pkgRelPath = relative(rootDir, pkgFile);
|
|
372
|
+
if (!fileEntries.some((e) => e.path === pkgRelPath)) {
|
|
373
|
+
const pkgSource = readFileSync(pkgFile, "utf-8");
|
|
374
|
+
const pkgHash = !isProd ? contentHash(pkgSource) : void 0;
|
|
375
|
+
fileEntries.push({
|
|
376
|
+
path: pkgRelPath,
|
|
377
|
+
source: pkgSource,
|
|
378
|
+
hash: pkgHash
|
|
379
|
+
});
|
|
380
|
+
if (!isProd && pkgHash) fileCache.set(pkgRelPath, {
|
|
381
|
+
hash: pkgHash,
|
|
382
|
+
source: pkgSource
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const srcEntry = join(srcDir, "index.ts");
|
|
387
|
+
if (existsSync(srcEntry)) {
|
|
388
|
+
packageMap[specifier] = relative(rootDir, srcEntry);
|
|
389
|
+
externalSourceEntries.set(specifier, srcEntry);
|
|
390
|
+
} else packageMap[specifier] = relative(rootDir, absPath);
|
|
391
|
+
} else {
|
|
392
|
+
const relPath = relative(rootDir, absPath);
|
|
393
|
+
if (!fileEntries.some((e) => e.path === relPath)) {
|
|
394
|
+
const entrySource = readFileSync(absPath, "utf-8");
|
|
395
|
+
const entryHash = !isProd ? contentHash(entrySource) : void 0;
|
|
380
396
|
fileEntries.push({
|
|
381
|
-
path:
|
|
382
|
-
source:
|
|
383
|
-
hash:
|
|
397
|
+
path: relPath,
|
|
398
|
+
source: entrySource,
|
|
399
|
+
hash: entryHash
|
|
384
400
|
});
|
|
385
|
-
if (!isProd &&
|
|
386
|
-
hash:
|
|
387
|
-
source:
|
|
401
|
+
if (!isProd && entryHash) fileCache.set(relPath, {
|
|
402
|
+
hash: entryHash,
|
|
403
|
+
source: entrySource
|
|
388
404
|
});
|
|
389
405
|
}
|
|
406
|
+
collectedPkgDirs.push(dirname(absPath));
|
|
407
|
+
packageMap[specifier] = relPath;
|
|
390
408
|
}
|
|
391
|
-
packageMap[specifier] = relPath;
|
|
392
409
|
}
|
|
393
410
|
} catch {}
|
|
411
|
+
externalPackageDirs = collectedPkgDirs;
|
|
394
412
|
const packageFileCount = fileEntries.length - localFileCount;
|
|
395
413
|
log(`Discovered ${fileEntries.length} files (${packageFileCount} from packages) (${Math.round(performance.now() - t0)}ms)`);
|
|
396
414
|
t0 = performance.now();
|
|
@@ -424,6 +442,8 @@ function animusExtract(options) {
|
|
|
424
442
|
if (id === VIRTUAL_COMPONENTS_ID) return RESOLVED_COMPONENTS_ID;
|
|
425
443
|
if (id === VIRTUAL_BRIDGE_ID) return RESOLVED_BRIDGE_ID;
|
|
426
444
|
if (id === VIRTUAL_SYSTEM_PROPS_ID) return RESOLVED_SYSTEM_PROPS_ID;
|
|
445
|
+
const srcEntry = externalSourceEntries.get(id);
|
|
446
|
+
if (srcEntry) return srcEntry;
|
|
427
447
|
return null;
|
|
428
448
|
},
|
|
429
449
|
load(id) {
|
|
@@ -507,8 +527,10 @@ if (import.meta.hot) {
|
|
|
507
527
|
},
|
|
508
528
|
transform(code, id) {
|
|
509
529
|
if (!storedManifest) return null;
|
|
510
|
-
if (
|
|
511
|
-
|
|
530
|
+
if (!externalPackageDirs.some((dir) => id.startsWith(dir))) {
|
|
531
|
+
if (!/\.[jt]sx?$/.test(id)) return null;
|
|
532
|
+
if (id.includes("node_modules")) return null;
|
|
533
|
+
}
|
|
512
534
|
const relativePath = relative(rootDir, id);
|
|
513
535
|
if (!storedManifest.files?.[relativePath]?.length) return null;
|
|
514
536
|
try {
|
|
@@ -536,7 +558,8 @@ if (import.meta.hot) {
|
|
|
536
558
|
if (isProd) return;
|
|
537
559
|
const ext = extname(file);
|
|
538
560
|
if (!DEFAULT_EXTENSIONS.has(ext)) return;
|
|
539
|
-
|
|
561
|
+
const excludePatterns = options.exclude ?? DEFAULT_EXCLUDE;
|
|
562
|
+
if (!externalPackageDirs.some((dir) => file.startsWith(dir)) && excludePatterns.some((pattern) => file.includes(pattern) || relative(rootDir, file).includes(pattern))) return;
|
|
540
563
|
const absFile = resolve(file);
|
|
541
564
|
const relPath = relative(rootDir, absFile);
|
|
542
565
|
if (resolvedSystemPath && absFile === resolve(resolvedSystemPath)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/vite-plugin",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.31",
|
|
4
4
|
"description": "Animus static CSS extraction Vite plugin",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"vite": ">=5.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@animus-ui/extract": "0.1.0-next.
|
|
29
|
-
"@animus-ui/system": "0.1.0-next.
|
|
28
|
+
"@animus-ui/extract": "0.1.0-next.31",
|
|
29
|
+
"@animus-ui/system": "0.1.0-next.31",
|
|
30
30
|
"browserslist": "^4.24.0",
|
|
31
31
|
"lightningcss": "^1.29.0"
|
|
32
32
|
}
|