@nifrajs/web 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +18 -0
- package/css-modules.d.ts +34 -0
- package/dist/build.d.ts +110 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +238 -0
- package/dist/build.js.map +1 -0
- package/dist/client.d.ts +32 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +204 -0
- package/dist/client.js.map +1 -0
- package/dist/deferred.d.ts +90 -0
- package/dist/deferred.d.ts.map +1 -0
- package/dist/deferred.js +310 -0
- package/dist/deferred.js.map +1 -0
- package/dist/dev-error.d.ts +17 -0
- package/dist/dev-error.d.ts.map +1 -0
- package/dist/dev-error.js +59 -0
- package/dist/dev-error.js.map +1 -0
- package/dist/dev.d.ts +25 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +83 -0
- package/dist/dev.js.map +1 -0
- package/dist/draft.d.ts +58 -0
- package/dist/draft.d.ts.map +1 -0
- package/dist/draft.js +55 -0
- package/dist/draft.js.map +1 -0
- package/dist/fonts-google.d.ts +109 -0
- package/dist/fonts-google.d.ts.map +1 -0
- package/dist/fonts-google.js +291 -0
- package/dist/fonts-google.js.map +1 -0
- package/dist/fonts.d.ts +67 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +103 -0
- package/dist/fonts.js.map +1 -0
- package/dist/fs.d.ts +10 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +24 -0
- package/dist/fs.js.map +1 -0
- package/dist/index.d.ts +280 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +784 -0
- package/dist/index.js.map +1 -0
- package/dist/islands.d.ts +37 -0
- package/dist/islands.d.ts.map +1 -0
- package/dist/islands.js +107 -0
- package/dist/islands.js.map +1 -0
- package/dist/isr.d.ts +154 -0
- package/dist/isr.d.ts.map +1 -0
- package/dist/isr.js +331 -0
- package/dist/isr.js.map +1 -0
- package/dist/manifest.d.ts +178 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +213 -0
- package/dist/manifest.js.map +1 -0
- package/dist/plugins/css-modules.d.ts +40 -0
- package/dist/plugins/css-modules.d.ts.map +1 -0
- package/dist/plugins/css-modules.js +0 -0
- package/dist/plugins/css-modules.js.map +1 -0
- package/dist/plugins/kit.d.ts +44 -0
- package/dist/plugins/kit.d.ts.map +1 -0
- package/dist/plugins/kit.js +105 -0
- package/dist/plugins/kit.js.map +1 -0
- package/dist/plugins/scss.d.ts +27 -0
- package/dist/plugins/scss.d.ts.map +1 -0
- package/dist/plugins/scss.js +78 -0
- package/dist/plugins/scss.js.map +1 -0
- package/dist/prerender.d.ts +77 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +139 -0
- package/dist/prerender.js.map +1 -0
- package/dist/query.d.ts +62 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +184 -0
- package/dist/query.js.map +1 -0
- package/dist/router.d.ts +169 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +531 -0
- package/dist/router.js.map +1 -0
- package/dist/vite.d.ts +49 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +144 -0
- package/dist/vite.js.map +1 -0
- package/package.json +127 -0
- package/src/build.ts +375 -0
- package/src/client.ts +218 -0
- package/src/deferred.ts +339 -0
- package/src/dev-error.ts +62 -0
- package/src/dev.ts +108 -0
- package/src/draft.ts +82 -0
- package/src/fonts-google.ts +397 -0
- package/src/fonts.ts +147 -0
- package/src/fs.ts +26 -0
- package/src/index.ts +1202 -0
- package/src/islands.ts +121 -0
- package/src/isr.ts +461 -0
- package/src/manifest.ts +366 -0
- package/src/plugins/css-modules.ts +0 -0
- package/src/plugins/kit.ts +123 -0
- package/src/plugins/scss.ts +108 -0
- package/src/prerender.ts +209 -0
- package/src/query.ts +250 -0
- package/src/router.ts +676 -0
- package/src/vite.ts +212 -0
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route manifest — the fs-free heart of file-based routing. Maps route file paths to nifra
|
|
3
|
+
* router patterns + their nested layout chain. `discoverRoutes` (in `@nifrajs/web/fs`) scans
|
|
4
|
+
* the filesystem and feeds `buildManifest`; everything here is pure logic, so it stays
|
|
5
|
+
* portable (no fs, no DOM) and fully unit-testable. Edge deploys pre-build the manifest.
|
|
6
|
+
*/
|
|
7
|
+
// `.svelte` and `.vue` routes are supported too: their `default` export is the component and
|
|
8
|
+
// `loader`/`action`/`meta` come from a module-level script block (Svelte `<script module>`, Vue's plain
|
|
9
|
+
// `<script>`) as named ESM exports — the same RouteModule shape as `.tsx`. Both compile via their
|
|
10
|
+
// package's Bun plugin (`@nifrajs/web-svelte/plugin`, `@nifrajs/web-vue/plugin`).
|
|
11
|
+
const ROUTE_EXT = /\.(tsx|jsx|svelte|vue|mdx)$/;
|
|
12
|
+
const PARAM = /^\[([A-Za-z_][A-Za-z0-9_]*)\]$/;
|
|
13
|
+
const CATCH_ALL = /^\[\.\.\.([A-Za-z_][A-Za-z0-9_]*)\]$/;
|
|
14
|
+
// An optional dynamic segment: `[[lang]]` matches with OR without the segment. It expands a file into
|
|
15
|
+
// two patterns (`:lang` present / absent), so `[[lang]]/about` serves both `/about` and `/en/about`.
|
|
16
|
+
const OPTIONAL = /^\[\[([A-Za-z_][A-Za-z0-9_]*)\]\]$/;
|
|
17
|
+
// A route group: a `(name)` folder organizes routes (and can hold its own `_layout`) without
|
|
18
|
+
// contributing a URL segment — mirrors Next/Remix. Requires content between the parens.
|
|
19
|
+
const GROUP = /^\(.+\)$/;
|
|
20
|
+
const stripExt = (file) => file.replace(ROUTE_EXT, "");
|
|
21
|
+
const baseName = (file) => file.slice(file.lastIndexOf("/") + 1);
|
|
22
|
+
const dirOf = (file) => file.includes("/") ? file.slice(0, file.lastIndexOf("/")) : "";
|
|
23
|
+
const layoutIdFor = (dir) => (dir === "" ? "_layout" : `${dir}/_layout`);
|
|
24
|
+
const errorIdFor = (dir) => (dir === "" ? "_error" : `${dir}/_error`);
|
|
25
|
+
/**
|
|
26
|
+
* Derive **every** nifra router pattern a route file maps to (relative to the routes dir):
|
|
27
|
+
* `index` → the parent path, `[id]` → `:id`, `[...slug]` → `*slug` (catch-all, captures the rest of
|
|
28
|
+
* the path into one param), `(group)` folders are dropped from the URL (organization only), and an
|
|
29
|
+
* optional `[[lang]]` expands the set — once with the segment present (`:lang`) and once absent. A file
|
|
30
|
+
* with no optionals yields exactly one pattern. Throws on an invalid param or a catch-all that isn't
|
|
31
|
+
* the last segment.
|
|
32
|
+
*/
|
|
33
|
+
export function filePathToPatterns(file) {
|
|
34
|
+
// Each combo is a list of URL segments built so far; an optional segment doubles the set.
|
|
35
|
+
let combos = [[]];
|
|
36
|
+
const segments = stripExt(file).split("/");
|
|
37
|
+
for (let i = 0; i < segments.length; i++) {
|
|
38
|
+
const seg = segments[i];
|
|
39
|
+
if (seg === "index")
|
|
40
|
+
continue;
|
|
41
|
+
if (GROUP.test(seg))
|
|
42
|
+
continue; // route group — no URL segment (its `_layout` still applies, keyed by dir)
|
|
43
|
+
if (seg.startsWith("[")) {
|
|
44
|
+
const catchAll = CATCH_ALL.exec(seg);
|
|
45
|
+
if (catchAll !== null) {
|
|
46
|
+
// The core router requires the wildcard to be the final segment. Enforce it at the file level
|
|
47
|
+
// (ignoring trailing `index`/`(group)`) so the error names the file, not a generated pattern.
|
|
48
|
+
const after = segments.slice(i + 1).filter((s) => s !== "index" && !GROUP.test(s));
|
|
49
|
+
if (after.length > 0) {
|
|
50
|
+
throw new Error(`[nifra/web] catch-all "${seg}" must be the last segment in "${file}" (found "${after.join("/")}" after it)`);
|
|
51
|
+
}
|
|
52
|
+
combos = combos.map((c) => [...c, `*${catchAll[1]}`]);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const optional = OPTIONAL.exec(seg);
|
|
56
|
+
if (optional !== null) {
|
|
57
|
+
// Optional segment: keep each existing combo (absent) AND a copy with `:name` appended (present).
|
|
58
|
+
combos = combos.flatMap((c) => [c, [...c, `:${optional[1]}`]]);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const match = PARAM.exec(seg);
|
|
62
|
+
if (match === null) {
|
|
63
|
+
throw new Error(`[nifra/web] invalid route param in "${file}": "${seg}" must be [name], [[name]], [...name], or a (group) folder`);
|
|
64
|
+
}
|
|
65
|
+
combos = combos.map((c) => [...c, `:${match[1]}`]);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
combos = combos.map((c) => [...c, seg]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return combos.map((c) => `/${c.join("/")}`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The **canonical** single pattern for a route file — all optional segments present. A file with no
|
|
75
|
+
* optionals yields its one pattern. Use {@link filePathToPatterns} to get every pattern (optionals
|
|
76
|
+
* expand the set).
|
|
77
|
+
*/
|
|
78
|
+
export function filePathToPattern(file) {
|
|
79
|
+
const patterns = filePathToPatterns(file);
|
|
80
|
+
return patterns[patterns.length - 1];
|
|
81
|
+
}
|
|
82
|
+
/** The dir chain from root → the file's own dir, e.g. "a/b/p.tsx" → ["", "a", "a/b"]. */
|
|
83
|
+
const ancestorDirs = (file) => {
|
|
84
|
+
const dirs = [""];
|
|
85
|
+
const dir = dirOf(file);
|
|
86
|
+
if (dir === "")
|
|
87
|
+
return dirs;
|
|
88
|
+
let acc = "";
|
|
89
|
+
for (const part of dir.split("/")) {
|
|
90
|
+
acc = acc === "" ? part : `${acc}/${part}`;
|
|
91
|
+
dirs.push(acc);
|
|
92
|
+
}
|
|
93
|
+
return dirs;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Build a manifest from route file paths (relative to the routes dir) + an `importer` that
|
|
97
|
+
* turns a path into a lazy module loader. Pure — no fs. Throws at boot (the loud-and-early
|
|
98
|
+
* RouteConfigError ethos) on duplicate patterns. `_layout`/`_404`/`_error` files are special; other
|
|
99
|
+
* `_`-prefixed files are ignored (private/colocated, never routed).
|
|
100
|
+
*/
|
|
101
|
+
export function buildManifest(files, importer) {
|
|
102
|
+
const layoutDirs = new Set();
|
|
103
|
+
const layouts = {};
|
|
104
|
+
const errorDirs = new Set();
|
|
105
|
+
const errors = {};
|
|
106
|
+
let notFound;
|
|
107
|
+
const routeFiles = [];
|
|
108
|
+
for (const file of files) {
|
|
109
|
+
const stem = stripExt(baseName(file));
|
|
110
|
+
if (stem === "_layout") {
|
|
111
|
+
const dir = dirOf(file);
|
|
112
|
+
layoutDirs.add(dir);
|
|
113
|
+
layouts[layoutIdFor(dir)] = { file, load: importer(file) };
|
|
114
|
+
}
|
|
115
|
+
else if (stem === "_error") {
|
|
116
|
+
const dir = dirOf(file);
|
|
117
|
+
errorDirs.add(dir);
|
|
118
|
+
errors[errorIdFor(dir)] = { file, load: importer(file) };
|
|
119
|
+
}
|
|
120
|
+
else if (stem === "_404") {
|
|
121
|
+
notFound = { file, load: importer(file) };
|
|
122
|
+
}
|
|
123
|
+
else if (!stem.startsWith("_")) {
|
|
124
|
+
routeFiles.push(file);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const byPattern = new Map();
|
|
128
|
+
const routes = [];
|
|
129
|
+
for (const file of routeFiles) {
|
|
130
|
+
const dirs = ancestorDirs(file);
|
|
131
|
+
const layoutIds = dirs.filter((dir) => layoutDirs.has(dir)).map(layoutIdFor);
|
|
132
|
+
const errorIds = dirs.filter((dir) => errorDirs.has(dir)).map(errorIdFor);
|
|
133
|
+
const id = stripExt(file);
|
|
134
|
+
const load = importer(file); // one lazy loader per file, shared by its (possibly expanded) patterns
|
|
135
|
+
// An optional `[[x]]` segment expands a file into multiple patterns, all pointing at the same
|
|
136
|
+
// module (same id/load/layout chain). Distinct patterns ⇒ no match ambiguity (different lengths).
|
|
137
|
+
for (const pattern of filePathToPatterns(file)) {
|
|
138
|
+
const existing = byPattern.get(pattern);
|
|
139
|
+
if (existing !== undefined) {
|
|
140
|
+
throw new Error(`[nifra/web] duplicate route: "${file}" and "${existing}" both map to "${pattern}"`);
|
|
141
|
+
}
|
|
142
|
+
byPattern.set(pattern, file);
|
|
143
|
+
routes.push({ id, pattern, layoutIds, errorIds, file, load });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const base = { routes, layouts, errors };
|
|
147
|
+
return notFound === undefined ? base : { ...base, notFound };
|
|
148
|
+
}
|
|
149
|
+
const FILL_PARAM = /:([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
150
|
+
const encodeRouteParam = (value) => {
|
|
151
|
+
const encoded = encodeURIComponent(value);
|
|
152
|
+
// `encodeURIComponent(".")` and `encodeURIComponent("..")` intentionally leave dots alone, but those
|
|
153
|
+
// are filesystem path segments during prerender output. Keep them URL-equivalent while making them
|
|
154
|
+
// inert as path components.
|
|
155
|
+
return encoded === "." || encoded === ".." ? encoded.replace(/\./g, "%2E") : encoded;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Substitute a route pattern's `:param` segments with concrete values: `/users/:id` + `{id:"7"}` →
|
|
159
|
+
* `/users/7`. Returns the filled path plus any params that had no value (a `getStaticPaths` bug) so
|
|
160
|
+
* the caller can skip rather than emit a path with a literal `:name`. Shared by the SSG driver and
|
|
161
|
+
* {@link enumeratePrerenderedPaths}.
|
|
162
|
+
*/
|
|
163
|
+
export function fillRoutePattern(pattern, params) {
|
|
164
|
+
const missing = [];
|
|
165
|
+
const path = pattern.replace(FILL_PARAM, (_m, name) => {
|
|
166
|
+
const value = params[name];
|
|
167
|
+
if (value === undefined) {
|
|
168
|
+
missing.push(name);
|
|
169
|
+
return `:${name}`;
|
|
170
|
+
}
|
|
171
|
+
return encodeRouteParam(value);
|
|
172
|
+
});
|
|
173
|
+
return { path, missing };
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Enumerate the static-routing facts `prerenderRoutes` would produce — static routes opted in via
|
|
177
|
+
* `export const prerender = true`, each `getStaticPaths` entry of a dynamic route, and each dynamic
|
|
178
|
+
* route's `fallback` policy. Pure (no rendering), so a server can compute what to hand `createWebApp`
|
|
179
|
+
* (the prerendered set for the client's static-`_data.json` soft-nav + the fallback map for
|
|
180
|
+
* `"404"` enforcement). A production server may instead read the build's `prerendered.json` to avoid
|
|
181
|
+
* loading every route module at startup. Catch-all/wildcard routes and dynamic routes without
|
|
182
|
+
* `getStaticPaths` are omitted from `paths`.
|
|
183
|
+
*/
|
|
184
|
+
export async function enumerateStaticRoutes(routes) {
|
|
185
|
+
const paths = [];
|
|
186
|
+
const fallbacks = {};
|
|
187
|
+
for (const route of routes) {
|
|
188
|
+
if (route.pattern.includes("*"))
|
|
189
|
+
continue;
|
|
190
|
+
const mod = await route.load();
|
|
191
|
+
if (route.pattern.includes(":")) {
|
|
192
|
+
if (mod.getStaticPaths === undefined)
|
|
193
|
+
continue;
|
|
194
|
+
const { paths: staticPaths, fallback = "ssr" } = await mod.getStaticPaths();
|
|
195
|
+
fallbacks[route.pattern] = fallback;
|
|
196
|
+
for (const { params } of staticPaths) {
|
|
197
|
+
const { path, missing } = fillRoutePattern(route.pattern, params);
|
|
198
|
+
if (missing.length === 0)
|
|
199
|
+
paths.push(path);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else if (mod.prerender === true) {
|
|
203
|
+
paths.push(route.pattern);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return { paths, fallbacks };
|
|
207
|
+
}
|
|
208
|
+
/** The prerendered-path subset of {@link enumerateStaticRoutes} — kept for callers that only need the
|
|
209
|
+
* paths (e.g. injecting `window.__NIFRA_PRERENDERED__`). */
|
|
210
|
+
export async function enumeratePrerenderedPaths(routes) {
|
|
211
|
+
return (await enumerateStaticRoutes(routes)).paths;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources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AO,CAAC,CAAA;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;AAC7B,CAAC;AAED;4DAC4D;AAC5D,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,MAA6B;IAC3E,OAAO,CAAC,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nifrajs/web/plugins/css-modules` — a dependency-free CSS Modules (`*.module.css`) Bun plugin, in its
|
|
3
|
+
* OWN module so the SSR preload registers it BEFORE any `.module.css` file loads. Mirrors the
|
|
4
|
+
* `@nifrajs/web-vue/plugin` seam exactly: pass `"dom"` for the client bundle
|
|
5
|
+
* (`buildClient({ plugins: [...] })`) and preload `"ssr"` for the server (`bun --preload`).
|
|
6
|
+
*
|
|
7
|
+
* Each `import styles from "./x.module.css"` becomes a JS module whose **default export** is the
|
|
8
|
+
* `{ originalClassName: scopedClassName }` map; the rewritten (scoped) CSS is emitted into the client
|
|
9
|
+
* stylesheet via the `?nifra-css-module` virtual-module idiom (the same trick the Vue plugin uses for
|
|
10
|
+
* `?vue-css`). The `"ssr"` form emits **no** CSS — the stylesheet ships from the client build — but
|
|
11
|
+
* produces the **identical** class map, so SSR markup's `class={styles.foo}` matches the bundled
|
|
12
|
+
* selectors (scoped names are a pure function of file path + class name, so both builds agree).
|
|
13
|
+
*
|
|
14
|
+
* Scoping is deterministic (a stable 8-hex hash of the package-relative `filePath + className`, no
|
|
15
|
+
* `Date.now`/`Math.random`/cwd), so builds are reproducible across machines and working directories.
|
|
16
|
+
* Supported (the 95% case): class selectors (`.a`, `.a .b`, `.a.b`), combinators,
|
|
17
|
+
* pseudo-classes/`:not(...)`, native nesting, at-rules (`@media`/`@supports`/`@container`/`@layer`),
|
|
18
|
+
* `:global(...)`/`:local(...)` (function form), and **`@keyframes` names + their `animation`/
|
|
19
|
+
* `animation-name` references** (scoped together, so two modules' same-named keyframes don't clash).
|
|
20
|
+
* Not handled: the bare `:global`/`:local` *switch* form and `composes:` — out of scope by design.
|
|
21
|
+
*/
|
|
22
|
+
import type { BunPlugin } from "bun";
|
|
23
|
+
/** The transform result: the `{ original: scoped }` export map + the rewritten (scoped) stylesheet. */
|
|
24
|
+
export interface CssModuleResult {
|
|
25
|
+
readonly exports: Readonly<Record<string, string>>;
|
|
26
|
+
readonly css: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Pure core (no I/O): scope a CSS-module source. Same `(source, filePath)` in → byte-identical out, so
|
|
30
|
+
* the `"dom"` and `"ssr"` plugin forms produce the same class map. Exposed for direct testing.
|
|
31
|
+
*/
|
|
32
|
+
export declare function transformCssModule(source: string, filePath: string): CssModuleResult;
|
|
33
|
+
/**
|
|
34
|
+
* The CSS Modules Bun plugin. `"dom"` → the `.module.css` import becomes the class map AND emits the
|
|
35
|
+
* scoped stylesheet as a virtual `?nifra-css-module` module that `Bun.build`'s CSS bundler folds into
|
|
36
|
+
* the app stylesheet. `"ssr"` → the class map only (no CSS; the scoped names match the client build).
|
|
37
|
+
* Tolerates a trailing `?query` on the path (dev servers append one to bust Bun's import cache).
|
|
38
|
+
*/
|
|
39
|
+
export declare function cssModulesBunPlugin(generate: "dom" | "ssr"): BunPlugin;
|
|
40
|
+
//# sourceMappingURL=css-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-modules.d.ts","sourceRoot":"","sources":["../../src/plugins/css-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAqWpC,uGAAuG;AACvG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAClD,QAAQ,CAAC,G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type { BunPlugin } from "bun";
|
|
2
|
+
/** The argument Bun passes to a plugin's `setup` — Bun doesn't export the type, so derive it. */
|
|
3
|
+
export type PluginBuilder = Parameters<BunPlugin["setup"]>[0];
|
|
4
|
+
/**
|
|
5
|
+
* A **package-root-relative**, forward-slashed form of an absolute path — the input to {@link hash8} for
|
|
6
|
+
* any build-stable identifier (e.g. CSS-module scoped names). Anchoring on the file's nearest
|
|
7
|
+
* `package.json` (not the absolute path, not `process.cwd()`) makes the result independent of BOTH the
|
|
8
|
+
* machine's directory layout AND the working directory: the dom build and the ssr runtime — even on
|
|
9
|
+
* different machines or from different cwds — derive the SAME relative path for a given file, so their
|
|
10
|
+
* scoped class maps always agree. (Hashing the absolute path would differ across CI/host; a
|
|
11
|
+
* cwd-relative path would silently desync if the SSR server started from a non-project-root cwd.)
|
|
12
|
+
*/
|
|
13
|
+
export declare function reproduciblePath(absolutePath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Deterministic 8-hex hash (djb2/xor). Stable across builds — no `Date.now`/`Math.random` — so build
|
|
16
|
+
* output is reproducible. The single hash implementation behind CSS-module scoped names (and a drop-in
|
|
17
|
+
* for any SFC scope id).
|
|
18
|
+
*/
|
|
19
|
+
export declare function hash8(input: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Records compiled CSS and wires it into the client bundle through a virtual `?<namespace>` module —
|
|
22
|
+
* the idiom the Vue plugin established (`?vue-css`). Register one per plugin `setup`; call `emit` per
|
|
23
|
+
* file to stash its CSS and get back the `import` line to append to the JS module.
|
|
24
|
+
*/
|
|
25
|
+
export interface StylesheetEmitter {
|
|
26
|
+
/** Store `css` for `path`, returning the `import "<path>?<namespace>"` line for the JS module. */
|
|
27
|
+
emit(path: string, css: string): string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Wire the virtual-CSS-module handlers onto `build` for `namespace`, returning an {@link StylesheetEmitter}.
|
|
31
|
+
* The `namespace` must be a plain identifier (letters/`-`); it's used verbatim as the import suffix and
|
|
32
|
+
* the Bun namespace. Only the `"dom"` build should emit CSS — the `"ssr"` build ships no stylesheet.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createStylesheetEmitter(build: PluginBuilder, namespace: string): StylesheetEmitter;
|
|
35
|
+
/**
|
|
36
|
+
* Load an optional peer compiler at build time, throwing a consistent, actionable install-hint error if
|
|
37
|
+
* it's absent — the `@vue/compiler-sfc` peer pattern, centralized. Build-time only, so the dynamic
|
|
38
|
+
* `import` (which keeps the peer out of the package's hard dependencies) is correct here.
|
|
39
|
+
*/
|
|
40
|
+
export declare function requirePeer<T>(specifier: string, hint: {
|
|
41
|
+
readonly feature: string;
|
|
42
|
+
readonly install: string;
|
|
43
|
+
}): Promise<T>;
|
|
44
|
+
//# sourceMappingURL=kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/plugins/kit.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,iGAAiG;AACjG,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAuB7D;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,kGAAkG;IAClG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACxC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,MAAM,GAChB,iBAAiB,CAkBnB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3D,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* `@nifrajs/web/plugins` shared kit — the small infrastructure every CSS-bearing asset plugin reuses, so
|
|
11
|
+
* P1 (CSS Modules), P2 (SCSS), and any future P4 (LESS/Stylus/PostCSS) don't each re-implement the
|
|
12
|
+
* CSS→client-bundle wiring, the deterministic hash, or the optional-peer guard. Internal to
|
|
13
|
+
* `@nifrajs/web` (imported by the sibling plugin modules); not a public subpath.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync } from "node:fs";
|
|
16
|
+
import { dirname, relative } from "node:path";
|
|
17
|
+
const packageRootCache = new Map();
|
|
18
|
+
/** The nearest ancestor directory of `startDir` that holds a `package.json` (the file's package root),
|
|
19
|
+
* cached. Falls back to `startDir` if none is found, so it never throws. */
|
|
20
|
+
function packageRootOf(startDir) {
|
|
21
|
+
const cached = packageRootCache.get(startDir);
|
|
22
|
+
if (cached !== undefined)
|
|
23
|
+
return cached;
|
|
24
|
+
let dir = startDir;
|
|
25
|
+
for (;;) {
|
|
26
|
+
if (existsSync(`${dir}/package.json`))
|
|
27
|
+
break;
|
|
28
|
+
const parent = dirname(dir);
|
|
29
|
+
if (parent === dir) {
|
|
30
|
+
dir = startDir; // reached the filesystem root with no package.json — anchor on the file's own dir
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
dir = parent;
|
|
34
|
+
}
|
|
35
|
+
packageRootCache.set(startDir, dir);
|
|
36
|
+
return dir;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A **package-root-relative**, forward-slashed form of an absolute path — the input to {@link hash8} for
|
|
40
|
+
* any build-stable identifier (e.g. CSS-module scoped names). Anchoring on the file's nearest
|
|
41
|
+
* `package.json` (not the absolute path, not `process.cwd()`) makes the result independent of BOTH the
|
|
42
|
+
* machine's directory layout AND the working directory: the dom build and the ssr runtime — even on
|
|
43
|
+
* different machines or from different cwds — derive the SAME relative path for a given file, so their
|
|
44
|
+
* scoped class maps always agree. (Hashing the absolute path would differ across CI/host; a
|
|
45
|
+
* cwd-relative path would silently desync if the SSR server started from a non-project-root cwd.)
|
|
46
|
+
*/
|
|
47
|
+
export function reproduciblePath(absolutePath) {
|
|
48
|
+
const root = packageRootOf(dirname(absolutePath));
|
|
49
|
+
return relative(root, absolutePath).replaceAll("\\", "/");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Deterministic 8-hex hash (djb2/xor). Stable across builds — no `Date.now`/`Math.random` — so build
|
|
53
|
+
* output is reproducible. The single hash implementation behind CSS-module scoped names (and a drop-in
|
|
54
|
+
* for any SFC scope id).
|
|
55
|
+
*/
|
|
56
|
+
export function hash8(input) {
|
|
57
|
+
let h = 5381;
|
|
58
|
+
for (let i = 0; i < input.length; i++)
|
|
59
|
+
h = (Math.imul(h, 33) ^ input.charCodeAt(i)) >>> 0;
|
|
60
|
+
return h.toString(16).padStart(8, "0");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Wire the virtual-CSS-module handlers onto `build` for `namespace`, returning an {@link StylesheetEmitter}.
|
|
64
|
+
* The `namespace` must be a plain identifier (letters/`-`); it's used verbatim as the import suffix and
|
|
65
|
+
* the Bun namespace. Only the `"dom"` build should emit CSS — the `"ssr"` build ships no stylesheet.
|
|
66
|
+
*/
|
|
67
|
+
export function createStylesheetEmitter(build, namespace) {
|
|
68
|
+
const suffix = `?${namespace}`;
|
|
69
|
+
const cssByPath = new Map();
|
|
70
|
+
// `\?${namespace}$`: namespaces are plain identifiers, so no regex metachars to escape.
|
|
71
|
+
build.onResolve({ filter: new RegExp(`\\?${namespace}$`) }, (args) => ({
|
|
72
|
+
path: args.path,
|
|
73
|
+
namespace,
|
|
74
|
+
}));
|
|
75
|
+
build.onLoad({ filter: /.*/, namespace }, (args) => ({
|
|
76
|
+
contents: cssByPath.get(args.path.slice(0, -suffix.length)) ?? "",
|
|
77
|
+
loader: "css",
|
|
78
|
+
}));
|
|
79
|
+
return {
|
|
80
|
+
emit(path, css) {
|
|
81
|
+
cssByPath.set(path, css);
|
|
82
|
+
return `import ${JSON.stringify(path + suffix)}\n`;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Load an optional peer compiler at build time, throwing a consistent, actionable install-hint error if
|
|
88
|
+
* it's absent — the `@vue/compiler-sfc` peer pattern, centralized. Build-time only, so the dynamic
|
|
89
|
+
* `import` (which keeps the peer out of the package's hard dependencies) is correct here.
|
|
90
|
+
*/
|
|
91
|
+
export async function requirePeer(specifier, hint) {
|
|
92
|
+
try {
|
|
93
|
+
return (await import(__rewriteRelativeImportExtension(specifier)));
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
// Only a genuine resolution failure means "not installed" — surface anything else (a corrupt
|
|
97
|
+
// install, a native-binding error, a throw at module top-level) as the real error rather than
|
|
98
|
+
// masking it behind a misleading "please install it" hint.
|
|
99
|
+
if (err.code === "ERR_MODULE_NOT_FOUND") {
|
|
100
|
+
throw new Error(`[nifra/web] ${hint.feature} requires the optional peer "${specifier}". Install it: ${hint.install}`);
|
|
101
|
+
}
|
|
102
|
+
throw new Error(`[nifra/web] ${hint.feature}: the optional peer "${specifier}" is installed but failed to load.`, { cause: err });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=kit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.js","sourceRoot":"","sources":["../../src/plugins/kit.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAM7C,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAA;AAElD;4EAC4E;AAC5E,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC7C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACvC,IAAI,GAAG,GAAG,QAAQ,CAAA;IAClB,SAAS,CAAC;QACR,IAAI,UAAU,CAAC,GAAG,GAAG,eAAe,CAAC;YAAE,MAAK;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,GAAG,GAAG,QAAQ,CAAA,CAAC,kFAAkF;YACjG,MAAK;QACP,CAAC;QACD,GAAG,GAAG,MAAM,CAAA;IACd,CAAC;IACD,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IACnC,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAoB;IACnD,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA;IACjD,OAAO,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAA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AAC,CAAA;YACxB,OAAO,UAAU,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACpD,CAAC;KACF,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,SAAiB,EACjB,IAA4D;IAE5D,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,MAAM,kCAAC,SAAS,EAAC,CAAM,CAAA;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,6FAA6F;QAC7F,8FAA8F;QAC9F,2DAA2D;QAC3D,IAAK,GAA0B,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;YAChE,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,CAAC,OAAO,gCAAgC,SAAS,kBAAkB,IAAI,CAAC,OAAO,EAAE,CACrG,CAAA;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,CAAC,OAAO,wBAAwB,SAAS,oCAAoC,EAChG,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BunPlugin } from "bun";
|
|
2
|
+
/** The subset of the `sass` / `sass-embedded` API this plugin uses. Both packages satisfy it. */
|
|
3
|
+
export interface SassCompiler {
|
|
4
|
+
compileString(source: string, options?: {
|
|
5
|
+
readonly syntax?: "scss" | "indented";
|
|
6
|
+
readonly style?: "expanded" | "compressed";
|
|
7
|
+
readonly loadPaths?: readonly string[];
|
|
8
|
+
readonly url?: URL;
|
|
9
|
+
}): {
|
|
10
|
+
readonly css: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface ScssPluginOptions {
|
|
14
|
+
/** Inject the compiler (default: the `sass` optional peer, loaded lazily). Pass `sass-embedded` or a stub. */
|
|
15
|
+
readonly compiler?: SassCompiler;
|
|
16
|
+
/** Output style handed to Sass. Default `"expanded"` (Bun minifies the final CSS bundle anyway). */
|
|
17
|
+
readonly style?: "expanded" | "compressed";
|
|
18
|
+
/** Extra import search paths for `@use`/`@import`, in addition to the source file's own directory. */
|
|
19
|
+
readonly loadPaths?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The SASS/SCSS Bun plugin. `"dom"` → bundles the compiled CSS (and, for `*.module.scss`, exports the
|
|
23
|
+
* scoped class map); `"ssr"` → the class map only for `*.module.scss`, an empty module for plain Sass.
|
|
24
|
+
* Tolerates a trailing `?query` (dev servers append one to bust Bun's import cache).
|
|
25
|
+
*/
|
|
26
|
+
export declare function scssBunPlugin(generate: "dom" | "ssr", options?: ScssPluginOptions): BunPlugin;
|
|
27
|
+
//# sourceMappingURL=scss.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../src/plugins/scss.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAMpC,iGAAiG;AACjG,MAAM,WAAW,YAAY;IAC3B,aAAa,CACX,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;QACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,YAAY,CAAA;QAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KACnB,GACA;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,8GAA8G;IAC9G,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;IAChC,oGAAoG;IACpG,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,YAAY,CAAA;IAC1C,sGAAsG;IACtG,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAID;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,EAAE,OAAO,GAAE,iBAAsB,GAAG,SAAS,CAuDjG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nifrajs/web/plugins/scss` — a SASS/SCSS (`*.scss`, `*.sass`) Bun plugin, in its OWN module so the SSR
|
|
3
|
+
* preload registers it BEFORE any Sass file loads. Mirrors the `@nifrajs/web-vue/plugin` seam: pass
|
|
4
|
+
* `"dom"` for the client bundle (`buildClient({ plugins: [...] })`) and preload `"ssr"` for the server
|
|
5
|
+
* (`bun --preload`).
|
|
6
|
+
*
|
|
7
|
+
* The Dart Sass compiler is an **optional peer** (`sass`, or the faster `sass-embedded` — same API), not
|
|
8
|
+
* a hard dependency: it's loaded on first Sass file and fails loud with an install hint if absent. Pass
|
|
9
|
+
* your own `compiler` to override (e.g. `sass-embedded`, or a stub in tests).
|
|
10
|
+
*
|
|
11
|
+
* Composes with CSS Modules: a `*.module.scss` / `*.module.sass` file is compiled to CSS and then run
|
|
12
|
+
* through the same scoped-class transform as `@nifrajs/web/plugins/css-modules`, so its `import styles`
|
|
13
|
+
* yields the `{ original: scoped }` map (SSR/dom class-map parity included). A plain `*.scss` is a
|
|
14
|
+
* side-effect import — its CSS is bundled (dom) and it resolves to an empty module (ssr).
|
|
15
|
+
*/
|
|
16
|
+
import { dirname } from "node:path";
|
|
17
|
+
import { pathToFileURL } from "node:url";
|
|
18
|
+
import { transformCssModule } from "./css-modules.js";
|
|
19
|
+
import { createStylesheetEmitter, reproduciblePath, requirePeer } from "./kit.js";
|
|
20
|
+
const STYLE_NS = "nifra-scss";
|
|
21
|
+
const isModuleRequest = (cleanPath) => /\.module\.s[ac]ss$/.test(cleanPath);
|
|
22
|
+
/**
|
|
23
|
+
* The SASS/SCSS Bun plugin. `"dom"` → bundles the compiled CSS (and, for `*.module.scss`, exports the
|
|
24
|
+
* scoped class map); `"ssr"` → the class map only for `*.module.scss`, an empty module for plain Sass.
|
|
25
|
+
* Tolerates a trailing `?query` (dev servers append one to bust Bun's import cache).
|
|
26
|
+
*/
|
|
27
|
+
export function scssBunPlugin(generate, options = {}) {
|
|
28
|
+
return {
|
|
29
|
+
name: `nifra-scss-${generate}`,
|
|
30
|
+
setup(build) {
|
|
31
|
+
const stylesheet = createStylesheetEmitter(build, STYLE_NS);
|
|
32
|
+
let compiler = options.compiler;
|
|
33
|
+
const getCompiler = async () => {
|
|
34
|
+
compiler ??= await requirePeer("sass", {
|
|
35
|
+
feature: "SASS/SCSS support",
|
|
36
|
+
install: "bun add -d sass",
|
|
37
|
+
});
|
|
38
|
+
return compiler;
|
|
39
|
+
};
|
|
40
|
+
build.onLoad({ filter: /\.s[ac]ss(\?|$)/ }, async (args) => {
|
|
41
|
+
const path = args.path.split("?")[0] ?? args.path;
|
|
42
|
+
const source = await Bun.file(path).text();
|
|
43
|
+
const sass = await getCompiler();
|
|
44
|
+
let css;
|
|
45
|
+
try {
|
|
46
|
+
css = sass.compileString(source, {
|
|
47
|
+
syntax: path.endsWith(".sass") ? "indented" : "scss",
|
|
48
|
+
style: options.style ?? "expanded",
|
|
49
|
+
loadPaths: [dirname(path), ...(options.loadPaths ?? [])],
|
|
50
|
+
url: pathToFileURL(path),
|
|
51
|
+
}).css;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
// Attribute the Sass compile error to the file + package (Dart Sass errors carry line info).
|
|
55
|
+
throw new Error(`[nifra/web] failed to compile ${path}: ${err?.message ?? err}`, {
|
|
56
|
+
cause: err,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (isModuleRequest(path)) {
|
|
60
|
+
// *.module.scss → compile, then scope class names through the shared CSS-modules transform.
|
|
61
|
+
// Scope off the cwd-relative path so names are reproducible across machines/CI.
|
|
62
|
+
const { exports, css: scopedCss } = transformCssModule(css, reproduciblePath(path));
|
|
63
|
+
const js = `export default ${JSON.stringify(exports)}\n`;
|
|
64
|
+
return {
|
|
65
|
+
contents: generate === "dom" ? js + stylesheet.emit(path, scopedCss) : js,
|
|
66
|
+
loader: "js",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// Plain *.scss → side-effect import: bundle the CSS on dom, an empty module on ssr.
|
|
70
|
+
return {
|
|
71
|
+
contents: generate === "dom" ? stylesheet.emit(path, css) : "",
|
|
72
|
+
loader: "js",
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss.js","sourceRoot":"","sources":["../../src/plugins/scss.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEjF,MAAM,QAAQ,GAAG,YAAY,CAAA;AAwB7B,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAE5F;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAuB,EAAE,UAA6B,EAAE;IACpF,OAAO;QACL,IAAI,EAAE,cAAc,QAAQ,EAAE;QAC9B,KAAK,CAAC,KAAK;YACT,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;YAC3D,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;YAC/B,MAAM,WAAW,GAAG,KAAK,IAA2B,EAAE;gBACp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