@absolutejs/absolute 0.19.0-beta.1077 → 0.19.0-beta.1079
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 +239 -3
- package/dist/angular/index.js.map +5 -4
- package/dist/angular/server.js +239 -3
- package/dist/angular/server.js.map +5 -4
- package/dist/build.js +246 -8
- package/dist/build.js.map +6 -5
- package/dist/cli/index.js +242 -3
- package/dist/index.js +246 -8
- package/dist/index.js.map +6 -5
- package/dist/islands/index.js +239 -3
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +239 -3
- package/dist/react/index.js.map +5 -4
- package/dist/src/build/maskLiterals.d.ts +25 -0
- package/dist/svelte/index.js +239 -3
- package/dist/svelte/index.js.map +5 -4
- package/dist/vue/index.js +239 -3
- package/dist/vue/index.js.map +5 -4
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -2436,6 +2436,240 @@ 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, 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
|
+
let prevWasSpace = false;
|
|
2448
|
+
let wordBeforeParen = "";
|
|
2449
|
+
const mask = (text) => {
|
|
2450
|
+
out += SENTINEL + pieces.length + SENTINEL;
|
|
2451
|
+
pieces.push(text);
|
|
2452
|
+
prevChar = ")";
|
|
2453
|
+
prevWord = "";
|
|
2454
|
+
prevWasSpace = false;
|
|
2455
|
+
};
|
|
2456
|
+
const endOfString = (start) => {
|
|
2457
|
+
const q = src[start];
|
|
2458
|
+
let j = start + 1;
|
|
2459
|
+
while (j < n) {
|
|
2460
|
+
const c = src[j];
|
|
2461
|
+
if (c === "\\") {
|
|
2462
|
+
j += 2;
|
|
2463
|
+
continue;
|
|
2464
|
+
}
|
|
2465
|
+
if (c === q)
|
|
2466
|
+
return j + 1;
|
|
2467
|
+
if (c === `
|
|
2468
|
+
`)
|
|
2469
|
+
return j;
|
|
2470
|
+
j++;
|
|
2471
|
+
}
|
|
2472
|
+
return j;
|
|
2473
|
+
};
|
|
2474
|
+
const endOfInterp = (start) => {
|
|
2475
|
+
let j = start;
|
|
2476
|
+
let depth = 1;
|
|
2477
|
+
while (j < n && depth > 0) {
|
|
2478
|
+
const c = src[j];
|
|
2479
|
+
if (c === "\\") {
|
|
2480
|
+
j += 2;
|
|
2481
|
+
continue;
|
|
2482
|
+
}
|
|
2483
|
+
if (c === "`") {
|
|
2484
|
+
j = endOfTemplate(j);
|
|
2485
|
+
continue;
|
|
2486
|
+
}
|
|
2487
|
+
if (c === '"' || c === "'") {
|
|
2488
|
+
j = endOfString(j);
|
|
2489
|
+
continue;
|
|
2490
|
+
}
|
|
2491
|
+
if (c === "/" && src[j + 1] === "/") {
|
|
2492
|
+
const nl = src.indexOf(`
|
|
2493
|
+
`, j);
|
|
2494
|
+
j = nl < 0 ? n : nl;
|
|
2495
|
+
continue;
|
|
2496
|
+
}
|
|
2497
|
+
if (c === "/" && src[j + 1] === "*") {
|
|
2498
|
+
const e = src.indexOf("*/", j + 2);
|
|
2499
|
+
j = e < 0 ? n : e + 2;
|
|
2500
|
+
continue;
|
|
2501
|
+
}
|
|
2502
|
+
if (c === "{")
|
|
2503
|
+
depth++;
|
|
2504
|
+
else if (c === "}")
|
|
2505
|
+
depth--;
|
|
2506
|
+
j++;
|
|
2507
|
+
}
|
|
2508
|
+
return j;
|
|
2509
|
+
};
|
|
2510
|
+
function endOfTemplate(start) {
|
|
2511
|
+
let j = start + 1;
|
|
2512
|
+
while (j < n) {
|
|
2513
|
+
const c = src[j];
|
|
2514
|
+
if (c === "\\") {
|
|
2515
|
+
j += 2;
|
|
2516
|
+
continue;
|
|
2517
|
+
}
|
|
2518
|
+
if (c === "`")
|
|
2519
|
+
return j + 1;
|
|
2520
|
+
if (c === "$" && src[j + 1] === "{") {
|
|
2521
|
+
j = endOfInterp(j + 2);
|
|
2522
|
+
continue;
|
|
2523
|
+
}
|
|
2524
|
+
j++;
|
|
2525
|
+
}
|
|
2526
|
+
return j;
|
|
2527
|
+
}
|
|
2528
|
+
const endOfRegex = (start) => {
|
|
2529
|
+
let j = start + 1;
|
|
2530
|
+
let inClass = false;
|
|
2531
|
+
while (j < n) {
|
|
2532
|
+
const c = src[j];
|
|
2533
|
+
if (c === "\\") {
|
|
2534
|
+
j += 2;
|
|
2535
|
+
continue;
|
|
2536
|
+
}
|
|
2537
|
+
if (c === `
|
|
2538
|
+
`)
|
|
2539
|
+
return -1;
|
|
2540
|
+
if (c === "[")
|
|
2541
|
+
inClass = true;
|
|
2542
|
+
else if (c === "]")
|
|
2543
|
+
inClass = false;
|
|
2544
|
+
else if (c === "/" && !inClass) {
|
|
2545
|
+
j++;
|
|
2546
|
+
break;
|
|
2547
|
+
}
|
|
2548
|
+
j++;
|
|
2549
|
+
}
|
|
2550
|
+
while (j < n && /[a-z]/i.test(src[j] ?? ""))
|
|
2551
|
+
j++;
|
|
2552
|
+
return j;
|
|
2553
|
+
};
|
|
2554
|
+
while (i < n) {
|
|
2555
|
+
const c = src[i];
|
|
2556
|
+
const c2 = src[i + 1];
|
|
2557
|
+
if (c === "/" && c2 === "/") {
|
|
2558
|
+
out += "//";
|
|
2559
|
+
i += 2;
|
|
2560
|
+
const s = i;
|
|
2561
|
+
while (i < n && src[i] !== `
|
|
2562
|
+
`)
|
|
2563
|
+
i++;
|
|
2564
|
+
mask(src.slice(s, i));
|
|
2565
|
+
continue;
|
|
2566
|
+
}
|
|
2567
|
+
if (c === "/" && c2 === "*") {
|
|
2568
|
+
out += "/*";
|
|
2569
|
+
i += 2;
|
|
2570
|
+
const e = src.indexOf("*/", i);
|
|
2571
|
+
const end = e < 0 ? n : e;
|
|
2572
|
+
mask(src.slice(i, end));
|
|
2573
|
+
i = end < n ? end + 2 : n;
|
|
2574
|
+
if (end < n)
|
|
2575
|
+
out += "*/";
|
|
2576
|
+
continue;
|
|
2577
|
+
}
|
|
2578
|
+
if (c === "`") {
|
|
2579
|
+
const end = endOfTemplate(i);
|
|
2580
|
+
mask(src.slice(i, end));
|
|
2581
|
+
i = end;
|
|
2582
|
+
continue;
|
|
2583
|
+
}
|
|
2584
|
+
if (c === '"' || c === "'") {
|
|
2585
|
+
const end = endOfString(i);
|
|
2586
|
+
const isSpecifier = prevWord === "from" || prevWord === "import" || prevChar === "(" && (wordBeforeParen === "import" || wordBeforeParen === "require");
|
|
2587
|
+
if (isSpecifier) {
|
|
2588
|
+
out += src.slice(i, end);
|
|
2589
|
+
prevChar = '"';
|
|
2590
|
+
prevWord = "";
|
|
2591
|
+
prevWasSpace = false;
|
|
2592
|
+
} else {
|
|
2593
|
+
mask(src.slice(i, end));
|
|
2594
|
+
}
|
|
2595
|
+
i = end;
|
|
2596
|
+
continue;
|
|
2597
|
+
}
|
|
2598
|
+
if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
|
|
2599
|
+
const end = endOfRegex(i);
|
|
2600
|
+
if (end > 0) {
|
|
2601
|
+
out += src.slice(i, end);
|
|
2602
|
+
i = end;
|
|
2603
|
+
prevChar = ")";
|
|
2604
|
+
prevWord = "";
|
|
2605
|
+
prevWasSpace = false;
|
|
2606
|
+
continue;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
out += c;
|
|
2610
|
+
i++;
|
|
2611
|
+
if (c === " " || c === "\t" || c === "\r" || c === `
|
|
2612
|
+
`) {
|
|
2613
|
+
prevWasSpace = true;
|
|
2614
|
+
continue;
|
|
2615
|
+
}
|
|
2616
|
+
if (isIdentChar(c)) {
|
|
2617
|
+
const contiguous = isIdentChar(prevChar) && !prevWasSpace;
|
|
2618
|
+
prevWord = contiguous ? prevWord + c : c;
|
|
2619
|
+
} else {
|
|
2620
|
+
if (c === "(")
|
|
2621
|
+
wordBeforeParen = prevWord;
|
|
2622
|
+
prevWord = "";
|
|
2623
|
+
}
|
|
2624
|
+
prevChar = c;
|
|
2625
|
+
prevWasSpace = false;
|
|
2626
|
+
}
|
|
2627
|
+
const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
|
|
2628
|
+
const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
|
|
2629
|
+
return { masked: out, restore };
|
|
2630
|
+
};
|
|
2631
|
+
var init_maskLiterals = __esm(() => {
|
|
2632
|
+
SENTINEL = String.fromCharCode(57344);
|
|
2633
|
+
REGEX_OK_AFTER_CHAR = new Set([
|
|
2634
|
+
"(",
|
|
2635
|
+
",",
|
|
2636
|
+
"=",
|
|
2637
|
+
":",
|
|
2638
|
+
"[",
|
|
2639
|
+
"!",
|
|
2640
|
+
"&",
|
|
2641
|
+
"|",
|
|
2642
|
+
"?",
|
|
2643
|
+
"{",
|
|
2644
|
+
"}",
|
|
2645
|
+
";",
|
|
2646
|
+
"+",
|
|
2647
|
+
"-",
|
|
2648
|
+
"*",
|
|
2649
|
+
"/",
|
|
2650
|
+
"%",
|
|
2651
|
+
"^",
|
|
2652
|
+
"~",
|
|
2653
|
+
"<",
|
|
2654
|
+
">"
|
|
2655
|
+
]);
|
|
2656
|
+
REGEX_OK_AFTER_WORD = new Set([
|
|
2657
|
+
"return",
|
|
2658
|
+
"typeof",
|
|
2659
|
+
"instanceof",
|
|
2660
|
+
"in",
|
|
2661
|
+
"of",
|
|
2662
|
+
"new",
|
|
2663
|
+
"delete",
|
|
2664
|
+
"void",
|
|
2665
|
+
"do",
|
|
2666
|
+
"else",
|
|
2667
|
+
"yield",
|
|
2668
|
+
"await",
|
|
2669
|
+
"case"
|
|
2670
|
+
]);
|
|
2671
|
+
});
|
|
2672
|
+
|
|
2439
2673
|
// src/build/nativeRewrite.ts
|
|
2440
2674
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
2441
2675
|
import { platform, arch } from "os";
|
|
@@ -2526,8 +2760,9 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrite
|
|
|
2526
2760
|
if (Object.keys(vendorPaths).length === 0)
|
|
2527
2761
|
return content;
|
|
2528
2762
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
2529
|
-
const
|
|
2530
|
-
|
|
2763
|
+
const { masked, restore } = maskLiterals(content);
|
|
2764
|
+
const native = nativeRewriteImports(masked, replacements);
|
|
2765
|
+
return restore(native ?? jsRewriteImports(masked, replacements));
|
|
2531
2766
|
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
2532
2767
|
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
2533
2768
|
REEXPORT_PATTERN.lastIndex = 0;
|
|
@@ -2673,6 +2908,7 @@ ${content}`;
|
|
|
2673
2908
|
return result;
|
|
2674
2909
|
};
|
|
2675
2910
|
var init_rewriteImportsPlugin = __esm(() => {
|
|
2911
|
+
init_maskLiterals();
|
|
2676
2912
|
init_nativeRewrite();
|
|
2677
2913
|
});
|
|
2678
2914
|
|
|
@@ -11198,14 +11434,16 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), rewriter
|
|
|
11198
11434
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
11199
11435
|
await Promise.all(jsFiles.map(async (filePath) => {
|
|
11200
11436
|
const original = await Bun.file(filePath).text();
|
|
11201
|
-
const
|
|
11202
|
-
const
|
|
11437
|
+
const { masked, restore } = maskLiterals(original);
|
|
11438
|
+
const native = nativeRewriteImports(masked, replacements);
|
|
11439
|
+
const content = restore(native ?? applyAllReplacements(masked, rewriter));
|
|
11203
11440
|
if (content !== original) {
|
|
11204
11441
|
await Bun.write(filePath, content);
|
|
11205
11442
|
}
|
|
11206
11443
|
}));
|
|
11207
11444
|
};
|
|
11208
11445
|
var init_rewriteReactImports = __esm(() => {
|
|
11446
|
+
init_maskLiterals();
|
|
11209
11447
|
init_nativeRewrite();
|
|
11210
11448
|
rewriterCache = new Map;
|
|
11211
11449
|
REFRESH_STUBS = "window.$RefreshReg$||(window.$RefreshReg$=function(){});" + `window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});
|
|
@@ -13403,7 +13641,7 @@ var init_chainInlineSourcemaps = __esm(() => {
|
|
|
13403
13641
|
});
|
|
13404
13642
|
|
|
13405
13643
|
// src/build/vueAutoRouterTransform.ts
|
|
13406
|
-
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX,
|
|
13644
|
+
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL2 = "__ABSOLUTE_AUTO_ROUTER__", SETUP_APP_DECLARATION_REGEX, SETUP_APP_FUNCTION_REGEX, addAutoRouterSetupApp = (sourceContent) => {
|
|
13407
13645
|
if (!ROUTES_EXPORT_REGEX.test(sourceContent))
|
|
13408
13646
|
return sourceContent;
|
|
13409
13647
|
const match = SCRIPT_REGEX.exec(sourceContent);
|
|
@@ -13412,13 +13650,13 @@ var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL = "__ABSOLUTE_AUTO_ROUTER__", SE
|
|
|
13412
13650
|
const [, openTag, scriptBody, closeTag] = match;
|
|
13413
13651
|
if (!openTag || scriptBody === undefined || !closeTag)
|
|
13414
13652
|
return sourceContent;
|
|
13415
|
-
if (scriptBody.includes(
|
|
13653
|
+
if (scriptBody.includes(SENTINEL2))
|
|
13416
13654
|
return sourceContent;
|
|
13417
13655
|
let rewrittenScript = scriptBody.replace(SETUP_APP_DECLARATION_REGEX, "const __absoluteUserSetupApp__");
|
|
13418
13656
|
rewrittenScript = rewrittenScript.replace(SETUP_APP_FUNCTION_REGEX, "$1 __absoluteUserSetupApp__");
|
|
13419
13657
|
const userHadSetupApp = rewrittenScript !== scriptBody;
|
|
13420
13658
|
const autoWrapper = `
|
|
13421
|
-
// ${
|
|
13659
|
+
// ${SENTINEL2} \u2014 generated by AbsoluteJS because this page exports
|
|
13422
13660
|
// \`routes\`. Owns the vue-router lifecycle (history pick, app.use,
|
|
13423
13661
|
// push, isReady) so user code stays declarative.
|
|
13424
13662
|
import {
|
|
@@ -27722,5 +27960,5 @@ export {
|
|
|
27722
27960
|
build
|
|
27723
27961
|
};
|
|
27724
27962
|
|
|
27725
|
-
//# debugId=
|
|
27963
|
+
//# debugId=36C247738D172D4464756E2164756E21
|
|
27726
27964
|
//# sourceMappingURL=build.js.map
|