@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
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { BunPlugin } from 'bun';
|
|
2
|
+
import type { StylePreprocessorConfig } from '../../types/build';
|
|
2
3
|
export declare const isPreprocessableStylePath: (filePath: string) => boolean;
|
|
3
4
|
export declare const isStyleModulePath: (filePath: string) => boolean;
|
|
4
5
|
export declare const isStylePath: (filePath: string) => boolean;
|
|
5
6
|
export declare const getStyleBaseName: (filePath: string) => string;
|
|
6
|
-
export declare const compileStyleSource: (filePath: string, source?: string, languageHint?: string) => Promise<string>;
|
|
7
|
+
export declare const compileStyleSource: (filePath: string, source?: string, languageHint?: string, config?: StylePreprocessorConfig) => Promise<string>;
|
|
8
|
+
export declare const createStylePreprocessorPlugin: (config?: StylePreprocessorConfig) => BunPlugin;
|
|
7
9
|
export declare const stylePreprocessorPlugin: BunPlugin;
|
|
8
|
-
export declare const createSvelteStylePreprocessor: () => {
|
|
10
|
+
export declare const createSvelteStylePreprocessor: (config?: StylePreprocessorConfig) => {
|
|
9
11
|
style: ({ attributes, content, filename }: {
|
|
10
12
|
attributes: Record<string, string | boolean>;
|
|
11
13
|
content: string;
|
|
@@ -14,6 +16,6 @@ export declare const createSvelteStylePreprocessor: () => {
|
|
|
14
16
|
code: string;
|
|
15
17
|
} | undefined>;
|
|
16
18
|
};
|
|
17
|
-
export declare const compileStyleFileIfNeeded: (filePath: string) => Promise<string>;
|
|
18
|
-
export declare const compileStyleFileIfNeededSync: (filePath: string) => string;
|
|
19
|
+
export declare const compileStyleFileIfNeeded: (filePath: string, config?: StylePreprocessorConfig) => Promise<string>;
|
|
20
|
+
export declare const compileStyleFileIfNeededSync: (filePath: string, config?: StylePreprocessorConfig) => string;
|
|
19
21
|
export declare const getCssOutputExtension: (filePath: string) => string;
|
package/dist/src/core/build.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConventionsMap } from '../../types/conventions';
|
|
2
2
|
import type { BuildConfig } from '../../types/build';
|
|
3
|
-
export declare const build: ({ buildDirectory, assetsDirectory, publicDirectory, islands, reactDirectory, htmlDirectory, htmxDirectory, angularDirectory, svelteDirectory, vueDirectory, stylesConfig, tailwind, options, incrementalFiles, mode }: BuildConfig) => Promise<{
|
|
3
|
+
export declare const build: ({ buildDirectory, assetsDirectory, publicDirectory, islands, reactDirectory, htmlDirectory, htmxDirectory, angularDirectory, svelteDirectory, vueDirectory, stylesConfig, stylePreprocessors, tailwind, options, incrementalFiles, mode }: BuildConfig) => Promise<{
|
|
4
4
|
conventions?: undefined;
|
|
5
5
|
manifest?: undefined;
|
|
6
6
|
} | {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StylePreprocessorConfig } from '../../types/build';
|
|
1
2
|
type ModuleServerConfig = {
|
|
2
3
|
projectRoot: string;
|
|
3
4
|
vendorPaths: Record<string, string>;
|
|
@@ -7,6 +8,7 @@ type ModuleServerConfig = {
|
|
|
7
8
|
svelte?: string;
|
|
8
9
|
vue?: string;
|
|
9
10
|
};
|
|
11
|
+
stylePreprocessors?: StylePreprocessorConfig;
|
|
10
12
|
};
|
|
11
13
|
export declare const warmCompilers: (frameworks: {
|
|
12
14
|
svelte?: boolean;
|
package/dist/svelte/index.js
CHANGED
|
@@ -359,10 +359,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
359
359
|
});
|
|
360
360
|
|
|
361
361
|
// src/build/stylePreprocessor.ts
|
|
362
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
363
362
|
import { readFile } from "fs/promises";
|
|
364
363
|
import { createRequire } from "module";
|
|
365
|
-
import { dirname, extname, join as join2 } from "path";
|
|
364
|
+
import { dirname, extname, join as join2, resolve as resolve2 } from "path";
|
|
366
365
|
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) => {
|
|
367
366
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
368
367
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -372,24 +371,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
372
371
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
373
372
|
return "less";
|
|
374
373
|
return null;
|
|
375
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
374
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
375
|
+
dirname(filePath),
|
|
376
|
+
process.cwd(),
|
|
377
|
+
...paths.map((path) => resolve2(process.cwd(), path))
|
|
378
|
+
], getSassOptions = (config, language) => ({
|
|
379
|
+
...config?.sass ?? {},
|
|
380
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
381
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
382
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
382
383
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
383
|
-
const
|
|
384
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
384
385
|
if (language === "scss" || language === "sass") {
|
|
386
|
+
const options = getSassOptions(config, language);
|
|
387
|
+
const packageName = options.implementation ?? "sass";
|
|
385
388
|
let sass;
|
|
386
389
|
try {
|
|
387
|
-
sass = await importOptionalPeer(
|
|
390
|
+
sass = await importOptionalPeer(packageName);
|
|
388
391
|
} catch {
|
|
389
|
-
throw missingDependencyError(
|
|
392
|
+
throw missingDependencyError(packageName, filePath);
|
|
390
393
|
}
|
|
394
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
391
395
|
const result = sass.compileString(contents, {
|
|
392
|
-
loadPaths:
|
|
396
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
393
397
|
style: "expanded",
|
|
394
398
|
syntax: language === "sass" ? "indented" : "scss",
|
|
395
399
|
url: new URL(`file://${filePath}`)
|
|
@@ -397,6 +401,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
397
401
|
return result.css;
|
|
398
402
|
}
|
|
399
403
|
if (language === "less") {
|
|
404
|
+
const options = getLessOptions(config);
|
|
400
405
|
let lessModule;
|
|
401
406
|
try {
|
|
402
407
|
lessModule = await importOptionalPeer("less");
|
|
@@ -407,14 +412,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
407
412
|
const render = less?.render;
|
|
408
413
|
if (!render)
|
|
409
414
|
throw missingDependencyError("less", filePath);
|
|
415
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
410
416
|
const result = await render(contents, {
|
|
417
|
+
...options.options ?? {},
|
|
411
418
|
filename: filePath,
|
|
412
|
-
paths:
|
|
419
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
413
420
|
});
|
|
414
421
|
return result.css;
|
|
415
422
|
}
|
|
416
|
-
return
|
|
417
|
-
},
|
|
423
|
+
return rawContents;
|
|
424
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
425
|
+
name: "absolute-style-preprocessor",
|
|
426
|
+
setup(build) {
|
|
427
|
+
const cssModuleSources = new Map;
|
|
428
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
429
|
+
namespace: "absolute-style-module",
|
|
430
|
+
path: path.slice("absolute-style-module:".length)
|
|
431
|
+
}));
|
|
432
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
433
|
+
const sourcePath = cssModuleSources.get(path);
|
|
434
|
+
if (!sourcePath) {
|
|
435
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
436
|
+
}
|
|
437
|
+
return {
|
|
438
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
439
|
+
loader: "css"
|
|
440
|
+
};
|
|
441
|
+
});
|
|
442
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
443
|
+
if (isStyleModulePath(path)) {
|
|
444
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
445
|
+
cssModuleSources.set(cssModulePath, path);
|
|
446
|
+
return {
|
|
447
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
448
|
+
loader: "js"
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
453
|
+
loader: "css"
|
|
454
|
+
};
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
418
458
|
style: async ({
|
|
419
459
|
attributes,
|
|
420
460
|
content,
|
|
@@ -425,35 +465,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
425
465
|
return;
|
|
426
466
|
const path = filename ?? `style.${language}`;
|
|
427
467
|
return {
|
|
428
|
-
code: await compileStyleSource(path, content, language)
|
|
468
|
+
code: await compileStyleSource(path, content, language, config)
|
|
429
469
|
};
|
|
430
470
|
}
|
|
431
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
471
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
432
472
|
if (!isPreprocessableStylePath(filePath)) {
|
|
433
473
|
return readFile(filePath, "utf-8");
|
|
434
474
|
}
|
|
435
|
-
return compileStyleSource(filePath);
|
|
436
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
437
|
-
const contents = readFileSync2(filePath, "utf-8");
|
|
438
|
-
const language = getStyleLanguage(filePath);
|
|
439
|
-
if (language === "scss" || language === "sass") {
|
|
440
|
-
let sass;
|
|
441
|
-
try {
|
|
442
|
-
sass = requireOptionalPeerSync("sass");
|
|
443
|
-
} catch {
|
|
444
|
-
throw missingDependencyError("sass", filePath);
|
|
445
|
-
}
|
|
446
|
-
return sass.compileString(contents, {
|
|
447
|
-
loadPaths: [dirname(filePath), process.cwd()],
|
|
448
|
-
style: "expanded",
|
|
449
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
450
|
-
url: new URL(`file://${filePath}`)
|
|
451
|
-
}).css;
|
|
452
|
-
}
|
|
453
|
-
if (language === "less") {
|
|
454
|
-
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.`);
|
|
455
|
-
}
|
|
456
|
-
return contents;
|
|
475
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
457
476
|
};
|
|
458
477
|
var init_stylePreprocessor = __esm(() => {
|
|
459
478
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -462,45 +481,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
462
481
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
463
482
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
464
483
|
requireFromCwd = createRequire(join2(process.cwd(), "package.json"));
|
|
465
|
-
stylePreprocessorPlugin =
|
|
466
|
-
name: "absolute-style-preprocessor",
|
|
467
|
-
setup(build) {
|
|
468
|
-
const cssModuleSources = new Map;
|
|
469
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
470
|
-
namespace: "absolute-style-module",
|
|
471
|
-
path: path.slice("absolute-style-module:".length)
|
|
472
|
-
}));
|
|
473
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
474
|
-
const sourcePath = cssModuleSources.get(path);
|
|
475
|
-
if (!sourcePath) {
|
|
476
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
477
|
-
}
|
|
478
|
-
return {
|
|
479
|
-
contents: await compileStyleSource(sourcePath),
|
|
480
|
-
loader: "css"
|
|
481
|
-
};
|
|
482
|
-
});
|
|
483
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
484
|
-
if (isStyleModulePath(path)) {
|
|
485
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
486
|
-
cssModuleSources.set(cssModulePath, path);
|
|
487
|
-
return {
|
|
488
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
489
|
-
loader: "js"
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
return {
|
|
493
|
-
contents: await compileStyleSource(path),
|
|
494
|
-
loader: "css"
|
|
495
|
-
};
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
};
|
|
484
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
499
485
|
});
|
|
500
486
|
|
|
501
487
|
// src/core/svelteServerModule.ts
|
|
502
488
|
import { mkdir, readdir } from "fs/promises";
|
|
503
|
-
import { basename, dirname as dirname2, extname as extname2, join as join3, relative, resolve as
|
|
489
|
+
import { basename, dirname as dirname2, extname as extname2, join as join3, relative, resolve as resolve3 } from "path";
|
|
504
490
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
505
491
|
const importPath = relative(dirname2(from), target).replace(/\\/g, "/");
|
|
506
492
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -548,7 +534,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
548
534
|
if (!spec.startsWith(".")) {
|
|
549
535
|
return null;
|
|
550
536
|
}
|
|
551
|
-
const basePath =
|
|
537
|
+
const basePath = resolve3(dirname2(from), spec);
|
|
552
538
|
const candidates = [
|
|
553
539
|
basePath,
|
|
554
540
|
`${basePath}.ts`,
|
|
@@ -580,7 +566,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
580
566
|
if (!spec.startsWith(".")) {
|
|
581
567
|
return null;
|
|
582
568
|
}
|
|
583
|
-
const explicitPath =
|
|
569
|
+
const explicitPath = resolve3(dirname2(from), spec);
|
|
584
570
|
if (extname2(explicitPath) === ".svelte") {
|
|
585
571
|
return explicitPath;
|
|
586
572
|
}
|
|
@@ -2310,8 +2296,8 @@ var init_pageHandler = __esm(() => {
|
|
|
2310
2296
|
});
|
|
2311
2297
|
|
|
2312
2298
|
// src/angular/injectorPatch.ts
|
|
2313
|
-
import { existsSync as existsSync2, readFileSync as
|
|
2314
|
-
import { dirname as dirname3, join as join4, resolve as
|
|
2299
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
2300
|
+
import { dirname as dirname3, join as join4, resolve as resolve4 } from "path";
|
|
2315
2301
|
var applyInjectorPatch = (chunkPath, content) => {
|
|
2316
2302
|
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
2317
2303
|
return;
|
|
@@ -2347,7 +2333,7 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
2347
2333
|
}
|
|
2348
2334
|
writeFileSync(chunkPath, patched, "utf-8");
|
|
2349
2335
|
}, resolveAngularCoreDir = () => {
|
|
2350
|
-
const fromProject =
|
|
2336
|
+
const fromProject = resolve4(process.cwd(), "node_modules/@angular/core");
|
|
2351
2337
|
if (existsSync2(join4(fromProject, "package.json"))) {
|
|
2352
2338
|
return fromProject;
|
|
2353
2339
|
}
|
|
@@ -2356,7 +2342,7 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
2356
2342
|
try {
|
|
2357
2343
|
const coreDir = resolveAngularCoreDir();
|
|
2358
2344
|
const chunkPath = join4(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
2359
|
-
const content =
|
|
2345
|
+
const content = readFileSync2(chunkPath, "utf-8");
|
|
2360
2346
|
applyInjectorPatch(chunkPath, content);
|
|
2361
2347
|
} catch {}
|
|
2362
2348
|
};
|
|
@@ -2366,9 +2352,9 @@ var init_injectorPatch = __esm(() => {
|
|
|
2366
2352
|
|
|
2367
2353
|
// src/angular/resolveAngularPackage.ts
|
|
2368
2354
|
import { existsSync as existsSync3 } from "fs";
|
|
2369
|
-
import { resolve as
|
|
2355
|
+
import { resolve as resolve5 } from "path";
|
|
2370
2356
|
var resolveAngularPackage = (specifier) => {
|
|
2371
|
-
const fromProject =
|
|
2357
|
+
const fromProject = resolve5(process.cwd(), "node_modules", specifier);
|
|
2372
2358
|
if (existsSync3(fromProject)) {
|
|
2373
2359
|
return fromProject;
|
|
2374
2360
|
}
|
|
@@ -3188,5 +3174,5 @@ export {
|
|
|
3188
3174
|
createTypedIsland
|
|
3189
3175
|
};
|
|
3190
3176
|
|
|
3191
|
-
//# debugId=
|
|
3177
|
+
//# debugId=D77E1858501D2AE764756E2164756E21
|
|
3192
3178
|
//# sourceMappingURL=index.js.map
|