@absolutejs/absolute 0.19.0-beta.767 → 0.19.0-beta.769
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/build.js +34 -11
- package/dist/build.js.map +5 -5
- package/dist/cli/index.js +102 -80
- package/dist/index.js +34 -11
- package/dist/index.js.map +5 -5
- package/dist/src/build/compileTailwind.d.ts +1 -0
- 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/dist/index.js
CHANGED
|
@@ -41648,7 +41648,7 @@ ${t.join(`
|
|
|
41648
41648
|
import { mkdir as mkdir2, rm as rm2 } from "fs/promises";
|
|
41649
41649
|
import { dirname as dirname6, join as join7 } from "path";
|
|
41650
41650
|
var {build: bunBuild } = globalThis.Bun;
|
|
41651
|
-
var TAILWIND_NATIVE_TEMP_DIR = ".absolute-tailwind-native", postprocessTailwindCss = async (css, outputPath, styleTransformConfig) => compileStyleSource(outputPath, css, "css", styleTransformConfig), compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
|
|
41651
|
+
var TAILWIND_NATIVE_TEMP_DIR = ".absolute-tailwind-native", TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), postprocessTailwindCss = async (css, outputPath, styleTransformConfig) => compileStyleSource(outputPath, css, "css", styleTransformConfig), compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
|
|
41652
41652
|
const outputPath = join7(buildPath, output);
|
|
41653
41653
|
const tempDir = join7(buildPath, TAILWIND_NATIVE_TEMP_DIR);
|
|
41654
41654
|
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
@@ -41682,6 +41682,7 @@ ${details}` : ""}`);
|
|
|
41682
41682
|
}, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig);
|
|
41683
41683
|
var init_compileTailwind = __esm(() => {
|
|
41684
41684
|
init_stylePreprocessor();
|
|
41685
|
+
TAILWIND_CANDIDATE_EXTENSION_PATTERN = /\.(html?|m?[jt]sx?|cjs|vue|svelte|astro|mdx?|css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
41685
41686
|
});
|
|
41686
41687
|
|
|
41687
41688
|
// src/utils/imageProcessing.ts
|
|
@@ -45949,7 +45950,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
45949
45950
|
recursive: true
|
|
45950
45951
|
}));
|
|
45951
45952
|
}
|
|
45952
|
-
const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(
|
|
45953
|
+
const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isTailwindCandidate)) ? tracePhase("tailwind/build", () => compileTailwindConfig(tailwind, buildPath, styleTransformConfig)) : undefined;
|
|
45953
45954
|
const emptyConventionResult = {
|
|
45954
45955
|
conventions: undefined,
|
|
45955
45956
|
pageFiles: []
|
|
@@ -46133,20 +46134,42 @@ ${content.slice(firstUseIdx)}`;
|
|
|
46133
46134
|
vueConventionSources.length > 0 && vueDir ? tracePhase("compile/convention-vue", () => Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, styleTransformConfig))) : { vueServerPaths: emptyStringArray },
|
|
46134
46135
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
46135
46136
|
]);
|
|
46136
|
-
const
|
|
46137
|
+
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
46137
46138
|
const destDir = join20(buildPath, "conventions", framework);
|
|
46139
|
+
rmSync2(destDir, { force: true, recursive: true });
|
|
46138
46140
|
mkdirSync10(destDir, { recursive: true });
|
|
46139
46141
|
const destPaths = [];
|
|
46140
|
-
for (
|
|
46141
|
-
const
|
|
46142
|
-
|
|
46143
|
-
|
|
46142
|
+
for (let idx = 0;idx < compiledPaths.length; idx++) {
|
|
46143
|
+
const compiledPath = compiledPaths[idx];
|
|
46144
|
+
if (!compiledPath)
|
|
46145
|
+
continue;
|
|
46146
|
+
const name = basename8(compiledPath).replace(/\.[^.]+$/, "");
|
|
46147
|
+
const result = await bunBuild7({
|
|
46148
|
+
entrypoints: [compiledPath],
|
|
46149
|
+
format: "esm",
|
|
46150
|
+
minify: !isDev2,
|
|
46151
|
+
naming: `${idx}-${name}.[ext]`,
|
|
46152
|
+
outdir: destDir,
|
|
46153
|
+
splitting: false,
|
|
46154
|
+
target: "bun",
|
|
46155
|
+
throw: false
|
|
46156
|
+
});
|
|
46157
|
+
if (!result.success) {
|
|
46158
|
+
outputLogs(result.logs);
|
|
46159
|
+
throw new Error(`Failed to bundle ${framework} convention: ${compiledPath}`);
|
|
46160
|
+
}
|
|
46161
|
+
const output = result.outputs.find((artifact) => artifact.path.endsWith(".js"));
|
|
46162
|
+
if (!output)
|
|
46163
|
+
throw new Error(`${framework} convention did not emit JavaScript: ${compiledPath}`);
|
|
46164
|
+
destPaths.push(output.path);
|
|
46144
46165
|
}
|
|
46145
46166
|
return destPaths;
|
|
46146
46167
|
};
|
|
46147
|
-
const svelteDests =
|
|
46148
|
-
|
|
46149
|
-
|
|
46168
|
+
const [svelteDests, vueDests, angularDests] = await Promise.all([
|
|
46169
|
+
tracePhase("bundle/convention-svelte", () => bundleConventionFiles("svelte", svelteConvResult.svelteServerPaths)),
|
|
46170
|
+
tracePhase("bundle/convention-vue", () => bundleConventionFiles("vue", vueConvResult.vueServerPaths)),
|
|
46171
|
+
tracePhase("bundle/convention-angular", () => bundleConventionFiles("angular", angularConvResult.serverPaths))
|
|
46172
|
+
]);
|
|
46150
46173
|
conventionOutputPaths = [
|
|
46151
46174
|
...reactConvPaths,
|
|
46152
46175
|
...svelteDests,
|
|
@@ -58920,5 +58943,5 @@ export {
|
|
|
58920
58943
|
ANGULAR_INIT_TIMEOUT_MS
|
|
58921
58944
|
};
|
|
58922
58945
|
|
|
58923
|
-
//# debugId=
|
|
58946
|
+
//# debugId=458E7AFD69A7A1FD64756E2164756E21
|
|
58924
58947
|
//# sourceMappingURL=index.js.map
|