@absolutejs/absolute 0.19.0-beta.17 → 0.19.0-beta.19
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/build.js +128 -36
- package/dist/build.js.map +3 -3
- package/dist/index.js +128 -36
- package/dist/index.js.map +3 -3
- package/dist/src/dev/moduleServer.d.ts +1 -1
- package/native/packages/darwin-arm64/fast_ops.dylib +0 -0
- package/native/packages/darwin-arm64/package.json +1 -1
- package/native/packages/darwin-x64/fast_ops.dylib +0 -0
- package/native/packages/darwin-x64/package.json +1 -1
- package/native/packages/linux-arm64/package.json +1 -1
- package/native/packages/linux-x64/fast_ops.so +0 -0
- package/native/packages/linux-x64/package.json +1 -1
- package/package.json +5 -5
package/dist/build.js
CHANGED
|
@@ -202149,7 +202149,6 @@ __export(exports_moduleServer, {
|
|
|
202149
202149
|
});
|
|
202150
202150
|
import { readFileSync as readFileSync9, statSync as statSync2 } from "fs";
|
|
202151
202151
|
import { dirname as dirname7, extname as extname3, resolve as resolve16, relative as relative6 } from "path";
|
|
202152
|
-
var {build: bunBuild5 } = globalThis.Bun;
|
|
202153
202152
|
var SRC_PREFIX = "/@src/", jsTranspiler2, TRANSPILABLE, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
202154
202153
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
202155
202154
|
if (entries.length === 0)
|
|
@@ -202215,26 +202214,91 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, TRANSPILABLE, REACT_EXTENSIONS, escape
|
|
|
202215
202214
|
return `${prefix}${SRC_PREFIX}${srcPath.replace(/\\/g, "/")}${suffix}`;
|
|
202216
202215
|
});
|
|
202217
202216
|
return result;
|
|
202218
|
-
},
|
|
202219
|
-
const
|
|
202220
|
-
|
|
202221
|
-
|
|
202222
|
-
|
|
202223
|
-
|
|
202224
|
-
|
|
202225
|
-
|
|
202226
|
-
|
|
202227
|
-
|
|
202228
|
-
|
|
202229
|
-
|
|
202230
|
-
|
|
202231
|
-
|
|
202232
|
-
|
|
202233
|
-
const
|
|
202234
|
-
if (
|
|
202235
|
-
return;
|
|
202236
|
-
const
|
|
202237
|
-
|
|
202217
|
+
}, HOOK_NAMES, findComponents = (code) => {
|
|
202218
|
+
const components = [];
|
|
202219
|
+
const exportRe = /(?:export\s+(?:default\s+)?(?:function\s+|(?:const|let|var)\s+))([A-Z][a-zA-Z0-9]*)/g;
|
|
202220
|
+
let match;
|
|
202221
|
+
while ((match = exportRe.exec(code)) !== null) {
|
|
202222
|
+
const name = match[1];
|
|
202223
|
+
if (!name)
|
|
202224
|
+
continue;
|
|
202225
|
+
const startIdx = match.index;
|
|
202226
|
+
const bodySlice = code.slice(startIdx, startIdx + 2000);
|
|
202227
|
+
const hasHooks = Array.from(HOOK_NAMES).some((hook) => bodySlice.includes(hook + "("));
|
|
202228
|
+
components.push({ hasHooks, name });
|
|
202229
|
+
}
|
|
202230
|
+
return components;
|
|
202231
|
+
}, computeHookSignature = (code, componentName) => {
|
|
202232
|
+
const startIdx = code.indexOf(componentName);
|
|
202233
|
+
if (startIdx === -1)
|
|
202234
|
+
return "";
|
|
202235
|
+
const bodySlice = code.slice(startIdx, startIdx + 2000);
|
|
202236
|
+
const hooks = [];
|
|
202237
|
+
for (const hook of HOOK_NAMES) {
|
|
202238
|
+
if (bodySlice.includes(hook + "("))
|
|
202239
|
+
hooks.push(hook);
|
|
202240
|
+
}
|
|
202241
|
+
return Buffer.from(hooks.join(",")).toString("base64").slice(0, 12);
|
|
202242
|
+
}, REFRESH_PREAMBLE, injectRefreshRegistration = (code, filePath, projectRoot) => {
|
|
202243
|
+
const components = findComponents(code);
|
|
202244
|
+
if (components.length === 0)
|
|
202245
|
+
return code;
|
|
202246
|
+
const hasAnyHooks = components.some((c) => c.hasHooks);
|
|
202247
|
+
const sigSetup = hasAnyHooks ? `
|
|
202248
|
+
var _s = $RefreshSig$();` : "";
|
|
202249
|
+
let result = `${REFRESH_PREAMBLE}${sigSetup}
|
|
202250
|
+
${code}`;
|
|
202251
|
+
const exportedNames = [];
|
|
202252
|
+
for (const comp of components) {
|
|
202253
|
+
if (!comp.hasHooks)
|
|
202254
|
+
continue;
|
|
202255
|
+
const sig = computeHookSignature(result, comp.name);
|
|
202256
|
+
result = result.replace(new RegExp(`export\\s+(?:const|let)\\s+(${comp.name}\\s*=)`), `var $1`);
|
|
202257
|
+
exportedNames.push(comp.name);
|
|
202258
|
+
result += `
|
|
202259
|
+
${comp.name} = _s(${comp.name}, ${JSON.stringify(sig)});`;
|
|
202260
|
+
}
|
|
202261
|
+
if (exportedNames.length > 0) {
|
|
202262
|
+
result += `
|
|
202263
|
+
export { ${exportedNames.join(", ")} };`;
|
|
202264
|
+
}
|
|
202265
|
+
const relPath = relative6(projectRoot, filePath).replace(/\\/g, "/");
|
|
202266
|
+
const registrations = components.map((c) => `$RefreshReg$(${c.name}, ${JSON.stringify(`${relPath}:${c.name}`)});`).join(`
|
|
202267
|
+
`);
|
|
202268
|
+
return `${result}
|
|
202269
|
+
${registrations}
|
|
202270
|
+
`;
|
|
202271
|
+
}, JSX_AUTO_RE, JSXS_AUTO_RE, JSX_PROD_RE, FRAGMENT_RE, addJsxImport = (code) => {
|
|
202272
|
+
const imports = [];
|
|
202273
|
+
const jsxDevMatch = JSX_AUTO_RE.exec(code);
|
|
202274
|
+
if (jsxDevMatch) {
|
|
202275
|
+
imports.push(`import { jsxDEV as ${jsxDevMatch[1]} } from "react/jsx-dev-runtime";`);
|
|
202276
|
+
}
|
|
202277
|
+
const jsxsMatch = JSXS_AUTO_RE.exec(code);
|
|
202278
|
+
if (jsxsMatch && (!jsxDevMatch || jsxsMatch[1] !== jsxDevMatch[1])) {
|
|
202279
|
+
imports.push(`import { jsxs as ${jsxsMatch[1]} } from "react/jsx-runtime";`);
|
|
202280
|
+
}
|
|
202281
|
+
const jsxProdMatch = JSX_PROD_RE.exec(code);
|
|
202282
|
+
if (jsxProdMatch) {
|
|
202283
|
+
imports.push(`import { jsx as ${jsxProdMatch[1]} } from "react/jsx-runtime";`);
|
|
202284
|
+
}
|
|
202285
|
+
const fragmentMatch = FRAGMENT_RE.exec(code);
|
|
202286
|
+
if (fragmentMatch) {
|
|
202287
|
+
imports.push(`import { Fragment as ${fragmentMatch[1]} } from "react";`);
|
|
202288
|
+
}
|
|
202289
|
+
if (imports.length === 0)
|
|
202290
|
+
return code;
|
|
202291
|
+
return imports.join(`
|
|
202292
|
+
`) + `
|
|
202293
|
+
` + code;
|
|
202294
|
+
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
202295
|
+
const raw = readFileSync9(filePath, "utf-8");
|
|
202296
|
+
const transpiled = new Bun.Transpiler({
|
|
202297
|
+
loader: extname3(filePath) === ".jsx" ? "jsx" : "tsx"
|
|
202298
|
+
}).transformSync(raw);
|
|
202299
|
+
const withJsx = addJsxImport(transpiled);
|
|
202300
|
+
const withRefresh = injectRefreshRegistration(withJsx, filePath, projectRoot);
|
|
202301
|
+
return rewriteImports2(withRefresh, filePath, projectRoot, rewriter);
|
|
202238
202302
|
}, transformPlainFile = (filePath, projectRoot, rewriter) => {
|
|
202239
202303
|
const raw = readFileSync9(filePath, "utf-8");
|
|
202240
202304
|
const ext = extname3(filePath);
|
|
@@ -202255,7 +202319,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, TRANSPILABLE, REACT_EXTENSIONS, escape
|
|
|
202255
202319
|
}, createModuleServer = (config) => {
|
|
202256
202320
|
const { projectRoot, vendorPaths } = config;
|
|
202257
202321
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
202258
|
-
return
|
|
202322
|
+
return (pathname) => {
|
|
202259
202323
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
202260
202324
|
return;
|
|
202261
202325
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
@@ -202284,9 +202348,8 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, TRANSPILABLE, REACT_EXTENSIONS, escape
|
|
|
202284
202348
|
const stat2 = statSync2(filePath);
|
|
202285
202349
|
let content;
|
|
202286
202350
|
if (REACT_EXTENSIONS.has(ext)) {
|
|
202287
|
-
content =
|
|
202288
|
-
}
|
|
202289
|
-
if (!content) {
|
|
202351
|
+
content = transformReactFile(filePath, projectRoot, rewriter);
|
|
202352
|
+
} else {
|
|
202290
202353
|
content = transformPlainFile(filePath, projectRoot, rewriter);
|
|
202291
202354
|
}
|
|
202292
202355
|
setTransformed(filePath, content, stat2.mtimeMs);
|
|
@@ -202310,6 +202373,35 @@ var init_moduleServer = __esm(() => {
|
|
|
202310
202373
|
jsTranspiler2 = new Bun.Transpiler({ loader: "js" });
|
|
202311
202374
|
TRANSPILABLE = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs"]);
|
|
202312
202375
|
REACT_EXTENSIONS = new Set([".tsx", ".jsx"]);
|
|
202376
|
+
HOOK_NAMES = new Set([
|
|
202377
|
+
"useState",
|
|
202378
|
+
"useReducer",
|
|
202379
|
+
"useEffect",
|
|
202380
|
+
"useLayoutEffect",
|
|
202381
|
+
"useMemo",
|
|
202382
|
+
"useCallback",
|
|
202383
|
+
"useRef",
|
|
202384
|
+
"useContext",
|
|
202385
|
+
"useImperativeHandle",
|
|
202386
|
+
"useDebugValue",
|
|
202387
|
+
"useDeferredValue",
|
|
202388
|
+
"useTransition",
|
|
202389
|
+
"useId",
|
|
202390
|
+
"useSyncExternalStore",
|
|
202391
|
+
"useInsertionEffect",
|
|
202392
|
+
"useOptimistic",
|
|
202393
|
+
"useFormStatus",
|
|
202394
|
+
"useActionState"
|
|
202395
|
+
]);
|
|
202396
|
+
REFRESH_PREAMBLE = [
|
|
202397
|
+
"var $RefreshReg$ = window.$RefreshReg$ || function(){};",
|
|
202398
|
+
"var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };"
|
|
202399
|
+
].join(`
|
|
202400
|
+
`);
|
|
202401
|
+
JSX_AUTO_RE = /\b(jsxDEV_[a-z0-9]+)\b/;
|
|
202402
|
+
JSXS_AUTO_RE = /\b(jsxs_[a-z0-9]+)\b/;
|
|
202403
|
+
JSX_PROD_RE = /\b(jsx_[a-z0-9]+)\b/;
|
|
202404
|
+
FRAGMENT_RE = /\b(Fragment_[a-z0-9]+)\b/;
|
|
202313
202405
|
invalidateModule = invalidate;
|
|
202314
202406
|
SRC_URL_PREFIX = SRC_PREFIX;
|
|
202315
202407
|
});
|
|
@@ -202626,7 +202718,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202626
202718
|
}
|
|
202627
202719
|
state.manifest[toPascal(baseName)] = artifact.path;
|
|
202628
202720
|
}, bundleAngularClient = async (state, clientPaths, buildDir) => {
|
|
202629
|
-
const { build:
|
|
202721
|
+
const { build: bunBuild5 } = await Promise.resolve(globalThis.Bun);
|
|
202630
202722
|
const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
|
|
202631
202723
|
const { getAngularVendorPaths: getAngularVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
202632
202724
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
@@ -202637,7 +202729,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202637
202729
|
angVendorPaths = computeAngularVendorPaths2();
|
|
202638
202730
|
setAngularVendorPaths2(angVendorPaths);
|
|
202639
202731
|
}
|
|
202640
|
-
const clientResult = await
|
|
202732
|
+
const clientResult = await bunBuild5({
|
|
202641
202733
|
entrypoints: clientPaths,
|
|
202642
202734
|
...angVendorPaths ? { external: Object.keys(angVendorPaths) } : {},
|
|
202643
202735
|
format: "esm",
|
|
@@ -202747,7 +202839,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202747
202839
|
});
|
|
202748
202840
|
return reactEntries;
|
|
202749
202841
|
}, bundleReactClient = async (state, reactEntries, reactIndexesPath, buildDir) => {
|
|
202750
|
-
const { build:
|
|
202842
|
+
const { build: bunBuild5 } = await Promise.resolve(globalThis.Bun);
|
|
202751
202843
|
const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
|
|
202752
202844
|
const { getDevVendorPaths: getDevVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
202753
202845
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
@@ -202768,7 +202860,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202768
202860
|
force: true,
|
|
202769
202861
|
recursive: true
|
|
202770
202862
|
});
|
|
202771
|
-
const clientResult = await
|
|
202863
|
+
const clientResult = await bunBuild5({
|
|
202772
202864
|
entrypoints: reactEntries,
|
|
202773
202865
|
format: "esm",
|
|
202774
202866
|
jsx: { development: true },
|
|
@@ -202876,7 +202968,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202876
202968
|
const svelteFiles = filesToRebuild.filter((file3) => file3.endsWith(".svelte") && resolve19(file3).startsWith(resolve19(svelteDir, "pages")));
|
|
202877
202969
|
if (svelteFiles.length > 0) {
|
|
202878
202970
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
202879
|
-
const { build:
|
|
202971
|
+
const { build: bunBuild5 } = await Promise.resolve(globalThis.Bun);
|
|
202880
202972
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
202881
202973
|
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
202882
202974
|
const serverEntries = [...svelteServerPaths];
|
|
@@ -202884,7 +202976,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202884
202976
|
const serverRoot = resolve19(svelteDir, "server");
|
|
202885
202977
|
const serverOutDir = resolve19(buildDir, basename7(svelteDir));
|
|
202886
202978
|
const [serverResult, clientResult] = await Promise.all([
|
|
202887
|
-
serverEntries.length > 0 ?
|
|
202979
|
+
serverEntries.length > 0 ? bunBuild5({
|
|
202888
202980
|
entrypoints: serverEntries,
|
|
202889
202981
|
external: ["svelte", "svelte/*"],
|
|
202890
202982
|
format: "esm",
|
|
@@ -202894,7 +202986,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202894
202986
|
target: "bun",
|
|
202895
202987
|
throw: false
|
|
202896
202988
|
}) : undefined,
|
|
202897
|
-
clientEntries.length > 0 ?
|
|
202989
|
+
clientEntries.length > 0 ? bunBuild5({
|
|
202898
202990
|
entrypoints: clientEntries,
|
|
202899
202991
|
format: "esm",
|
|
202900
202992
|
naming: "[dir]/[name].[hash].[ext]",
|
|
@@ -202952,7 +203044,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202952
203044
|
const vueFiles = filesToRebuild.filter((file3) => file3.endsWith(".vue") && resolve19(file3).startsWith(resolve19(vueDir, "pages")));
|
|
202953
203045
|
if (vueFiles.length > 0) {
|
|
202954
203046
|
const { compileVue: compileVue2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
202955
|
-
const { build:
|
|
203047
|
+
const { build: bunBuild5 } = await Promise.resolve(globalThis.Bun);
|
|
202956
203048
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
202957
203049
|
const { vueServerPaths, vueIndexPaths, vueClientPaths } = await compileVue2(vueFiles, vueDir, true);
|
|
202958
203050
|
const serverEntries = [...vueServerPaths];
|
|
@@ -202965,7 +203057,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202965
203057
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true"
|
|
202966
203058
|
};
|
|
202967
203059
|
const [serverResult, clientResult] = await Promise.all([
|
|
202968
|
-
serverEntries.length > 0 ?
|
|
203060
|
+
serverEntries.length > 0 ? bunBuild5({
|
|
202969
203061
|
entrypoints: serverEntries,
|
|
202970
203062
|
external: ["vue", "vue/*"],
|
|
202971
203063
|
format: "esm",
|
|
@@ -202975,7 +203067,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202975
203067
|
target: "bun",
|
|
202976
203068
|
throw: false
|
|
202977
203069
|
}) : undefined,
|
|
202978
|
-
clientEntries.length > 0 ?
|
|
203070
|
+
clientEntries.length > 0 ? bunBuild5({
|
|
202979
203071
|
define: vueFeatureFlags2,
|
|
202980
203072
|
entrypoints: clientEntries,
|
|
202981
203073
|
format: "esm",
|
|
@@ -203900,5 +203992,5 @@ export {
|
|
|
203900
203992
|
build
|
|
203901
203993
|
};
|
|
203902
203994
|
|
|
203903
|
-
//# debugId=
|
|
203995
|
+
//# debugId=33AC0B71663B0C6B64756E2164756E21
|
|
203904
203996
|
//# sourceMappingURL=build.js.map
|