@absolutejs/absolute 0.19.0-beta.713 → 0.19.0-beta.714
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 +59 -15
- package/dist/build.js.map +3 -3
- package/dist/index.js +59 -15
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -49291,14 +49291,38 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49291
49291
|
if (rewritten !== original)
|
|
49292
49292
|
writeFileSync8(filePath, rewritten);
|
|
49293
49293
|
}
|
|
49294
|
-
},
|
|
49295
|
-
const
|
|
49296
|
-
|
|
49297
|
-
|
|
49298
|
-
|
|
49299
|
-
|
|
49300
|
-
|
|
49301
|
-
|
|
49294
|
+
}, collectUnvendoredImports = async (vendorDir, alreadyVendored) => {
|
|
49295
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync15 } = await import("fs");
|
|
49296
|
+
const transpiler4 = new Bun.Transpiler({ loader: "js" });
|
|
49297
|
+
const newSpecs = new Set;
|
|
49298
|
+
let entries;
|
|
49299
|
+
try {
|
|
49300
|
+
entries = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
49301
|
+
} catch {
|
|
49302
|
+
return newSpecs;
|
|
49303
|
+
}
|
|
49304
|
+
for (const entry of entries) {
|
|
49305
|
+
try {
|
|
49306
|
+
const content = readFileSync15(join22(vendorDir, entry), "utf-8");
|
|
49307
|
+
const imports = transpiler4.scanImports(content);
|
|
49308
|
+
for (const imp of imports) {
|
|
49309
|
+
const spec = imp.path;
|
|
49310
|
+
if (!isBareSpecifier(spec))
|
|
49311
|
+
continue;
|
|
49312
|
+
if (isFrameworkSpecifier(spec))
|
|
49313
|
+
continue;
|
|
49314
|
+
if (isAbsolutePackageSpecifier(spec))
|
|
49315
|
+
continue;
|
|
49316
|
+
if (alreadyVendored.has(spec))
|
|
49317
|
+
continue;
|
|
49318
|
+
if (!isResolvable4(spec))
|
|
49319
|
+
continue;
|
|
49320
|
+
newSpecs.add(spec);
|
|
49321
|
+
}
|
|
49322
|
+
} catch {}
|
|
49323
|
+
}
|
|
49324
|
+
return newSpecs;
|
|
49325
|
+
}, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
49302
49326
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
49303
49327
|
const safeName = toSafeFileName5(specifier);
|
|
49304
49328
|
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
@@ -49306,7 +49330,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49306
49330
|
await Bun.write(entryPath, source);
|
|
49307
49331
|
return entryPath;
|
|
49308
49332
|
}));
|
|
49309
|
-
|
|
49333
|
+
return bunBuild8({
|
|
49310
49334
|
entrypoints,
|
|
49311
49335
|
external: FRAMEWORK_EXTERNALS,
|
|
49312
49336
|
format: "esm",
|
|
@@ -49317,14 +49341,34 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
49317
49341
|
target: "browser",
|
|
49318
49342
|
throw: false
|
|
49319
49343
|
});
|
|
49320
|
-
|
|
49321
|
-
|
|
49322
|
-
|
|
49344
|
+
}, MAX_VENDOR_DISCOVERY_PASSES = 5, buildDepVendor = async (buildDir, directories) => {
|
|
49345
|
+
const initialSpecs = await scanBareImports(directories);
|
|
49346
|
+
if (initialSpecs.length === 0)
|
|
49347
|
+
return {};
|
|
49348
|
+
const vendorDir = join22(buildDir, "vendor");
|
|
49349
|
+
mkdirSync11(vendorDir, { recursive: true });
|
|
49350
|
+
const tmpDir = join22(buildDir, "_dep_vendor_tmp");
|
|
49351
|
+
mkdirSync11(tmpDir, { recursive: true });
|
|
49352
|
+
const allSpecs = new Set(initialSpecs);
|
|
49353
|
+
let success = true;
|
|
49354
|
+
for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
|
|
49355
|
+
const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
|
|
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);
|
|
49362
|
+
if (additional.size === 0)
|
|
49363
|
+
break;
|
|
49364
|
+
for (const spec of additional)
|
|
49365
|
+
allSpecs.add(spec);
|
|
49323
49366
|
}
|
|
49324
|
-
|
|
49367
|
+
await rm9(tmpDir, { force: true, recursive: true });
|
|
49368
|
+
if (success)
|
|
49325
49369
|
await rewriteVendorFiles(vendorDir);
|
|
49326
49370
|
const paths = {};
|
|
49327
|
-
for (const specifier of
|
|
49371
|
+
for (const specifier of allSpecs) {
|
|
49328
49372
|
paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
|
|
49329
49373
|
}
|
|
49330
49374
|
return paths;
|
|
@@ -49701,5 +49745,5 @@ export {
|
|
|
49701
49745
|
build
|
|
49702
49746
|
};
|
|
49703
49747
|
|
|
49704
|
-
//# debugId=
|
|
49748
|
+
//# debugId=E7551863E14CA1D564756E2164756E21
|
|
49705
49749
|
//# sourceMappingURL=build.js.map
|