@absolutejs/absolute 0.19.0-beta.767 → 0.19.0-beta.768
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/cli/index.js +102 -80
- package/package.json +7 -7
package/dist/cli/index.js
CHANGED
|
@@ -1222,7 +1222,100 @@ console.log(\`
|
|
|
1222
1222
|
\\x1b[2m\${pageCount} pre-rendered pages, \${assetCount} embedded assets, runtime fallback\\x1b[0m
|
|
1223
1223
|
\`);
|
|
1224
1224
|
`;
|
|
1225
|
-
},
|
|
1225
|
+
}, createStubPlugin = (options = {}) => ({
|
|
1226
|
+
name: "stub-framework-sources",
|
|
1227
|
+
setup(bld) {
|
|
1228
|
+
const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1229
|
+
const runtimeStubs = new Map;
|
|
1230
|
+
if (options.stubReact) {
|
|
1231
|
+
runtimeStubs.set("react", "export const createElement = () => null; export default { createElement };");
|
|
1232
|
+
runtimeStubs.set("react-dom/server", 'const unavailable = async () => { throw new Error("React runtime is unavailable in this compiled app."); }; export const renderToReadableStream = unavailable; export const renderToString = unavailable; export const renderToStaticMarkup = unavailable;');
|
|
1233
|
+
runtimeStubs.set("react-dom", "export const createPortal = () => null; export default { createPortal };");
|
|
1234
|
+
runtimeStubs.set("react/jsx-runtime", 'export const jsx = () => null; export const jsxs = () => null; export const Fragment = Symbol.for("react.fragment");');
|
|
1235
|
+
runtimeStubs.set("react/jsx-dev-runtime", 'export const jsxDEV = () => null; export const Fragment = Symbol.for("react.fragment");');
|
|
1236
|
+
}
|
|
1237
|
+
if (options.stubSvelte) {
|
|
1238
|
+
runtimeStubs.set("svelte/server", 'const unavailable = () => { throw new Error("Svelte runtime is unavailable in this compiled app."); }; export const render = unavailable;');
|
|
1239
|
+
runtimeStubs.set("svelte", "export default {};");
|
|
1240
|
+
}
|
|
1241
|
+
runtimeStubs.set("svelte/compiler", 'const unavailable = () => { throw new Error("Svelte source compiler is unavailable in compiled production runtime. Use built manifest page paths."); }; export const compile = unavailable; export const compileModule = unavailable; export const preprocess = unavailable;');
|
|
1242
|
+
if (options.stubVue) {
|
|
1243
|
+
runtimeStubs.set("vue", 'const unavailable = () => { throw new Error("Vue runtime is unavailable in this compiled app."); }; export const createSSRApp = unavailable; export const h = unavailable; export default {};');
|
|
1244
|
+
runtimeStubs.set("vue/server-renderer", 'const unavailable = async () => { throw new Error("Vue runtime is unavailable in this compiled app."); }; export const renderToString = unavailable;');
|
|
1245
|
+
}
|
|
1246
|
+
runtimeStubs.set("@vue/compiler-sfc", 'const unavailable = () => { throw new Error("Vue source compiler is unavailable in compiled production runtime. Use built manifest page paths."); }; export const compileScript = unavailable; export const compileStyle = unavailable; export const compileTemplate = unavailable; export const parse = unavailable;');
|
|
1247
|
+
const runtimeStubFilter = new RegExp(`^(${Array.from(runtimeStubs.keys()).map(escapeRegex).join("|")})$`);
|
|
1248
|
+
bld.onResolve({ filter: runtimeStubFilter }, (args) => ({
|
|
1249
|
+
namespace: "absolute-compile-stub",
|
|
1250
|
+
path: args.path
|
|
1251
|
+
}));
|
|
1252
|
+
bld.onLoad({ filter: runtimeStubFilter, namespace: "absolute-compile-stub" }, (args) => ({
|
|
1253
|
+
contents: runtimeStubs.get(args.path) ?? "export {};",
|
|
1254
|
+
loader: "js"
|
|
1255
|
+
}));
|
|
1256
|
+
bld.onLoad({ filter: /\.(svelte|vue)$/ }, () => ({
|
|
1257
|
+
contents: "export default {}",
|
|
1258
|
+
loader: "js"
|
|
1259
|
+
}));
|
|
1260
|
+
bld.onLoad({ filter: /devBuild\.(ts|js)$/ }, () => ({
|
|
1261
|
+
contents: "export const devBuild = () => {}",
|
|
1262
|
+
loader: "js"
|
|
1263
|
+
}));
|
|
1264
|
+
bld.onLoad({ filter: /core\/build\.(ts|js)$/ }, () => ({
|
|
1265
|
+
contents: "export const build = () => ({})",
|
|
1266
|
+
loader: "js"
|
|
1267
|
+
}));
|
|
1268
|
+
bld.onLoad({ filter: /src\/build\.(ts|js)$/ }, () => ({
|
|
1269
|
+
contents: "export const build = () => ({}); export const devBuild = () => {};",
|
|
1270
|
+
loader: "js"
|
|
1271
|
+
}));
|
|
1272
|
+
bld.onLoad({ filter: /plugins\/hmr\.(ts|js)$/ }, () => ({
|
|
1273
|
+
contents: "export const hmr = () => (app) => app;",
|
|
1274
|
+
loader: "js"
|
|
1275
|
+
}));
|
|
1276
|
+
bld.onLoad({
|
|
1277
|
+
filter: /dev\/(assetStore|clientManager|webSocket|moduleVersionTracker|buildHMRClient)\.ts$/
|
|
1278
|
+
}, () => ({ contents: "export {};", loader: "js" }));
|
|
1279
|
+
bld.onLoad({ filter: /dev\/moduleServer\.(ts|js)$/ }, () => ({
|
|
1280
|
+
contents: "export {};",
|
|
1281
|
+
loader: "js"
|
|
1282
|
+
}));
|
|
1283
|
+
bld.onLoad({ filter: /build\/compile(Svelte|Vue|Angular)\.(ts|js)$/ }, () => ({
|
|
1284
|
+
contents: 'const unavailable = async () => { throw new Error("Framework source compiler fallback is unavailable in compiled production runtime. Use built manifest page paths."); }; export const compileSvelte = unavailable; export const compileVue = unavailable; export const compileAngularFileJIT = unavailable; export const compileAngularFile = unavailable; export const compileAngularFiles = unavailable; export const compileAngular = unavailable;',
|
|
1285
|
+
loader: "js"
|
|
1286
|
+
}));
|
|
1287
|
+
bld.onLoad({ filter: /cli\/(telemetryEvent|scripts\/telemetry)\.ts$/ }, () => ({
|
|
1288
|
+
contents: "export const sendTelemetryEvent = () => {}; export const getTelemetryConfig = () => null; export const telemetry = () => {};",
|
|
1289
|
+
loader: "js"
|
|
1290
|
+
}));
|
|
1291
|
+
bld.onLoad({
|
|
1292
|
+
filter: /react-dom-server-legacy\.browser\.(production|development)\.js$/
|
|
1293
|
+
}, () => ({
|
|
1294
|
+
contents: "exports.renderToString = undefined; exports.renderToStaticMarkup = undefined;",
|
|
1295
|
+
loader: "js"
|
|
1296
|
+
}));
|
|
1297
|
+
bld.onResolve({ filter: /^react\/jsx-dev-runtime$/ }, () => ({
|
|
1298
|
+
path: jsxDevRuntimeCompatPath2
|
|
1299
|
+
}));
|
|
1300
|
+
bld.onLoad({ filter: /node_modules\/debug/ }, () => ({
|
|
1301
|
+
contents: "module.exports = () => { const noop = () => {}; noop.enabled = false; return noop; }; module.exports.enable = () => {}; module.exports.disable = () => {}; module.exports.enabled = () => false;",
|
|
1302
|
+
loader: "js"
|
|
1303
|
+
}));
|
|
1304
|
+
bld.onLoad({ filter: /\.ts$/ }, async (args) => {
|
|
1305
|
+
if (args.path.includes("node_modules"))
|
|
1306
|
+
return;
|
|
1307
|
+
const normalizedPath = args.path.replace(/\\/g, "/");
|
|
1308
|
+
if (normalizedPath.includes("/src/angular/"))
|
|
1309
|
+
return;
|
|
1310
|
+
const text = await Bun.file(args.path).text();
|
|
1311
|
+
const stripped = text.replace(/`(?:[^`\\]|\\.)*`/gs, "").replace(/'(?:[^'\\]|\\.)*'/g, "").replace(/"(?:[^"\\]|\\.)*"/g, "");
|
|
1312
|
+
if (stripped.includes("@Component")) {
|
|
1313
|
+
return { contents: "export default {}", loader: "js" };
|
|
1314
|
+
}
|
|
1315
|
+
return;
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}), FRAMEWORK_EXTERNALS, compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
1226
1319
|
const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
|
|
1227
1320
|
killStaleProcesses(prerenderPort);
|
|
1228
1321
|
const entryName = basename2(serverEntry).replace(/\.[^.]+$/, "");
|
|
@@ -1260,7 +1353,7 @@ console.log(\`
|
|
|
1260
1353
|
entrypoints: [resolve8(serverEntry)],
|
|
1261
1354
|
external: FRAMEWORK_EXTERNALS,
|
|
1262
1355
|
outdir: resolvedOutdir,
|
|
1263
|
-
plugins: [
|
|
1356
|
+
plugins: [createStubPlugin()],
|
|
1264
1357
|
target: "bun"
|
|
1265
1358
|
});
|
|
1266
1359
|
if (!serverBundle.success) {
|
|
@@ -1299,7 +1392,13 @@ console.log(\`
|
|
|
1299
1392
|
compile: { outfile: resolvedOutfile },
|
|
1300
1393
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
1301
1394
|
entrypoints: [entrypointPath],
|
|
1302
|
-
plugins: [
|
|
1395
|
+
plugins: [
|
|
1396
|
+
createStubPlugin({
|
|
1397
|
+
stubReact: !buildConfig.reactDirectory,
|
|
1398
|
+
stubSvelte: !buildConfig.svelteDirectory,
|
|
1399
|
+
stubVue: !buildConfig.vueDirectory
|
|
1400
|
+
})
|
|
1401
|
+
],
|
|
1303
1402
|
target: "bun"
|
|
1304
1403
|
});
|
|
1305
1404
|
if (!result.success) {
|
|
@@ -1331,83 +1430,6 @@ var init_compile = __esm(() => {
|
|
|
1331
1430
|
init_telemetryEvent();
|
|
1332
1431
|
init_utils();
|
|
1333
1432
|
jsxDevRuntimeCompatPath2 = resolveJsxDevRuntimeCompatPath2();
|
|
1334
|
-
stubPlugin = {
|
|
1335
|
-
name: "stub-framework-sources",
|
|
1336
|
-
setup(bld) {
|
|
1337
|
-
bld.onResolve({ filter: /^@vue\/compiler-sfc$/ }, () => ({
|
|
1338
|
-
namespace: "absolute-compile-stub",
|
|
1339
|
-
path: "@vue/compiler-sfc"
|
|
1340
|
-
}));
|
|
1341
|
-
bld.onLoad({
|
|
1342
|
-
filter: /^@vue\/compiler-sfc$/,
|
|
1343
|
-
namespace: "absolute-compile-stub"
|
|
1344
|
-
}, () => ({
|
|
1345
|
-
contents: 'const unavailable = () => { throw new Error("Vue source compiler is unavailable in compiled production runtime. Use built manifest page paths."); }; export const compileScript = unavailable; export const compileStyle = unavailable; export const compileTemplate = unavailable; export const parse = unavailable;',
|
|
1346
|
-
loader: "js"
|
|
1347
|
-
}));
|
|
1348
|
-
bld.onLoad({ filter: /\.(svelte|vue)$/ }, () => ({
|
|
1349
|
-
contents: "export default {}",
|
|
1350
|
-
loader: "js"
|
|
1351
|
-
}));
|
|
1352
|
-
bld.onLoad({ filter: /devBuild\.(ts|js)$/ }, () => ({
|
|
1353
|
-
contents: "export const devBuild = () => {}",
|
|
1354
|
-
loader: "js"
|
|
1355
|
-
}));
|
|
1356
|
-
bld.onLoad({ filter: /core\/build\.(ts|js)$/ }, () => ({
|
|
1357
|
-
contents: "export const build = () => ({})",
|
|
1358
|
-
loader: "js"
|
|
1359
|
-
}));
|
|
1360
|
-
bld.onLoad({ filter: /src\/build\.(ts|js)$/ }, () => ({
|
|
1361
|
-
contents: "export const build = () => ({}); export const devBuild = () => {};",
|
|
1362
|
-
loader: "js"
|
|
1363
|
-
}));
|
|
1364
|
-
bld.onLoad({ filter: /plugins\/hmr\.(ts|js)$/ }, () => ({
|
|
1365
|
-
contents: "export const hmr = () => (app) => app;",
|
|
1366
|
-
loader: "js"
|
|
1367
|
-
}));
|
|
1368
|
-
bld.onLoad({
|
|
1369
|
-
filter: /dev\/(assetStore|clientManager|webSocket|moduleVersionTracker|buildHMRClient)\.ts$/
|
|
1370
|
-
}, () => ({ contents: "export {};", loader: "js" }));
|
|
1371
|
-
bld.onLoad({ filter: /dev\/moduleServer\.(ts|js)$/ }, () => ({
|
|
1372
|
-
contents: "export {};",
|
|
1373
|
-
loader: "js"
|
|
1374
|
-
}));
|
|
1375
|
-
bld.onLoad({ filter: /build\/compile(Svelte|Vue|Angular)\.(ts|js)$/ }, () => ({
|
|
1376
|
-
contents: 'const unavailable = async () => { throw new Error("Framework source compiler fallback is unavailable in compiled production runtime. Use built manifest page paths."); }; export const compileSvelte = unavailable; export const compileVue = unavailable; export const compileAngularFileJIT = unavailable; export const compileAngularFile = unavailable; export const compileAngularFiles = unavailable; export const compileAngular = unavailable;',
|
|
1377
|
-
loader: "js"
|
|
1378
|
-
}));
|
|
1379
|
-
bld.onLoad({ filter: /cli\/(telemetryEvent|scripts\/telemetry)\.ts$/ }, () => ({
|
|
1380
|
-
contents: "export const sendTelemetryEvent = () => {}; export const getTelemetryConfig = () => null; export const telemetry = () => {};",
|
|
1381
|
-
loader: "js"
|
|
1382
|
-
}));
|
|
1383
|
-
bld.onLoad({
|
|
1384
|
-
filter: /react-dom-server-legacy\.browser\.(production|development)\.js$/
|
|
1385
|
-
}, () => ({
|
|
1386
|
-
contents: "exports.renderToString = undefined; exports.renderToStaticMarkup = undefined;",
|
|
1387
|
-
loader: "js"
|
|
1388
|
-
}));
|
|
1389
|
-
bld.onResolve({ filter: /^react\/jsx-dev-runtime$/ }, () => ({
|
|
1390
|
-
path: jsxDevRuntimeCompatPath2
|
|
1391
|
-
}));
|
|
1392
|
-
bld.onLoad({ filter: /node_modules\/debug/ }, () => ({
|
|
1393
|
-
contents: "module.exports = () => { const noop = () => {}; noop.enabled = false; return noop; }; module.exports.enable = () => {}; module.exports.disable = () => {}; module.exports.enabled = () => false;",
|
|
1394
|
-
loader: "js"
|
|
1395
|
-
}));
|
|
1396
|
-
bld.onLoad({ filter: /\.ts$/ }, async (args) => {
|
|
1397
|
-
if (args.path.includes("node_modules"))
|
|
1398
|
-
return;
|
|
1399
|
-
const normalizedPath = args.path.replace(/\\/g, "/");
|
|
1400
|
-
if (normalizedPath.includes("/src/angular/"))
|
|
1401
|
-
return;
|
|
1402
|
-
const text = await Bun.file(args.path).text();
|
|
1403
|
-
const stripped = text.replace(/`(?:[^`\\]|\\.)*`/gs, "").replace(/'(?:[^'\\]|\\.)*'/g, "").replace(/"(?:[^"\\]|\\.)*"/g, "");
|
|
1404
|
-
if (stripped.includes("@Component")) {
|
|
1405
|
-
return { contents: "export default {}", loader: "js" };
|
|
1406
|
-
}
|
|
1407
|
-
return;
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
1433
|
FRAMEWORK_EXTERNALS = [
|
|
1412
1434
|
"react",
|
|
1413
1435
|
"react/jsx-runtime",
|
package/package.json
CHANGED
|
@@ -187,12 +187,12 @@
|
|
|
187
187
|
"main": "./dist/index.js",
|
|
188
188
|
"name": "@absolutejs/absolute",
|
|
189
189
|
"optionalDependencies": {
|
|
190
|
-
"@absolutejs/native-darwin-arm64": "0.19.0-beta.
|
|
191
|
-
"@absolutejs/native-darwin-x64": "0.19.0-beta.
|
|
192
|
-
"@absolutejs/native-linux-arm64": "0.19.0-beta.
|
|
193
|
-
"@absolutejs/native-linux-x64": "0.19.0-beta.
|
|
194
|
-
"@absolutejs/native-windows-arm64": "0.19.0-beta.
|
|
195
|
-
"@absolutejs/native-windows-x64": "0.19.0-beta.
|
|
190
|
+
"@absolutejs/native-darwin-arm64": "0.19.0-beta.768",
|
|
191
|
+
"@absolutejs/native-darwin-x64": "0.19.0-beta.768",
|
|
192
|
+
"@absolutejs/native-linux-arm64": "0.19.0-beta.768",
|
|
193
|
+
"@absolutejs/native-linux-x64": "0.19.0-beta.768",
|
|
194
|
+
"@absolutejs/native-windows-arm64": "0.19.0-beta.768",
|
|
195
|
+
"@absolutejs/native-windows-x64": "0.19.0-beta.768"
|
|
196
196
|
},
|
|
197
197
|
"overrides": {
|
|
198
198
|
"@typescript-eslint/utils": "8.56.1"
|
|
@@ -349,5 +349,5 @@
|
|
|
349
349
|
]
|
|
350
350
|
}
|
|
351
351
|
},
|
|
352
|
-
"version": "0.19.0-beta.
|
|
352
|
+
"version": "0.19.0-beta.768"
|
|
353
353
|
}
|