@absolutejs/absolute 0.19.0-beta.691 → 0.19.0-beta.693
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/index.js +184 -177
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +166 -159
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +409 -391
- package/dist/build.js.map +9 -9
- package/dist/index.js +450 -431
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -78
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -78
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +4 -3
- package/dist/src/build/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +2 -1
- package/dist/src/build/stylePreprocessor.d.ts +6 -4
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -0
- package/dist/svelte/index.js +70 -84
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -78
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -78
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/react/index.js
CHANGED
|
@@ -2502,10 +2502,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2502
2502
|
});
|
|
2503
2503
|
|
|
2504
2504
|
// src/build/stylePreprocessor.ts
|
|
2505
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
2506
2505
|
import { readFile } from "fs/promises";
|
|
2507
2506
|
import { createRequire } from "module";
|
|
2508
|
-
import { dirname as dirname2, extname, join as join3 } from "path";
|
|
2507
|
+
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
2509
2508
|
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2510
2509
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2511
2510
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2515,24 +2514,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2515
2514
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2516
2515
|
return "less";
|
|
2517
2516
|
return null;
|
|
2518
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2517
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2518
|
+
dirname2(filePath),
|
|
2519
|
+
process.cwd(),
|
|
2520
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
2521
|
+
], getSassOptions = (config, language) => ({
|
|
2522
|
+
...config?.sass ?? {},
|
|
2523
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
2524
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2525
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2525
2526
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2526
|
-
const
|
|
2527
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2527
2528
|
if (language === "scss" || language === "sass") {
|
|
2529
|
+
const options = getSassOptions(config, language);
|
|
2530
|
+
const packageName = options.implementation ?? "sass";
|
|
2528
2531
|
let sass;
|
|
2529
2532
|
try {
|
|
2530
|
-
sass = await importOptionalPeer(
|
|
2533
|
+
sass = await importOptionalPeer(packageName);
|
|
2531
2534
|
} catch {
|
|
2532
|
-
throw missingDependencyError(
|
|
2535
|
+
throw missingDependencyError(packageName, filePath);
|
|
2533
2536
|
}
|
|
2537
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2534
2538
|
const result = sass.compileString(contents, {
|
|
2535
|
-
loadPaths:
|
|
2539
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
2536
2540
|
style: "expanded",
|
|
2537
2541
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2538
2542
|
url: new URL(`file://${filePath}`)
|
|
@@ -2540,6 +2544,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2540
2544
|
return result.css;
|
|
2541
2545
|
}
|
|
2542
2546
|
if (language === "less") {
|
|
2547
|
+
const options = getLessOptions(config);
|
|
2543
2548
|
let lessModule;
|
|
2544
2549
|
try {
|
|
2545
2550
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2550,14 +2555,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2550
2555
|
const render = less?.render;
|
|
2551
2556
|
if (!render)
|
|
2552
2557
|
throw missingDependencyError("less", filePath);
|
|
2558
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2553
2559
|
const result = await render(contents, {
|
|
2560
|
+
...options.options ?? {},
|
|
2554
2561
|
filename: filePath,
|
|
2555
|
-
paths:
|
|
2562
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
2556
2563
|
});
|
|
2557
2564
|
return result.css;
|
|
2558
2565
|
}
|
|
2559
|
-
return
|
|
2560
|
-
},
|
|
2566
|
+
return rawContents;
|
|
2567
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2568
|
+
name: "absolute-style-preprocessor",
|
|
2569
|
+
setup(build) {
|
|
2570
|
+
const cssModuleSources = new Map;
|
|
2571
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2572
|
+
namespace: "absolute-style-module",
|
|
2573
|
+
path: path.slice("absolute-style-module:".length)
|
|
2574
|
+
}));
|
|
2575
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2576
|
+
const sourcePath = cssModuleSources.get(path);
|
|
2577
|
+
if (!sourcePath) {
|
|
2578
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2579
|
+
}
|
|
2580
|
+
return {
|
|
2581
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
2582
|
+
loader: "css"
|
|
2583
|
+
};
|
|
2584
|
+
});
|
|
2585
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2586
|
+
if (isStyleModulePath(path)) {
|
|
2587
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2588
|
+
cssModuleSources.set(cssModulePath, path);
|
|
2589
|
+
return {
|
|
2590
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2591
|
+
loader: "js"
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
return {
|
|
2595
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2596
|
+
loader: "css"
|
|
2597
|
+
};
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2561
2601
|
style: async ({
|
|
2562
2602
|
attributes,
|
|
2563
2603
|
content,
|
|
@@ -2568,35 +2608,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2568
2608
|
return;
|
|
2569
2609
|
const path = filename ?? `style.${language}`;
|
|
2570
2610
|
return {
|
|
2571
|
-
code: await compileStyleSource(path, content, language)
|
|
2611
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2572
2612
|
};
|
|
2573
2613
|
}
|
|
2574
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2614
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2575
2615
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2576
2616
|
return readFile(filePath, "utf-8");
|
|
2577
2617
|
}
|
|
2578
|
-
return compileStyleSource(filePath);
|
|
2579
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
2580
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
2581
|
-
const language = getStyleLanguage(filePath);
|
|
2582
|
-
if (language === "scss" || language === "sass") {
|
|
2583
|
-
let sass;
|
|
2584
|
-
try {
|
|
2585
|
-
sass = requireOptionalPeerSync("sass");
|
|
2586
|
-
} catch {
|
|
2587
|
-
throw missingDependencyError("sass", filePath);
|
|
2588
|
-
}
|
|
2589
|
-
return sass.compileString(contents, {
|
|
2590
|
-
loadPaths: [dirname2(filePath), process.cwd()],
|
|
2591
|
-
style: "expanded",
|
|
2592
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
2593
|
-
url: new URL(`file://${filePath}`)
|
|
2594
|
-
}).css;
|
|
2595
|
-
}
|
|
2596
|
-
if (language === "less") {
|
|
2597
|
-
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
2598
|
-
}
|
|
2599
|
-
return contents;
|
|
2618
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2600
2619
|
};
|
|
2601
2620
|
var init_stylePreprocessor = __esm(() => {
|
|
2602
2621
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2605,45 +2624,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2605
2624
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2606
2625
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2607
2626
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
2608
|
-
stylePreprocessorPlugin =
|
|
2609
|
-
name: "absolute-style-preprocessor",
|
|
2610
|
-
setup(build) {
|
|
2611
|
-
const cssModuleSources = new Map;
|
|
2612
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2613
|
-
namespace: "absolute-style-module",
|
|
2614
|
-
path: path.slice("absolute-style-module:".length)
|
|
2615
|
-
}));
|
|
2616
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2617
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2618
|
-
if (!sourcePath) {
|
|
2619
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2620
|
-
}
|
|
2621
|
-
return {
|
|
2622
|
-
contents: await compileStyleSource(sourcePath),
|
|
2623
|
-
loader: "css"
|
|
2624
|
-
};
|
|
2625
|
-
});
|
|
2626
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2627
|
-
if (isStyleModulePath(path)) {
|
|
2628
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2629
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2630
|
-
return {
|
|
2631
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2632
|
-
loader: "js"
|
|
2633
|
-
};
|
|
2634
|
-
}
|
|
2635
|
-
return {
|
|
2636
|
-
contents: await compileStyleSource(path),
|
|
2637
|
-
loader: "css"
|
|
2638
|
-
};
|
|
2639
|
-
});
|
|
2640
|
-
}
|
|
2641
|
-
};
|
|
2627
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2642
2628
|
});
|
|
2643
2629
|
|
|
2644
2630
|
// src/core/svelteServerModule.ts
|
|
2645
2631
|
import { mkdir, readdir } from "fs/promises";
|
|
2646
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as
|
|
2632
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
2647
2633
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2648
2634
|
const importPath = relative(dirname3(from), target).replace(/\\/g, "/");
|
|
2649
2635
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -2691,7 +2677,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2691
2677
|
if (!spec.startsWith(".")) {
|
|
2692
2678
|
return null;
|
|
2693
2679
|
}
|
|
2694
|
-
const basePath =
|
|
2680
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
2695
2681
|
const candidates = [
|
|
2696
2682
|
basePath,
|
|
2697
2683
|
`${basePath}.ts`,
|
|
@@ -2723,7 +2709,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2723
2709
|
if (!spec.startsWith(".")) {
|
|
2724
2710
|
return null;
|
|
2725
2711
|
}
|
|
2726
|
-
const explicitPath =
|
|
2712
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
2727
2713
|
if (extname2(explicitPath) === ".svelte") {
|
|
2728
2714
|
return explicitPath;
|
|
2729
2715
|
}
|
|
@@ -3116,5 +3102,5 @@ export {
|
|
|
3116
3102
|
Island
|
|
3117
3103
|
};
|
|
3118
3104
|
|
|
3119
|
-
//# debugId=
|
|
3105
|
+
//# debugId=03F71698475F88C764756E2164756E21
|
|
3120
3106
|
//# sourceMappingURL=index.js.map
|