@absolutejs/absolute 0.20.0-beta.155 → 0.20.0-beta.157
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/CHANGELOG.md +12 -0
- package/changelog.json +20 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +4 -2
- package/dist/build.js.map +3 -3
- package/dist/cli/{compile-n5fbn66t.js → compile-myhwnrrn.js} +320 -114
- package/dist/cli/{index-039rh39e.js → index-bp60baze.js} +63 -1
- package/dist/cli/{index-33d63fnz.js → index-cnchgvtx.js} +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/cli/{mobile-ssnm4efz.js → mobile-gtnrcfsf.js} +1 -1
- package/dist/cli/rewriteImports-z6629aww.js +46 -0
- package/dist/cli/{start-3q57gyah.js → start-3bbpy0md.js} +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +3 -3
- package/dist/runtime/clientAssetArchive.js +215 -0
- package/dist/runtime/clientAssetArchive.js.map +10 -0
- package/dist/src/build/compiledClientGraph.d.ts +7 -0
- package/dist/src/runtime/clientAssetArchive.d.ts +5 -0
- package/package.json +1 -1
- package/dist/cli/rewriteImports-k6rjjmg1.js +0 -108
|
@@ -283,4 +283,66 @@ var maskLiterals = (src) => {
|
|
|
283
283
|
return { masked: state.parts.join(""), restore };
|
|
284
284
|
};
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
// src/build/specifierRewriter.ts
|
|
287
|
+
var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
288
|
+
var PLACEHOLDER = `${SENTINEL}\\d+${SENTINEL}`;
|
|
289
|
+
var GAP = `(?:\\s|${PLACEHOLDER}|/\\*${PLACEHOLDER}\\*/|//${PLACEHOLDER})*`;
|
|
290
|
+
var QUOTE = `["']`;
|
|
291
|
+
var ADJACENT_PREFIXES = [`from\\s*${QUOTE}`, `import\\s*${QUOTE}`];
|
|
292
|
+
var ADJACENT_DYNAMIC_PREFIX = `import\\s*\\(\\s*${QUOTE}`;
|
|
293
|
+
var ADJACENT_DYNAMIC_SUFFIX = `${QUOTE}\\s*\\)`;
|
|
294
|
+
var SWEEP_PREFIXES = [
|
|
295
|
+
`\\bfrom${GAP}${QUOTE}`,
|
|
296
|
+
`\\bimport${GAP}${QUOTE}`,
|
|
297
|
+
`\\b(?:import|require)${GAP}\\(${GAP}${QUOTE}`
|
|
298
|
+
];
|
|
299
|
+
var rewriterCache = new Map;
|
|
300
|
+
var cacheKey = (vendorPaths) => Object.entries(vendorPaths).sort(([left], [right]) => left.localeCompare(right)).map(([specifier, webPath]) => `${specifier}\x00${webPath}\x00`).join("");
|
|
301
|
+
var compileRegex = (prefixes, alternation, withAdjacentDynamic) => {
|
|
302
|
+
const plain = `(${prefixes.join("|")})(${alternation})(${QUOTE})`;
|
|
303
|
+
if (!withAdjacentDynamic)
|
|
304
|
+
return new RegExp(plain, "g");
|
|
305
|
+
const dynamic = `(${ADJACENT_DYNAMIC_PREFIX})(${alternation})(${ADJACENT_DYNAMIC_SUFFIX})`;
|
|
306
|
+
return new RegExp(`${plain}|${dynamic}`, "g");
|
|
307
|
+
};
|
|
308
|
+
var compileSpecifierRewriter = (vendorPaths) => {
|
|
309
|
+
const key = cacheKey(vendorPaths);
|
|
310
|
+
const cached = rewriterCache.get(key);
|
|
311
|
+
if (cached)
|
|
312
|
+
return cached;
|
|
313
|
+
const replacements = Object.entries(vendorPaths).sort(([specA], [specB]) => specB.length - specA.length);
|
|
314
|
+
const alternation = replacements.map(([specifier]) => escapeRegex(specifier)).join("|");
|
|
315
|
+
const rewriter = {
|
|
316
|
+
lookup: new Map(replacements),
|
|
317
|
+
mainRegex: compileRegex(ADJACENT_PREFIXES, alternation, true),
|
|
318
|
+
quotedSpecifiers: replacements.flatMap(([specifier]) => [
|
|
319
|
+
`"${specifier}`,
|
|
320
|
+
`'${specifier}`
|
|
321
|
+
]),
|
|
322
|
+
sweepRegex: compileRegex(SWEEP_PREFIXES, alternation, false),
|
|
323
|
+
unionRegex: compileRegex([...ADJACENT_PREFIXES, ...SWEEP_PREFIXES], alternation, true)
|
|
324
|
+
};
|
|
325
|
+
rewriterCache.set(key, rewriter);
|
|
326
|
+
return rewriter;
|
|
327
|
+
};
|
|
328
|
+
var hasSpecifierCandidate = (content, rewriter) => rewriter.quotedSpecifiers.some((quoted) => content.includes(quoted));
|
|
329
|
+
var asGroup = (value) => typeof value === "string" ? value : undefined;
|
|
330
|
+
var replaceSpecifier = (lookup) => (match, ...groups) => {
|
|
331
|
+
const [prefixA, specA, suffixA, prefixB, specB, suffixB] = groups;
|
|
332
|
+
const prefix = asGroup(prefixA) ?? asGroup(prefixB);
|
|
333
|
+
const specifier = asGroup(specA) ?? asGroup(specB);
|
|
334
|
+
const suffix = asGroup(suffixA) ?? asGroup(suffixB);
|
|
335
|
+
if (prefix === undefined || specifier === undefined || suffix === undefined)
|
|
336
|
+
return match;
|
|
337
|
+
const webPath = lookup.get(specifier);
|
|
338
|
+
return webPath === undefined ? match : `${prefix}${webPath}${suffix}`;
|
|
339
|
+
};
|
|
340
|
+
var rewriteContentSpecifiers = (content, rewriter, options) => {
|
|
341
|
+
if (!hasSpecifierCandidate(content, rewriter))
|
|
342
|
+
return content;
|
|
343
|
+
const { masked, restore } = maskLiterals(content);
|
|
344
|
+
return restore(rewriteSpecifiers(masked, rewriter, options));
|
|
345
|
+
};
|
|
346
|
+
var rewriteSpecifiers = (masked, rewriter, options) => masked.replace(options.sweep ? rewriter.unionRegex : rewriter.mainRegex, replaceSpecifier(rewriter.lookup));
|
|
347
|
+
|
|
348
|
+
export { maskLiterals, compileSpecifierRewriter, rewriteContentSpecifiers };
|
|
@@ -420,7 +420,7 @@ var start2 = async (serverEntry, outdir, configPath, options = {}) => {
|
|
|
420
420
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
421
421
|
}
|
|
422
422
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
423
|
-
const { rewriteImports } = await import("./rewriteImports-
|
|
423
|
+
const { rewriteImports } = await import("./rewriteImports-z6629aww.js");
|
|
424
424
|
await rewriteImports([outputPath], angularServerVendorPaths);
|
|
425
425
|
}
|
|
426
426
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -70,7 +70,7 @@ if (command === "dev") {
|
|
|
70
70
|
const configPath = parseNamedArg("--config");
|
|
71
71
|
const positionalArgs = stripNamedArgs("--outdir", "--config").filter((arg) => arg !== "--prebuilt");
|
|
72
72
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
73
|
-
const { start } = await import("./start-
|
|
73
|
+
const { start } = await import("./start-3bbpy0md.js");
|
|
74
74
|
await start(serverEntry, outdir, configPath, {
|
|
75
75
|
prebuilt: args.includes("--prebuilt")
|
|
76
76
|
});
|
|
@@ -80,7 +80,7 @@ if (command === "dev") {
|
|
|
80
80
|
const configPath = parseNamedArg("--config");
|
|
81
81
|
const positionalArgs = stripNamedArgs("--outdir", "--config");
|
|
82
82
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
83
|
-
const { start } = await import("./start-
|
|
83
|
+
const { start } = await import("./start-3bbpy0md.js");
|
|
84
84
|
await start(serverEntry, outdir, configPath, { prepareOnly: true });
|
|
85
85
|
} else if (command === "build") {
|
|
86
86
|
sendTelemetryEvent("cli:command", { command });
|
|
@@ -205,13 +205,13 @@ if (command === "dev") {
|
|
|
205
205
|
const configPath = parseNamedArg("--config");
|
|
206
206
|
const positionalArgs = stripNamedArgs("--outdir", "--outfile", "--config");
|
|
207
207
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
208
|
-
const { compile } = await import("./compile-
|
|
208
|
+
const { compile } = await import("./compile-myhwnrrn.js");
|
|
209
209
|
await compile(serverEntry, outdir, outfile, configPath);
|
|
210
210
|
} else if (command === "mobile") {
|
|
211
211
|
sendTelemetryEvent("cli:command", {
|
|
212
212
|
command: `mobile:${workspaceCommand ?? "unknown"}`
|
|
213
213
|
});
|
|
214
|
-
const { runMobile } = await import("./mobile-
|
|
214
|
+
const { runMobile } = await import("./mobile-gtnrcfsf.js");
|
|
215
215
|
try {
|
|
216
216
|
await runMobile(args);
|
|
217
217
|
} catch (error) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
compileSpecifierRewriter,
|
|
4
|
+
rewriteContentSpecifiers
|
|
5
|
+
} from "./index-bp60baze.js";
|
|
6
|
+
|
|
7
|
+
// src/build/rewriteImportsPlugin.ts
|
|
8
|
+
var rewriteImportsInContent = (content, vendorPaths) => {
|
|
9
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
10
|
+
return content;
|
|
11
|
+
return rewriteContentSpecifiers(content, compileSpecifierRewriter(vendorPaths), { sweep: false });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/build/rewriteImports.ts
|
|
15
|
+
var rewriteImports = async (outputPaths, vendorPaths) => {
|
|
16
|
+
const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
|
|
17
|
+
if (jsFiles.length === 0)
|
|
18
|
+
return;
|
|
19
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
20
|
+
return;
|
|
21
|
+
await Promise.all(jsFiles.map(async (filePath) => {
|
|
22
|
+
let original;
|
|
23
|
+
try {
|
|
24
|
+
original = await Bun.file(filePath).text();
|
|
25
|
+
} catch (err) {
|
|
26
|
+
const code = err.code;
|
|
27
|
+
if (code === "ENOENT")
|
|
28
|
+
return;
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
32
|
+
if (rewritten === original)
|
|
33
|
+
return;
|
|
34
|
+
try {
|
|
35
|
+
await Bun.write(filePath, rewritten);
|
|
36
|
+
} catch (err) {
|
|
37
|
+
const code = err.code;
|
|
38
|
+
if (code === "ENOENT")
|
|
39
|
+
return;
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
rewriteImports
|
|
46
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -26287,7 +26287,9 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
26287
26287
|
const output = nonReactClientOutputs.find((artifact) => basename17(artifact.path).startsWith(`${srcBase}.`));
|
|
26288
26288
|
if (!output)
|
|
26289
26289
|
continue;
|
|
26290
|
-
|
|
26290
|
+
const url = `/${relative21(buildPath, output.path).replace(/\\/g, "/")}`;
|
|
26291
|
+
urlFileMap.set(basename17(srcPath), url);
|
|
26292
|
+
urlFileMap.set(basename17(srcPath).replace(/\.tsx?$/, ".js"), url);
|
|
26291
26293
|
}
|
|
26292
26294
|
return urlFileMap;
|
|
26293
26295
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -44158,5 +44160,5 @@ export {
|
|
|
44158
44160
|
wrapPageHandlerWithStreamingSlots
|
|
44159
44161
|
};
|
|
44160
44162
|
|
|
44161
|
-
//# debugId=
|
|
44163
|
+
//# debugId=C19421CAE2DC8E5364756E2164756E21
|
|
44162
44164
|
//# sourceMappingURL=index.js.map
|