@menapo/vicss 0.0.0-stage → 1.0.0
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 +627 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1311 -0
- package/dist/config-loader-DzP68Snn.js +162 -0
- package/dist/config-loader-pLzP9par.js +1 -0
- package/dist/config.d.ts +821 -0
- package/dist/config.js +2690 -0
- package/dist/index.d.ts +1471 -0
- package/dist/index.js +369 -0
- package/dist/lint.d.ts +114 -0
- package/dist/lint.js +0 -0
- package/dist/pool-BGXMhLfL.js +2942 -0
- package/dist/print-Ds6fkgio.js +5093 -0
- package/dist/snapshot-BQb8ZmSV.js +149 -0
- package/dist/theme-C-0LpsJx.js +2437 -0
- package/dist/types-file-R_knFzME.js +2481 -0
- package/dist/vite.d.ts +245 -0
- package/dist/vite.js +1926 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +113 -0
- package/package.json +66 -3
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { y as resolveSystem } from "./print-Ds6fkgio.js";
|
|
2
|
+
import { a as toErrorData, b as setParser, o as compile, r as configShape, s as createParseCache } from "./pool-BGXMhLfL.js";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
import { parentPort } from "node:worker_threads";
|
|
7
|
+
//#region src/vite/worker.ts
|
|
8
|
+
/**
|
|
9
|
+
* A pre-scan worker thread (PLAN D17; see pool.ts). It compiles files the
|
|
10
|
+
* main thread sends, and asks the main thread how each import resolves, so
|
|
11
|
+
* Vite's plugins (aliases, tsconfig paths) decide that in one place. It
|
|
12
|
+
* avoids loading Vite: Rolldown's parser, which Vite re-exports, is all the
|
|
13
|
+
* compiler needs, and Vite takes longer to import than a hundred compiles.
|
|
14
|
+
*/
|
|
15
|
+
const port = parentPort;
|
|
16
|
+
const send = (message) => port.postMessage(message);
|
|
17
|
+
/** Resolutions by importer directory and request, like the main thread's memo. */
|
|
18
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
19
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
20
|
+
let requests = 0;
|
|
21
|
+
const resolve = async (source, importer) => {
|
|
22
|
+
const key = `${path.dirname(importer)}\0${source}`;
|
|
23
|
+
let file = resolved.get(key);
|
|
24
|
+
if (!file) {
|
|
25
|
+
file = new Promise((done) => {
|
|
26
|
+
const request = requests++;
|
|
27
|
+
waiting.set(request, done);
|
|
28
|
+
send({
|
|
29
|
+
type: "resolve",
|
|
30
|
+
request,
|
|
31
|
+
source,
|
|
32
|
+
importer
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
resolved.set(key, file);
|
|
36
|
+
}
|
|
37
|
+
const id = await file;
|
|
38
|
+
return id ? { id } : null;
|
|
39
|
+
};
|
|
40
|
+
let configure;
|
|
41
|
+
const configured = new Promise((resolve) => configure = resolve);
|
|
42
|
+
const parser = rolldownParser().then((parse) => parse && setParser(parse));
|
|
43
|
+
const context = (async () => {
|
|
44
|
+
const setup = await configured;
|
|
45
|
+
await parser;
|
|
46
|
+
let system;
|
|
47
|
+
if ("data" in setup.config) system = resolveSystem(setup.config.data);
|
|
48
|
+
else {
|
|
49
|
+
const { loadSystem } = await import("./config-loader-pLzP9par.js");
|
|
50
|
+
system = (await loadSystem(setup.root, setup.config.file, () => {}, void 0, { native: true })).system;
|
|
51
|
+
if (configShape(system.config) === setup.config.shape) system = {
|
|
52
|
+
...system,
|
|
53
|
+
hash: setup.hash
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (system.hash !== setup.hash) throw new Error("the config resolves to another design system in a worker thread");
|
|
57
|
+
return {
|
|
58
|
+
system,
|
|
59
|
+
importSources: system.config.importSources ?? [],
|
|
60
|
+
parsed: createParseCache(),
|
|
61
|
+
sourceMap: setup.sourceMap,
|
|
62
|
+
root: setup.root,
|
|
63
|
+
package: setup.package,
|
|
64
|
+
dev: setup.dev,
|
|
65
|
+
placeholders: setup.placeholders,
|
|
66
|
+
frameworks: setup.frameworks
|
|
67
|
+
};
|
|
68
|
+
})();
|
|
69
|
+
context.then(() => send({ type: "ready" }), (error) => send({
|
|
70
|
+
type: "unavailable",
|
|
71
|
+
message: error instanceof Error ? error.message : String(error)
|
|
72
|
+
}));
|
|
73
|
+
port.on("message", (message) => {
|
|
74
|
+
if (message.type === "setup") {
|
|
75
|
+
configure(message.setup);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (message.type === "resolved") {
|
|
79
|
+
waiting.get(message.request)?.(message.file);
|
|
80
|
+
waiting.delete(message.request);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const { job, id, code, script } = message;
|
|
84
|
+
context.then((ctx) => compile(ctx, id, code, resolve, script)).then((result) => send({
|
|
85
|
+
type: "done",
|
|
86
|
+
job,
|
|
87
|
+
result
|
|
88
|
+
}), (error) => send({
|
|
89
|
+
type: "failed",
|
|
90
|
+
job,
|
|
91
|
+
error: toErrorData(error)
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Rolldown's `parseSync`, the function Vite re-exports: from Vite+'s bundled
|
|
96
|
+
* Rolldown, or from the Rolldown that Vite depends on. Undefined when neither
|
|
97
|
+
* is found; the compiler then loads Vite for it.
|
|
98
|
+
*/
|
|
99
|
+
async function rolldownParser() {
|
|
100
|
+
const loaders = [() => import(
|
|
101
|
+
/* @vite-ignore */
|
|
102
|
+
"vite/rolldown/utils"
|
|
103
|
+
), () => {
|
|
104
|
+
const vite = createRequire(import.meta.resolve("vite"));
|
|
105
|
+
return import(pathToFileURL(vite.resolve("rolldown/utils")).href);
|
|
106
|
+
}];
|
|
107
|
+
for (const load of loaders) try {
|
|
108
|
+
const utils = await load();
|
|
109
|
+
if (typeof utils.parseSync === "function") return utils.parseSync;
|
|
110
|
+
} catch {}
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@menapo/vicss",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Typed, design-system-first atomic CSS for Vite: style objects compiled to short hashed class names, recipes with slots and responsive variants, one order-proof stylesheet",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"atomic-css",
|
|
7
|
+
"css",
|
|
8
|
+
"css-in-js",
|
|
9
|
+
"design-system",
|
|
10
|
+
"design-tokens",
|
|
11
|
+
"eslint-plugin",
|
|
12
|
+
"oxlint-plugin",
|
|
13
|
+
"vite",
|
|
14
|
+
"vite-plugin",
|
|
15
|
+
"zero-runtime"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/menapo/vite-plugins/blob/main/packages/vicss/README.md",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/menapo/vite-plugins/issues"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/menapo/vite-plugins.git",
|
|
25
|
+
"directory": "packages/vicss"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"vicss": "./dist/cli.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"type": "module",
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"exports": {
|
|
36
|
+
".": "./dist/index.js",
|
|
37
|
+
"./config": "./dist/config.js",
|
|
38
|
+
"./lint": "./dist/lint.js",
|
|
39
|
+
"./vite": "./dist/vite.js",
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"typescript": "^7.0.2",
|
|
48
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
49
|
+
"vite-plus": "1.3.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"vite": "^8.3.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"vite": {
|
|
56
|
+
"optional": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=22.18.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "vp pack",
|
|
64
|
+
"dev": "vp pack --watch",
|
|
65
|
+
"check": "vp check",
|
|
66
|
+
"test": "vp test run",
|
|
67
|
+
"smoke:pack": "node scripts/smoke-pack.ts"
|
|
68
|
+
}
|
|
6
69
|
}
|