@absolutejs/absolute 0.19.0-beta.1076 → 0.19.0-beta.1078
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +221 -3
- package/dist/angular/index.js.map +5 -4
- package/dist/angular/server.js +221 -3
- package/dist/angular/server.js.map +5 -4
- package/dist/build.js +228 -8
- package/dist/build.js.map +6 -5
- package/dist/cli/index.js +237 -4
- package/dist/index.js +236 -9
- package/dist/index.js.map +7 -6
- package/dist/islands/index.js +221 -3
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +221 -3
- package/dist/react/index.js.map +5 -4
- package/dist/src/build/maskLiterals.d.ts +23 -0
- package/dist/src/cli/utils.d.ts +1 -0
- package/dist/svelte/index.js +221 -3
- package/dist/svelte/index.js.map +5 -4
- package/dist/vue/index.js +221 -3
- package/dist/vue/index.js.map +5 -4
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -2436,6 +2436,222 @@ var init_islandSsr = __esm(() => {
|
|
|
2436
2436
|
LEADING_HOISTED_RESOURCE_RE = /^\s*(?:<link\b[^>]*\/?>|<meta\b[^>]*\/?>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i;
|
|
2437
2437
|
});
|
|
2438
2438
|
|
|
2439
|
+
// src/build/maskLiterals.ts
|
|
2440
|
+
var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
|
|
2441
|
+
const n = src.length;
|
|
2442
|
+
const pieces = [];
|
|
2443
|
+
let out = "";
|
|
2444
|
+
let i = 0;
|
|
2445
|
+
let prevChar = "";
|
|
2446
|
+
let prevWord = "";
|
|
2447
|
+
const mask = (text) => {
|
|
2448
|
+
out += SENTINEL + pieces.length + SENTINEL;
|
|
2449
|
+
pieces.push(text);
|
|
2450
|
+
};
|
|
2451
|
+
const endOfInterp = (start) => {
|
|
2452
|
+
let j = start;
|
|
2453
|
+
let depth = 1;
|
|
2454
|
+
while (j < n && depth > 0) {
|
|
2455
|
+
const c = src[j];
|
|
2456
|
+
if (c === "\\") {
|
|
2457
|
+
j += 2;
|
|
2458
|
+
continue;
|
|
2459
|
+
}
|
|
2460
|
+
if (c === "`") {
|
|
2461
|
+
j = endOfTemplate(j);
|
|
2462
|
+
continue;
|
|
2463
|
+
}
|
|
2464
|
+
if (c === '"' || c === "'") {
|
|
2465
|
+
j = endOfString(j);
|
|
2466
|
+
continue;
|
|
2467
|
+
}
|
|
2468
|
+
if (c === "/" && src[j + 1] === "/") {
|
|
2469
|
+
const nl = src.indexOf(`
|
|
2470
|
+
`, j);
|
|
2471
|
+
j = nl < 0 ? n : nl;
|
|
2472
|
+
continue;
|
|
2473
|
+
}
|
|
2474
|
+
if (c === "/" && src[j + 1] === "*") {
|
|
2475
|
+
const e = src.indexOf("*/", j + 2);
|
|
2476
|
+
j = e < 0 ? n : e + 2;
|
|
2477
|
+
continue;
|
|
2478
|
+
}
|
|
2479
|
+
if (c === "{")
|
|
2480
|
+
depth++;
|
|
2481
|
+
else if (c === "}")
|
|
2482
|
+
depth--;
|
|
2483
|
+
j++;
|
|
2484
|
+
}
|
|
2485
|
+
return j;
|
|
2486
|
+
};
|
|
2487
|
+
function endOfTemplate(start) {
|
|
2488
|
+
let j = start + 1;
|
|
2489
|
+
while (j < n) {
|
|
2490
|
+
const c = src[j];
|
|
2491
|
+
if (c === "\\") {
|
|
2492
|
+
j += 2;
|
|
2493
|
+
continue;
|
|
2494
|
+
}
|
|
2495
|
+
if (c === "`")
|
|
2496
|
+
return j + 1;
|
|
2497
|
+
if (c === "$" && src[j + 1] === "{") {
|
|
2498
|
+
j = endOfInterp(j + 2);
|
|
2499
|
+
continue;
|
|
2500
|
+
}
|
|
2501
|
+
j++;
|
|
2502
|
+
}
|
|
2503
|
+
return j;
|
|
2504
|
+
}
|
|
2505
|
+
function endOfString(start) {
|
|
2506
|
+
const q = src[start];
|
|
2507
|
+
let j = start + 1;
|
|
2508
|
+
while (j < n) {
|
|
2509
|
+
const c = src[j];
|
|
2510
|
+
if (c === "\\") {
|
|
2511
|
+
j += 2;
|
|
2512
|
+
continue;
|
|
2513
|
+
}
|
|
2514
|
+
if (c === q)
|
|
2515
|
+
return j + 1;
|
|
2516
|
+
if (c === `
|
|
2517
|
+
`)
|
|
2518
|
+
return j;
|
|
2519
|
+
j++;
|
|
2520
|
+
}
|
|
2521
|
+
return j;
|
|
2522
|
+
}
|
|
2523
|
+
const endOfRegex = (start) => {
|
|
2524
|
+
let j = start + 1;
|
|
2525
|
+
let inClass = false;
|
|
2526
|
+
while (j < n) {
|
|
2527
|
+
const c = src[j];
|
|
2528
|
+
if (c === "\\") {
|
|
2529
|
+
j += 2;
|
|
2530
|
+
continue;
|
|
2531
|
+
}
|
|
2532
|
+
if (c === `
|
|
2533
|
+
`)
|
|
2534
|
+
return -1;
|
|
2535
|
+
if (c === "[")
|
|
2536
|
+
inClass = true;
|
|
2537
|
+
else if (c === "]")
|
|
2538
|
+
inClass = false;
|
|
2539
|
+
else if (c === "/" && !inClass) {
|
|
2540
|
+
j++;
|
|
2541
|
+
break;
|
|
2542
|
+
}
|
|
2543
|
+
j++;
|
|
2544
|
+
}
|
|
2545
|
+
while (j < n && /[a-z]/i.test(src[j] ?? ""))
|
|
2546
|
+
j++;
|
|
2547
|
+
return j;
|
|
2548
|
+
};
|
|
2549
|
+
while (i < n) {
|
|
2550
|
+
const c = src[i];
|
|
2551
|
+
const c2 = src[i + 1];
|
|
2552
|
+
if (c === "/" && c2 === "/") {
|
|
2553
|
+
out += "//";
|
|
2554
|
+
i += 2;
|
|
2555
|
+
const s = i;
|
|
2556
|
+
while (i < n && src[i] !== `
|
|
2557
|
+
`)
|
|
2558
|
+
i++;
|
|
2559
|
+
mask(src.slice(s, i));
|
|
2560
|
+
prevChar = "";
|
|
2561
|
+
prevWord = "";
|
|
2562
|
+
continue;
|
|
2563
|
+
}
|
|
2564
|
+
if (c === "/" && c2 === "*") {
|
|
2565
|
+
out += "/*";
|
|
2566
|
+
i += 2;
|
|
2567
|
+
const e = src.indexOf("*/", i);
|
|
2568
|
+
const end = e < 0 ? n : e;
|
|
2569
|
+
mask(src.slice(i, end));
|
|
2570
|
+
i = end < n ? end + 2 : n;
|
|
2571
|
+
if (end < n)
|
|
2572
|
+
out += "*/";
|
|
2573
|
+
continue;
|
|
2574
|
+
}
|
|
2575
|
+
if (c === "`") {
|
|
2576
|
+
const end = endOfTemplate(i);
|
|
2577
|
+
mask(src.slice(i, end));
|
|
2578
|
+
i = end;
|
|
2579
|
+
prevChar = "`";
|
|
2580
|
+
prevWord = "";
|
|
2581
|
+
continue;
|
|
2582
|
+
}
|
|
2583
|
+
if (c === '"' || c === "'") {
|
|
2584
|
+
const end = endOfString(i);
|
|
2585
|
+
out += src.slice(i, end);
|
|
2586
|
+
i = end;
|
|
2587
|
+
prevChar = '"';
|
|
2588
|
+
prevWord = "";
|
|
2589
|
+
continue;
|
|
2590
|
+
}
|
|
2591
|
+
if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
|
|
2592
|
+
const end = endOfRegex(i);
|
|
2593
|
+
if (end > 0) {
|
|
2594
|
+
out += src.slice(i, end);
|
|
2595
|
+
i = end;
|
|
2596
|
+
prevChar = "/";
|
|
2597
|
+
prevWord = "";
|
|
2598
|
+
continue;
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
out += c;
|
|
2602
|
+
i++;
|
|
2603
|
+
if (c === " " || c === "\t" || c === "\r" || c === `
|
|
2604
|
+
`)
|
|
2605
|
+
continue;
|
|
2606
|
+
const wasIdent = isIdentChar(prevChar);
|
|
2607
|
+
prevChar = c;
|
|
2608
|
+
prevWord = isIdentChar(c) ? wasIdent ? prevWord + c : c : "";
|
|
2609
|
+
}
|
|
2610
|
+
const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
|
|
2611
|
+
const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
|
|
2612
|
+
return { masked: out, restore };
|
|
2613
|
+
};
|
|
2614
|
+
var init_maskLiterals = __esm(() => {
|
|
2615
|
+
REGEX_OK_AFTER_CHAR = new Set([
|
|
2616
|
+
"(",
|
|
2617
|
+
",",
|
|
2618
|
+
"=",
|
|
2619
|
+
":",
|
|
2620
|
+
"[",
|
|
2621
|
+
"!",
|
|
2622
|
+
"&",
|
|
2623
|
+
"|",
|
|
2624
|
+
"?",
|
|
2625
|
+
"{",
|
|
2626
|
+
"}",
|
|
2627
|
+
";",
|
|
2628
|
+
"+",
|
|
2629
|
+
"-",
|
|
2630
|
+
"*",
|
|
2631
|
+
"/",
|
|
2632
|
+
"%",
|
|
2633
|
+
"^",
|
|
2634
|
+
"~",
|
|
2635
|
+
"<",
|
|
2636
|
+
">"
|
|
2637
|
+
]);
|
|
2638
|
+
REGEX_OK_AFTER_WORD = new Set([
|
|
2639
|
+
"return",
|
|
2640
|
+
"typeof",
|
|
2641
|
+
"instanceof",
|
|
2642
|
+
"in",
|
|
2643
|
+
"of",
|
|
2644
|
+
"new",
|
|
2645
|
+
"delete",
|
|
2646
|
+
"void",
|
|
2647
|
+
"do",
|
|
2648
|
+
"else",
|
|
2649
|
+
"yield",
|
|
2650
|
+
"await",
|
|
2651
|
+
"case"
|
|
2652
|
+
]);
|
|
2653
|
+
});
|
|
2654
|
+
|
|
2439
2655
|
// src/build/nativeRewrite.ts
|
|
2440
2656
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
2441
2657
|
import { platform, arch } from "os";
|
|
@@ -2526,8 +2742,9 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrite
|
|
|
2526
2742
|
if (Object.keys(vendorPaths).length === 0)
|
|
2527
2743
|
return content;
|
|
2528
2744
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2745
|
+
const { masked, restore } = maskLiterals(content);
|
|
2746
|
+
const native = nativeRewriteImports(masked, replacements);
|
|
2747
|
+
return restore(native ?? jsRewriteImports(masked, replacements));
|
|
2531
2748
|
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
2532
2749
|
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
2533
2750
|
REEXPORT_PATTERN.lastIndex = 0;
|
|
@@ -2673,6 +2890,7 @@ ${content}`;
|
|
|
2673
2890
|
return result;
|
|
2674
2891
|
};
|
|
2675
2892
|
var init_rewriteImportsPlugin = __esm(() => {
|
|
2893
|
+
init_maskLiterals();
|
|
2676
2894
|
init_nativeRewrite();
|
|
2677
2895
|
});
|
|
2678
2896
|
|
|
@@ -11198,14 +11416,16 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), rewriter
|
|
|
11198
11416
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
11199
11417
|
await Promise.all(jsFiles.map(async (filePath) => {
|
|
11200
11418
|
const original = await Bun.file(filePath).text();
|
|
11201
|
-
const
|
|
11202
|
-
const
|
|
11419
|
+
const { masked, restore } = maskLiterals(original);
|
|
11420
|
+
const native = nativeRewriteImports(masked, replacements);
|
|
11421
|
+
const content = restore(native ?? applyAllReplacements(masked, rewriter));
|
|
11203
11422
|
if (content !== original) {
|
|
11204
11423
|
await Bun.write(filePath, content);
|
|
11205
11424
|
}
|
|
11206
11425
|
}));
|
|
11207
11426
|
};
|
|
11208
11427
|
var init_rewriteReactImports = __esm(() => {
|
|
11428
|
+
init_maskLiterals();
|
|
11209
11429
|
init_nativeRewrite();
|
|
11210
11430
|
rewriterCache = new Map;
|
|
11211
11431
|
REFRESH_STUBS = "window.$RefreshReg$||(window.$RefreshReg$=function(){});" + `window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});
|
|
@@ -13403,7 +13623,7 @@ var init_chainInlineSourcemaps = __esm(() => {
|
|
|
13403
13623
|
});
|
|
13404
13624
|
|
|
13405
13625
|
// src/build/vueAutoRouterTransform.ts
|
|
13406
|
-
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX,
|
|
13626
|
+
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL2 = "__ABSOLUTE_AUTO_ROUTER__", SETUP_APP_DECLARATION_REGEX, SETUP_APP_FUNCTION_REGEX, addAutoRouterSetupApp = (sourceContent) => {
|
|
13407
13627
|
if (!ROUTES_EXPORT_REGEX.test(sourceContent))
|
|
13408
13628
|
return sourceContent;
|
|
13409
13629
|
const match = SCRIPT_REGEX.exec(sourceContent);
|
|
@@ -13412,13 +13632,13 @@ var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL = "__ABSOLUTE_AUTO_ROUTER__", SE
|
|
|
13412
13632
|
const [, openTag, scriptBody, closeTag] = match;
|
|
13413
13633
|
if (!openTag || scriptBody === undefined || !closeTag)
|
|
13414
13634
|
return sourceContent;
|
|
13415
|
-
if (scriptBody.includes(
|
|
13635
|
+
if (scriptBody.includes(SENTINEL2))
|
|
13416
13636
|
return sourceContent;
|
|
13417
13637
|
let rewrittenScript = scriptBody.replace(SETUP_APP_DECLARATION_REGEX, "const __absoluteUserSetupApp__");
|
|
13418
13638
|
rewrittenScript = rewrittenScript.replace(SETUP_APP_FUNCTION_REGEX, "$1 __absoluteUserSetupApp__");
|
|
13419
13639
|
const userHadSetupApp = rewrittenScript !== scriptBody;
|
|
13420
13640
|
const autoWrapper = `
|
|
13421
|
-
// ${
|
|
13641
|
+
// ${SENTINEL2} \u2014 generated by AbsoluteJS because this page exports
|
|
13422
13642
|
// \`routes\`. Owns the vue-router lifecycle (history pick, app.use,
|
|
13423
13643
|
// push, isReady) so user code stays declarative.
|
|
13424
13644
|
import {
|
|
@@ -27722,5 +27942,5 @@ export {
|
|
|
27722
27942
|
build
|
|
27723
27943
|
};
|
|
27724
27944
|
|
|
27725
|
-
//# debugId=
|
|
27945
|
+
//# debugId=0D8E947954EA50F864756E2164756E21
|
|
27726
27946
|
//# sourceMappingURL=build.js.map
|