@absolutejs/absolute 0.19.0-beta.714 → 0.19.0-beta.716
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/build.js +55 -37
- package/dist/build.js.map +3 -3
- package/dist/index.js +55 -37
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -49291,35 +49291,43 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49291
49291
|
if (rewritten !== original)
|
|
49292
49292
|
writeFileSync8(filePath, rewritten);
|
|
49293
49293
|
}
|
|
49294
|
-
},
|
|
49295
|
-
const {
|
|
49294
|
+
}, collectTransitiveImports = async (specs, alreadyVendored) => {
|
|
49295
|
+
const { readFileSync: readFileSync15 } = await import("fs");
|
|
49296
49296
|
const transpiler4 = new Bun.Transpiler({ loader: "js" });
|
|
49297
49297
|
const newSpecs = new Set;
|
|
49298
|
-
|
|
49299
|
-
|
|
49300
|
-
entries = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
49301
|
-
} catch {
|
|
49302
|
-
return newSpecs;
|
|
49303
|
-
}
|
|
49304
|
-
for (const entry of entries) {
|
|
49298
|
+
for (const spec of specs) {
|
|
49299
|
+
let resolved;
|
|
49305
49300
|
try {
|
|
49306
|
-
|
|
49307
|
-
|
|
49308
|
-
|
|
49309
|
-
|
|
49310
|
-
|
|
49311
|
-
|
|
49312
|
-
|
|
49313
|
-
|
|
49314
|
-
|
|
49315
|
-
|
|
49316
|
-
|
|
49317
|
-
|
|
49318
|
-
|
|
49319
|
-
|
|
49320
|
-
|
|
49321
|
-
|
|
49322
|
-
|
|
49301
|
+
resolved = Bun.resolveSync(spec, process.cwd());
|
|
49302
|
+
} catch {
|
|
49303
|
+
continue;
|
|
49304
|
+
}
|
|
49305
|
+
let content;
|
|
49306
|
+
try {
|
|
49307
|
+
content = readFileSync15(resolved, "utf-8");
|
|
49308
|
+
} catch {
|
|
49309
|
+
continue;
|
|
49310
|
+
}
|
|
49311
|
+
let imports;
|
|
49312
|
+
try {
|
|
49313
|
+
imports = transpiler4.scanImports(content);
|
|
49314
|
+
} catch {
|
|
49315
|
+
continue;
|
|
49316
|
+
}
|
|
49317
|
+
for (const imp of imports) {
|
|
49318
|
+
const child = imp.path;
|
|
49319
|
+
if (!isBareSpecifier(child))
|
|
49320
|
+
continue;
|
|
49321
|
+
if (isFrameworkSpecifier(child))
|
|
49322
|
+
continue;
|
|
49323
|
+
if (isAbsolutePackageSpecifier(child))
|
|
49324
|
+
continue;
|
|
49325
|
+
if (alreadyVendored.has(child))
|
|
49326
|
+
continue;
|
|
49327
|
+
if (!isResolvable4(child))
|
|
49328
|
+
continue;
|
|
49329
|
+
newSpecs.add(child);
|
|
49330
|
+
}
|
|
49323
49331
|
}
|
|
49324
49332
|
return newSpecs;
|
|
49325
49333
|
}, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
@@ -49350,19 +49358,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49350
49358
|
const tmpDir = join22(buildDir, "_dep_vendor_tmp");
|
|
49351
49359
|
mkdirSync11(tmpDir, { recursive: true });
|
|
49352
49360
|
const allSpecs = new Set(initialSpecs);
|
|
49353
|
-
let
|
|
49361
|
+
let frontier = allSpecs;
|
|
49354
49362
|
for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
|
|
49355
|
-
const
|
|
49356
|
-
if (!result.success) {
|
|
49357
|
-
console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
|
|
49358
|
-
success = false;
|
|
49359
|
-
break;
|
|
49360
|
-
}
|
|
49361
|
-
const additional = await collectUnvendoredImports(vendorDir, allSpecs);
|
|
49363
|
+
const additional = await collectTransitiveImports(frontier, allSpecs);
|
|
49362
49364
|
if (additional.size === 0)
|
|
49363
49365
|
break;
|
|
49364
49366
|
for (const spec of additional)
|
|
49365
49367
|
allSpecs.add(spec);
|
|
49368
|
+
frontier = additional;
|
|
49369
|
+
}
|
|
49370
|
+
const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
|
|
49371
|
+
const success = result.success;
|
|
49372
|
+
if (!success) {
|
|
49373
|
+
console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
|
|
49366
49374
|
}
|
|
49367
49375
|
await rm9(tmpDir, { force: true, recursive: true });
|
|
49368
49376
|
if (success)
|
|
@@ -49373,9 +49381,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49373
49381
|
}
|
|
49374
49382
|
return paths;
|
|
49375
49383
|
}, computeDepVendorPaths = async (directories) => {
|
|
49376
|
-
const
|
|
49384
|
+
const initialSpecs = await scanBareImports(directories);
|
|
49385
|
+
const allSpecs = new Set(initialSpecs);
|
|
49386
|
+
let frontier = allSpecs;
|
|
49387
|
+
for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
|
|
49388
|
+
const additional = await collectTransitiveImports(frontier, allSpecs);
|
|
49389
|
+
if (additional.size === 0)
|
|
49390
|
+
break;
|
|
49391
|
+
for (const spec of additional)
|
|
49392
|
+
allSpecs.add(spec);
|
|
49393
|
+
frontier = additional;
|
|
49394
|
+
}
|
|
49377
49395
|
const paths = {};
|
|
49378
|
-
for (const specifier of
|
|
49396
|
+
for (const specifier of allSpecs) {
|
|
49379
49397
|
paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
|
|
49380
49398
|
}
|
|
49381
49399
|
return paths;
|
|
@@ -49745,5 +49763,5 @@ export {
|
|
|
49745
49763
|
build
|
|
49746
49764
|
};
|
|
49747
49765
|
|
|
49748
|
-
//# debugId=
|
|
49766
|
+
//# debugId=9E5578DF152AD2CB64756E2164756E21
|
|
49749
49767
|
//# sourceMappingURL=build.js.map
|