@animus-ui/layergate 0.0.0-stage → 0.1.36
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/README.md +239 -2
- package/dist/compile-C4GyCiuY.cjs +323 -0
- package/dist/compile-Cu_GFS3l.mjs +295 -0
- package/dist/compile-DZwVBjTM.d.cts +126 -0
- package/dist/compile-DZwVBjTM.d.cts.map +1 -0
- package/dist/compile-DZwVBjTM.d.mts +126 -0
- package/dist/compile-DZwVBjTM.d.mts.map +1 -0
- package/dist/host-BGcb1rMJ.mjs +169 -0
- package/dist/host-C4ZaMdkx.cjs +210 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/plan-Bsn_yxS9.mjs +29 -0
- package/dist/plan-hvk04qzh.cjs +40 -0
- package/dist/plan-w-y0limy.d.cts +35 -0
- package/dist/plan-w-y0limy.d.cts.map +1 -0
- package/dist/plan-w-y0limy.d.mts +35 -0
- package/dist/plan-w-y0limy.d.mts.map +1 -0
- package/dist/sheet-BUnyt5Jt.cjs +576 -0
- package/dist/sheet-DJGhbeYI.mjs +571 -0
- package/dist/vite.cjs +295 -0
- package/dist/vite.d.cts +59 -0
- package/dist/vite.d.cts.map +1 -0
- package/dist/vite.d.mts +59 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +290 -0
- package/dist/webpack-loader.cjs +104 -0
- package/dist/webpack-loader.d.cts +35 -0
- package/dist/webpack-loader.d.cts.map +1 -0
- package/dist/webpack-loader.d.mts +36 -0
- package/dist/webpack-loader.d.mts.map +1 -0
- package/dist/webpack-loader.mjs +104 -0
- package/dist/webpack-state-BpF2PPjA.d.cts +15 -0
- package/dist/webpack-state-BpF2PPjA.d.cts.map +1 -0
- package/dist/webpack-state-BtmtzsWZ.cjs +61 -0
- package/dist/webpack-state-CXoQQ7XR.d.mts +15 -0
- package/dist/webpack-state-CXoQQ7XR.d.mts.map +1 -0
- package/dist/webpack-state-DwltSkQq.mjs +44 -0
- package/dist/webpack.cjs +161 -0
- package/dist/webpack.d.cts +98 -0
- package/dist/webpack.d.cts.map +1 -0
- package/dist/webpack.d.mts +98 -0
- package/dist/webpack.d.mts.map +1 -0
- package/dist/webpack.mjs +155 -0
- package/package.json +90 -4
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_compile = require("./compile-C4GyCiuY.cjs");
|
|
6
|
+
const require_sheet = require("./sheet-BUnyt5Jt.cjs");
|
|
7
|
+
const require_plan = require("./plan-hvk04qzh.cjs");
|
|
8
|
+
const require_host = require("./host-C4ZaMdkx.cjs");
|
|
9
|
+
let node_path = require("node:path");
|
|
10
|
+
let node_fs = require("node:fs");
|
|
11
|
+
let node_fs_promises = require("node:fs/promises");
|
|
12
|
+
let node_module = require("node:module");
|
|
13
|
+
let vite = require("vite");
|
|
14
|
+
//#region src/vite.ts
|
|
15
|
+
/**
|
|
16
|
+
* The Vite adapter. layergate owns the load of each selected stylesheet:
|
|
17
|
+
* the declared sheets, which `virtual:layergate` (or a host's own
|
|
18
|
+
* stylesheet, `declaredBy`) delivers as one finished stylesheet, and, opted
|
|
19
|
+
* in, the `.css` a JS module imports from another package, which loads as
|
|
20
|
+
* `<realpath>?layergate`. Each finished stylesheet has no local `@import`
|
|
21
|
+
* left, and Vite's own CSS pipeline then processes it once: PostCSS,
|
|
22
|
+
* minification, injection or extraction. A JS module's import of an owned
|
|
23
|
+
* sheet reaches it through a proxy that imports the declared sheets first,
|
|
24
|
+
* so they keep their order wherever the app imports an owned sheet first.
|
|
25
|
+
* A stylesheet Vite loads itself that is owned, or reaches an owned file,
|
|
26
|
+
* is finished in `transform`. CSS Modules and special requests (`?inline`,
|
|
27
|
+
* `?url`, `?raw`) stay Vite's.
|
|
28
|
+
*/
|
|
29
|
+
const OWNED = "?layergate";
|
|
30
|
+
const ENTRY_ID = "virtual:layergate";
|
|
31
|
+
/** `virtual:layergate` is a stylesheet: the declared sheets, finished. */
|
|
32
|
+
const RESOLVED_ENTRY = `\0${ENTRY_ID}.css`;
|
|
33
|
+
/** A JS module's import of an owned sheet: the declared sheets, then it.
|
|
34
|
+
* Its id names the file encoded and ends in `.js`, so Vite never takes it
|
|
35
|
+
* for a stylesheet. */
|
|
36
|
+
const PROXY = "\0layergate-proxy:";
|
|
37
|
+
const proxyId = (file) => `${PROXY}${encodeURIComponent(file)}.js`;
|
|
38
|
+
const proxiedFile = (id) => decodeURIComponent(id.slice(17, -3));
|
|
39
|
+
const PLAIN_CSS = /\.css$/;
|
|
40
|
+
const MODULE_CSS = /\.module\.css$/;
|
|
41
|
+
/** The stylesheet a request id names when the request is plain stylesheet
|
|
42
|
+
* delivery: no query, or only Vite's `direct` (a stylesheet an HTML link
|
|
43
|
+
* loads in development) and its `t`/`v` cache-busting params. Special
|
|
44
|
+
* requests (`?inline`, `?url`, `?raw`) and CSS Modules are not. */
|
|
45
|
+
function plainCssFile(id) {
|
|
46
|
+
const at = id.indexOf("?");
|
|
47
|
+
const path = at === -1 ? id : id.slice(0, at);
|
|
48
|
+
if (!PLAIN_CSS.test(path) || MODULE_CSS.test(path)) return null;
|
|
49
|
+
return (at === -1 ? [] : id.slice(at + 1).split("&")).every((param) => param === "direct" || /^[tv]=/.test(param)) ? path : null;
|
|
50
|
+
}
|
|
51
|
+
/** Whether `file` lies outside the directory `root`. */
|
|
52
|
+
const outside = (root, file) => {
|
|
53
|
+
const path = (0, node_path.relative)(root, file);
|
|
54
|
+
return path.startsWith("..") || (0, node_path.isAbsolute)(path);
|
|
55
|
+
};
|
|
56
|
+
function layergate(options = {}) {
|
|
57
|
+
const plan = require_plan.resolvePlan(options);
|
|
58
|
+
const declaredBy = options.declaredBy ?? ENTRY_ID;
|
|
59
|
+
let root = process.cwd();
|
|
60
|
+
const owner = require_host.ownership(plan);
|
|
61
|
+
const { owns, owning } = owner;
|
|
62
|
+
/** `@import` inside an owned sheet resolves as Vite resolves a CSS
|
|
63
|
+
* import: the `style` field and condition, CSS files only. */
|
|
64
|
+
let resolveCss;
|
|
65
|
+
/** Declared sheets, in order. */
|
|
66
|
+
let optedOut = /* @__PURE__ */ new Set();
|
|
67
|
+
/** Parsed files, the files each owned id's finished stylesheet read,
|
|
68
|
+
* and reach answers. */
|
|
69
|
+
const units = new require_host.Units();
|
|
70
|
+
/** Each module's finished declared head, kept until a file it read
|
|
71
|
+
* changes. */
|
|
72
|
+
const heads = /* @__PURE__ */ new Map();
|
|
73
|
+
let server;
|
|
74
|
+
/** Vite's watcher ignores node_modules, so an owned file there is
|
|
75
|
+
* watched here through its directory, which sees edits, atomic saves,
|
|
76
|
+
* deletion and creation alike, and its change handed to Vite's HMR. One
|
|
77
|
+
* watch serves every owned file of a directory. */
|
|
78
|
+
const directories = /* @__PURE__ */ new Map();
|
|
79
|
+
const unwatch = (file) => {
|
|
80
|
+
const dir = (0, node_path.dirname)(file);
|
|
81
|
+
const watched = directories.get(dir);
|
|
82
|
+
watched?.files.delete(file);
|
|
83
|
+
if (watched?.files.size === 0) {
|
|
84
|
+
watched.watcher.close();
|
|
85
|
+
directories.delete(dir);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const watchInstalled = (file) => {
|
|
89
|
+
if (!server || !file.includes("/node_modules/")) return;
|
|
90
|
+
const dir = (0, node_path.dirname)(file);
|
|
91
|
+
const watched = directories.get(dir);
|
|
92
|
+
if (watched) {
|
|
93
|
+
watched.files.add(file);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const files = /* @__PURE__ */ new Set([file]);
|
|
98
|
+
const watcher = (0, node_fs.watch)(dir, (_event, name) => {
|
|
99
|
+
const changed = name ? `${dir}/${(0, node_path.basename)(name)}` : null;
|
|
100
|
+
if (changed && files.has(changed)) server?.watcher.emit("change", changed);
|
|
101
|
+
});
|
|
102
|
+
directories.set(dir, {
|
|
103
|
+
watcher,
|
|
104
|
+
files
|
|
105
|
+
});
|
|
106
|
+
} catch {}
|
|
107
|
+
};
|
|
108
|
+
/** Records the files `id`'s finished stylesheet read, forgetting and
|
|
109
|
+
* unwatching what it no longer reads. */
|
|
110
|
+
const reconcile = (id, files) => {
|
|
111
|
+
for (const file of units.record(id, files)) unwatch(file);
|
|
112
|
+
for (const file of files) watchInstalled(file);
|
|
113
|
+
};
|
|
114
|
+
/** A root-relative URL for `target`, which Vite resolves from any
|
|
115
|
+
* stylesheet, its own virtual ones too; one outside the root through
|
|
116
|
+
* Vite's `/@fs/`, which the dev server serves only inside
|
|
117
|
+
* `server.fs.allow`: the directory of an owned file outside it is
|
|
118
|
+
* allowed, and nothing more. */
|
|
119
|
+
const rootUrl = (target) => {
|
|
120
|
+
if (!outside(require_host.real(root), target)) return `/${(0, vite.normalizePath)((0, node_path.relative)(require_host.real(root), target))}`;
|
|
121
|
+
if (server && !(0, vite.isFileLoadingAllowed)(server.config, (0, vite.normalizePath)(target))) server.config.server.fs.allow.push((0, vite.normalizePath)((0, node_path.dirname)(target)));
|
|
122
|
+
return `/@fs${(0, vite.normalizePath)(target)}`;
|
|
123
|
+
};
|
|
124
|
+
/** The file an `@import` in `importer` reaches, as Vite resolves CSS. */
|
|
125
|
+
const resolveImport = async (context, specifier, importer) => {
|
|
126
|
+
const resolved = await resolveCss?.(context.environment, specifier, importer);
|
|
127
|
+
return resolved && PLAIN_CSS.test(require_host.fileOf(resolved)) ? require_host.fileOf(resolved) : null;
|
|
128
|
+
};
|
|
129
|
+
/** Compiles `roots` with the host's CSS resolver, the plan and the
|
|
130
|
+
* parsed-file cache. */
|
|
131
|
+
const finish = (context, roots, extra = {}) => require_compile.compileUnit(roots, {
|
|
132
|
+
layer: plan.layer,
|
|
133
|
+
order: plan.order,
|
|
134
|
+
base: root,
|
|
135
|
+
resolve: (specifier, from) => resolveImport(context, specifier, from),
|
|
136
|
+
read: (file) => (0, node_fs_promises.readFile)(file, "utf8"),
|
|
137
|
+
quarantined: (file) => !optedOut.has(file),
|
|
138
|
+
owns,
|
|
139
|
+
cache: units.parsed,
|
|
140
|
+
...extra
|
|
141
|
+
});
|
|
142
|
+
/** Reports `unit`'s diagnostics through `context` and records the files
|
|
143
|
+
* module `id` now reads. */
|
|
144
|
+
const publish = (context, id, unit) => {
|
|
145
|
+
for (const file of unit.files) context.addWatchFile(file);
|
|
146
|
+
reconcile(id, unit.files);
|
|
147
|
+
for (const diagnostic of unit.diagnostics) {
|
|
148
|
+
const message = require_host.formatDiagnostic(diagnostic);
|
|
149
|
+
if (diagnostic.severity === "error") context.error(message);
|
|
150
|
+
else if (diagnostic.severity === "warning") context.warn(message);
|
|
151
|
+
else context.info(message);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
/** The declared sheets as one finished stylesheet for module `id`, with
|
|
155
|
+
* root-relative URLs; empty when nothing is declared. */
|
|
156
|
+
const head = async (context, id) => {
|
|
157
|
+
if (owner.declared.length === 0) return "";
|
|
158
|
+
const kept = heads.get(id);
|
|
159
|
+
if (kept !== void 0) return kept;
|
|
160
|
+
const unit = await finish(context, owner.declared, {
|
|
161
|
+
url: rootUrl,
|
|
162
|
+
map: false
|
|
163
|
+
});
|
|
164
|
+
publish(context, id, unit);
|
|
165
|
+
heads.set(id, unit.css);
|
|
166
|
+
return unit.css;
|
|
167
|
+
};
|
|
168
|
+
return Object.assign({
|
|
169
|
+
name: "layergate",
|
|
170
|
+
enforce: "pre",
|
|
171
|
+
config(userConfig, env) {
|
|
172
|
+
if (env.command !== "serve") return;
|
|
173
|
+
const base = (0, node_path.resolve)(userConfig.root ?? process.cwd());
|
|
174
|
+
const require$1 = (0, node_module.createRequire)((0, node_path.join)(base, "package.json"));
|
|
175
|
+
const dirs = [];
|
|
176
|
+
for (const specifier of plan.sheets) {
|
|
177
|
+
let file;
|
|
178
|
+
try {
|
|
179
|
+
file = require_host.real(specifier.startsWith(".") || (0, node_path.isAbsolute)(specifier) ? (0, node_path.resolve)(base, specifier) : require$1.resolve(specifier));
|
|
180
|
+
} catch {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (outside(require_host.real(base), file)) dirs.push((0, node_path.dirname)(file));
|
|
184
|
+
}
|
|
185
|
+
if (dirs.length === 0) return;
|
|
186
|
+
return { server: { fs: { allow: userConfig.server?.fs?.allow ? dirs : [(0, vite.searchForWorkspaceRoot)(base), ...dirs] } } };
|
|
187
|
+
},
|
|
188
|
+
configResolved(config) {
|
|
189
|
+
root = config.root;
|
|
190
|
+
owner.reset(root, []);
|
|
191
|
+
resolveCss = (0, vite.createIdResolver)(config, {
|
|
192
|
+
extensions: [".css"],
|
|
193
|
+
mainFields: ["style"],
|
|
194
|
+
conditions: ["style", "development|production"],
|
|
195
|
+
tryIndex: false,
|
|
196
|
+
preferRelative: true
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
configureServer(devServer) {
|
|
200
|
+
server = devServer;
|
|
201
|
+
},
|
|
202
|
+
buildEnd() {
|
|
203
|
+
for (const { watcher } of directories.values()) watcher.close();
|
|
204
|
+
directories.clear();
|
|
205
|
+
},
|
|
206
|
+
async buildStart() {
|
|
207
|
+
const importer = (0, node_path.join)(root, "index.html");
|
|
208
|
+
const resolveOne = async (specifier) => {
|
|
209
|
+
const resolved = await this.resolve(specifier, importer, { skipSelf: true });
|
|
210
|
+
return resolved && !resolved.external ? require_host.fileOf(resolved.id) : null;
|
|
211
|
+
};
|
|
212
|
+
const declared = await require_host.resolveEach(plan.sheets, "sheets", root, resolveOne);
|
|
213
|
+
owner.reset(root, declared);
|
|
214
|
+
const cssModule = declared.find((file) => MODULE_CSS.test(file));
|
|
215
|
+
if (cssModule) this.error(`[layergate] sheets: ${cssModule} is a CSS Module; layergate does not own CSS Modules yet`);
|
|
216
|
+
optedOut = new Set(await require_host.resolveEach(plan.optOut, "optOut", root, resolveOne));
|
|
217
|
+
heads.clear();
|
|
218
|
+
},
|
|
219
|
+
async resolveId(source, importer, resolveOptions) {
|
|
220
|
+
if (source === ENTRY_ID) return RESOLVED_ENTRY;
|
|
221
|
+
if (source.endsWith(OWNED) || source.startsWith(PROXY)) return source;
|
|
222
|
+
if (!owning()) return null;
|
|
223
|
+
if (!importer || importer.startsWith("\0") || (0, vite.isCSSRequest)(importer)) return null;
|
|
224
|
+
if (source.includes("?") || !PLAIN_CSS.test(source)) return null;
|
|
225
|
+
const resolved = await this.resolve(source, importer, {
|
|
226
|
+
...resolveOptions,
|
|
227
|
+
skipSelf: true
|
|
228
|
+
});
|
|
229
|
+
if (!resolved || resolved.external) return null;
|
|
230
|
+
const file = require_host.fileOf(resolved.id);
|
|
231
|
+
if (!PLAIN_CSS.test(file) || MODULE_CSS.test(file)) return null;
|
|
232
|
+
return owns(file) ? proxyId(file) : null;
|
|
233
|
+
},
|
|
234
|
+
async load(id) {
|
|
235
|
+
if (id === RESOLVED_ENTRY) return head(this, id);
|
|
236
|
+
if (id.startsWith(PROXY)) {
|
|
237
|
+
const file = proxiedFile(id);
|
|
238
|
+
return (owner.declared.includes(file) ? [declaredBy] : [declaredBy, file + OWNED]).map((request) => `import ${JSON.stringify(request)};`).join("\n");
|
|
239
|
+
}
|
|
240
|
+
if (!id.endsWith(OWNED)) return null;
|
|
241
|
+
const unit = await finish(this, [id.slice(0, -10)]);
|
|
242
|
+
publish(this, id, unit);
|
|
243
|
+
return {
|
|
244
|
+
code: unit.css,
|
|
245
|
+
map: unit.map
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
async transform(code, id) {
|
|
249
|
+
if (!owning() || id.startsWith("\0")) return null;
|
|
250
|
+
const requested = plainCssFile(id);
|
|
251
|
+
if (!requested) return null;
|
|
252
|
+
const file = require_host.real(requested);
|
|
253
|
+
const { imports } = require_sheet.readSheet(code);
|
|
254
|
+
if (!owns(file) && imports.length === 0) return null;
|
|
255
|
+
if (!await units.reaches(file, imports, {
|
|
256
|
+
resolve: (specifier, from) => resolveImport(this, specifier, from),
|
|
257
|
+
read: (path) => (0, node_fs_promises.readFile)(path, "utf8"),
|
|
258
|
+
owns
|
|
259
|
+
})) return null;
|
|
260
|
+
units.parsed.delete(file);
|
|
261
|
+
const unit = await finish(this, [file], { read: (path) => path === file ? code : (0, node_fs_promises.readFile)(path, "utf8") });
|
|
262
|
+
publish(this, id, unit);
|
|
263
|
+
return {
|
|
264
|
+
code: unit.css,
|
|
265
|
+
map: unit.map
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
hotUpdate({ file, modules }) {
|
|
269
|
+
const stale = units.changed((0, vite.normalizePath)(file));
|
|
270
|
+
if (stale.size === 0) return;
|
|
271
|
+
const graph = this.environment.moduleGraph;
|
|
272
|
+
const affected = [];
|
|
273
|
+
for (const id of stale) {
|
|
274
|
+
heads.delete(id);
|
|
275
|
+
const node = graph.getModuleById(id);
|
|
276
|
+
if (!node) continue;
|
|
277
|
+
graph.invalidateModule(node);
|
|
278
|
+
affected.push(node);
|
|
279
|
+
}
|
|
280
|
+
return [...modules, ...affected];
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
/**
|
|
284
|
+
* The declared sheets as one finished stylesheet, for a host that
|
|
285
|
+
* delivers them at the head of its own stylesheet module `id` (and
|
|
286
|
+
* names it `declaredBy`): URLs are root-relative, and an edit to any
|
|
287
|
+
* file read updates module `id`. Empty when nothing is declared.
|
|
288
|
+
*/
|
|
289
|
+
stylesheetHead(id) {
|
|
290
|
+
return head(this, id);
|
|
291
|
+
} });
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
exports.default = layergate;
|
|
295
|
+
exports.layergate = layergate;
|
package/dist/vite.d.cts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as LayergateOptions } from "./plan-w-y0limy.cjs";
|
|
2
|
+
import { EnvironmentModuleNode, Rolldown, ViteDevServer } from "vite";
|
|
3
|
+
//#region src/vite.d.ts
|
|
4
|
+
export interface LayergateViteOptions extends LayergateOptions {
|
|
5
|
+
/** The module that delivers the declared sheets; an owned stylesheet a
|
|
6
|
+
* JS module imports loads it first. Default `virtual:layergate`. A host
|
|
7
|
+
* that delivers them at the head of its own stylesheet
|
|
8
|
+
* (`stylesheetHead`) names that stylesheet. */
|
|
9
|
+
declaredBy?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function layergate(options?: LayergateViteOptions): {
|
|
12
|
+
name: string;
|
|
13
|
+
enforce: "pre";
|
|
14
|
+
config(this: import("vite").ConfigPluginContext, userConfig: import("vite").UserConfig, env: import("vite").ConfigEnv): {
|
|
15
|
+
server: {
|
|
16
|
+
fs: {
|
|
17
|
+
allow: string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
} | undefined;
|
|
21
|
+
configResolved(this: import("vite").MinimalPluginContextWithoutEnvironment, config: import("vite").ResolvedConfig): void;
|
|
22
|
+
configureServer(this: import("vite").MinimalPluginContextWithoutEnvironment, devServer: ViteDevServer): void;
|
|
23
|
+
buildEnd(): void;
|
|
24
|
+
buildStart(this: Rolldown.PluginContext): Promise<void>;
|
|
25
|
+
resolveId(this: Rolldown.PluginContext, source: string, importer: string | undefined, resolveOptions: {
|
|
26
|
+
kind?: Rolldown.ImportKind;
|
|
27
|
+
custom?: Rolldown.CustomPluginOptions;
|
|
28
|
+
ssr?: boolean | undefined;
|
|
29
|
+
isEntry: boolean;
|
|
30
|
+
}): Promise<string | null>;
|
|
31
|
+
load(this: Rolldown.PluginContext, id: string): Promise<string | {
|
|
32
|
+
code: string;
|
|
33
|
+
map: (Omit<import("magic-string").SourceMap, "sourcesContent"> & {
|
|
34
|
+
sourcesContent: Array<string | null>;
|
|
35
|
+
}) | null;
|
|
36
|
+
} | null>;
|
|
37
|
+
transform(this: Rolldown.TransformPluginContext, code: string, id: string): Promise<{
|
|
38
|
+
code: string;
|
|
39
|
+
map: (Omit<import("magic-string").SourceMap, "sourcesContent"> & {
|
|
40
|
+
sourcesContent: Array<string | null>;
|
|
41
|
+
}) | null;
|
|
42
|
+
} | null>;
|
|
43
|
+
hotUpdate(this: Rolldown.MinimalPluginContext & {
|
|
44
|
+
environment: import("vite").DevEnvironment;
|
|
45
|
+
}, { file, modules }: import("vite").HotUpdateOptions): EnvironmentModuleNode[] | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
/**
|
|
48
|
+
* The declared sheets as one finished stylesheet, for a host that
|
|
49
|
+
* delivers them at the head of its own stylesheet module `id` (and
|
|
50
|
+
* names it `declaredBy`): URLs are root-relative, and an edit to any
|
|
51
|
+
* file read updates module `id`. Empty when nothing is declared.
|
|
52
|
+
*/
|
|
53
|
+
stylesheetHead(this: Rolldown.PluginContext, id: string): Promise<string>;
|
|
54
|
+
};
|
|
55
|
+
/** The plugin `layergate()` returns, its hooks typed as written. */
|
|
56
|
+
export type LayergatePlugin = ReturnType<typeof layergate>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { type LayergateOptions, layergate as default };
|
|
59
|
+
//# sourceMappingURL=vite.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;iBAyDiB,6BAA6B;;;;;EAK5C;;wBAsCc,UAAU,UAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+TV,eAAA,MAAA,SAAS,eAAa,aAAe;;;YAOlD,kBAAkB,kBAAkB"}
|
package/dist/vite.d.mts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as LayergateOptions } from "./plan-w-y0limy.mjs";
|
|
2
|
+
import { EnvironmentModuleNode, Rolldown, ViteDevServer } from "vite";
|
|
3
|
+
//#region src/vite.d.ts
|
|
4
|
+
export interface LayergateViteOptions extends LayergateOptions {
|
|
5
|
+
/** The module that delivers the declared sheets; an owned stylesheet a
|
|
6
|
+
* JS module imports loads it first. Default `virtual:layergate`. A host
|
|
7
|
+
* that delivers them at the head of its own stylesheet
|
|
8
|
+
* (`stylesheetHead`) names that stylesheet. */
|
|
9
|
+
declaredBy?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function layergate(options?: LayergateViteOptions): {
|
|
12
|
+
name: string;
|
|
13
|
+
enforce: "pre";
|
|
14
|
+
config(this: import("vite").ConfigPluginContext, userConfig: import("vite").UserConfig, env: import("vite").ConfigEnv): {
|
|
15
|
+
server: {
|
|
16
|
+
fs: {
|
|
17
|
+
allow: string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
} | undefined;
|
|
21
|
+
configResolved(this: import("vite").MinimalPluginContextWithoutEnvironment, config: import("vite").ResolvedConfig): void;
|
|
22
|
+
configureServer(this: import("vite").MinimalPluginContextWithoutEnvironment, devServer: ViteDevServer): void;
|
|
23
|
+
buildEnd(): void;
|
|
24
|
+
buildStart(this: Rolldown.PluginContext): Promise<void>;
|
|
25
|
+
resolveId(this: Rolldown.PluginContext, source: string, importer: string | undefined, resolveOptions: {
|
|
26
|
+
kind?: Rolldown.ImportKind;
|
|
27
|
+
custom?: Rolldown.CustomPluginOptions;
|
|
28
|
+
ssr?: boolean | undefined;
|
|
29
|
+
isEntry: boolean;
|
|
30
|
+
}): Promise<string | null>;
|
|
31
|
+
load(this: Rolldown.PluginContext, id: string): Promise<string | {
|
|
32
|
+
code: string;
|
|
33
|
+
map: (Omit<import("magic-string").SourceMap, "sourcesContent"> & {
|
|
34
|
+
sourcesContent: Array<string | null>;
|
|
35
|
+
}) | null;
|
|
36
|
+
} | null>;
|
|
37
|
+
transform(this: Rolldown.TransformPluginContext, code: string, id: string): Promise<{
|
|
38
|
+
code: string;
|
|
39
|
+
map: (Omit<import("magic-string").SourceMap, "sourcesContent"> & {
|
|
40
|
+
sourcesContent: Array<string | null>;
|
|
41
|
+
}) | null;
|
|
42
|
+
} | null>;
|
|
43
|
+
hotUpdate(this: Rolldown.MinimalPluginContext & {
|
|
44
|
+
environment: import("vite").DevEnvironment;
|
|
45
|
+
}, { file, modules }: import("vite").HotUpdateOptions): EnvironmentModuleNode[] | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
/**
|
|
48
|
+
* The declared sheets as one finished stylesheet, for a host that
|
|
49
|
+
* delivers them at the head of its own stylesheet module `id` (and
|
|
50
|
+
* names it `declaredBy`): URLs are root-relative, and an edit to any
|
|
51
|
+
* file read updates module `id`. Empty when nothing is declared.
|
|
52
|
+
*/
|
|
53
|
+
stylesheetHead(this: Rolldown.PluginContext, id: string): Promise<string>;
|
|
54
|
+
};
|
|
55
|
+
/** The plugin `layergate()` returns, its hooks typed as written. */
|
|
56
|
+
export type LayergatePlugin = ReturnType<typeof layergate>;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { type LayergateOptions, layergate as default };
|
|
59
|
+
//# sourceMappingURL=vite.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;iBAyDiB,6BAA6B;;;;;EAK5C;;wBAsCc,UAAU,UAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+TV,eAAA,MAAA,SAAS,eAAa,aAAe;;;YAOlD,kBAAkB,kBAAkB"}
|