@master/create-css 2.0.0-rc.78 → 2.0.0-rc.80
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 +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -3
- package/dist/transforms.d.ts +5 -1
- package/dist/transforms.js +64 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ npx @master/create-css@rc add --json --minimal --eslint
|
|
|
55
55
|
Supported `--framework` values:
|
|
56
56
|
|
|
57
57
|
```txt
|
|
58
|
-
auto, vite, react, react-router, vue, nextjs, svelte, nuxt, astro, webpack, laravel, lit, angular, none
|
|
58
|
+
auto, vite, react, react-router, vue, nextjs, svelte, nuxt, astro, webpack, rspack, rsbuild, laravel, lit, angular, none
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
SvelteKit setup is delegated to the Svelte CLI add-on:
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/core.d.ts
|
|
2
|
-
type CommandFramework = 'none' | 'vite' | 'react' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'laravel' | 'lit' | 'angular';
|
|
2
|
+
type CommandFramework = 'none' | 'vite' | 'react' | 'react-router' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
|
|
3
3
|
type CommandFrameworkOption = CommandFramework | 'auto';
|
|
4
4
|
type CommandPackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
5
5
|
interface CommandOptions {
|
package/dist/core.js
CHANGED
|
@@ -15,7 +15,7 @@ const newProjectCommands = [
|
|
|
15
15
|
async function runProgram(argv = process.argv) {
|
|
16
16
|
const program = new Command();
|
|
17
17
|
program.name("create-css").description(pkg.description).version(pkg.version || "0.0.0");
|
|
18
|
-
const configure = (command) => command.option("-C, --cwd <path>", "Project root to update.").option("--framework <framework>", "Framework: auto, vite, react, react-router, vue, nextjs, svelte, nuxt, astro, webpack, laravel, lit, angular, none.", "auto").option("--eslint", "Add the Master CSS recommended ESLint flat config.").option("--no-eslint", "Skip the Master CSS recommended ESLint flat config.").option("--mcp", "Add the Master CSS MCP package and print the stdio registration command.").option("--no-mcp", "Skip the Master CSS MCP package and registration command.").option("--ai", "Add Master CSS guidance to AGENTS.md.").option("--no-ai", "Skip Master CSS guidance for coding agents.").option("--minimal", "Only add core Master CSS framework setup.").option("--install <package-manager>", "Run dependency installation with npm, pnpm, yarn, or bun after edits.").option("--no-install", "Do not run dependency installation.").option("--dry-run", "Print the setup plan without writing files.").option("--json", "Print machine-readable JSON.").option("-y, --yes", "Accept recommended defaults and run package installation with the detected package manager.");
|
|
18
|
+
const configure = (command) => command.option("-C, --cwd <path>", "Project root to update.").option("--framework <framework>", "Framework: auto, vite, react, react-router, vue, nextjs, svelte, nuxt, astro, webpack, rspack, rsbuild, laravel, lit, angular, none.", "auto").option("--eslint", "Add the Master CSS recommended ESLint flat config.").option("--no-eslint", "Skip the Master CSS recommended ESLint flat config.").option("--mcp", "Add the Master CSS MCP package and print the stdio registration command.").option("--no-mcp", "Skip the Master CSS MCP package and registration command.").option("--ai", "Add Master CSS guidance to AGENTS.md.").option("--no-ai", "Skip Master CSS guidance for coding agents.").option("--minimal", "Only add core Master CSS framework setup.").option("--install <package-manager>", "Run dependency installation with npm, pnpm, yarn, or bun after edits.").option("--no-install", "Do not run dependency installation.").option("--dry-run", "Print the setup plan without writing files.").option("--json", "Print machine-readable JSON.").option("-y, --yes", "Accept recommended defaults and run package installation with the detected package manager.");
|
|
19
19
|
configure(program).argument("[project name]", "Deprecated. The installer now updates the current project; use --cwd for another root.").action(async (projectName, options) => {
|
|
20
20
|
if (projectName && projectName !== "add") program.error(`Project scaffolding is not provided by @master/create-css. Create a Vite project first, then run the installer from the project root:\n\n${formatNewProjectCommands()}`);
|
|
21
21
|
await runAdd(options);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/index.d.ts
|
|
2
|
-
type Framework = 'none' | 'vite' | 'react' | 'react-router' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'laravel' | 'lit' | 'angular';
|
|
2
|
+
type Framework = 'none' | 'vite' | 'react' | 'react-router' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
|
|
3
3
|
type FrameworkOption = Framework | 'auto';
|
|
4
4
|
type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
5
5
|
type FileAction = 'create' | 'update' | 'skip';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AGENT_RULES_BLOCK, CANONICAL_ESLINT_CONFIG, MASTER_CSS_PACKAGES } from "./constants.js";
|
|
2
|
-
import { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createStaticViteConfig, createViteConfig } from "./transforms.js";
|
|
2
|
+
import { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig } from "./transforms.js";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
@@ -170,6 +170,19 @@ function filesForFramework(root, framework, warnings) {
|
|
|
170
170
|
else warnings.push("No src/main.ts file was found. Initialize CSSRuntime manually in the Angular browser entry after setup.");
|
|
171
171
|
return files;
|
|
172
172
|
}
|
|
173
|
+
case "rspack": return [planTextFile(root, firstExistingPath(root, [
|
|
174
|
+
"rspack.config.ts",
|
|
175
|
+
"rspack.config.mts",
|
|
176
|
+
"rspack.config.mjs",
|
|
177
|
+
"rspack.config.js",
|
|
178
|
+
"rspack.config.cjs"
|
|
179
|
+
], "rspack.config.mjs"), addMasterCSSRspackPlugin, createRspackConfig(), "Register the Master CSS Webpack-compatible plugin in the Rspack config."), planTextFile(root, "src/index.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the project CSS entry for Rspack.")];
|
|
180
|
+
case "rsbuild": return [planTextFile(root, firstExistingPath(root, [
|
|
181
|
+
"rsbuild.config.ts",
|
|
182
|
+
"rsbuild.config.mts",
|
|
183
|
+
"rsbuild.config.mjs",
|
|
184
|
+
"rsbuild.config.js"
|
|
185
|
+
], "rsbuild.config.ts"), addMasterCSSRsbuildPlugin, createRsbuildConfig(), "Register the Master CSS Webpack-compatible plugin through Rsbuild tools.rspack."), planTextFile(root, "src/index.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the project CSS entry for Rsbuild.")];
|
|
173
186
|
case "webpack": return [planTextFile(root, "src/index.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the project CSS entry for Webpack.")];
|
|
174
187
|
default: return [planTextFile(root, "src/master.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create a standalone Master CSS stylesheet entry.")];
|
|
175
188
|
}
|
|
@@ -200,7 +213,7 @@ function dependenciesForFramework(framework, version) {
|
|
|
200
213
|
version,
|
|
201
214
|
dev: false
|
|
202
215
|
});
|
|
203
|
-
if (framework === "webpack") dependencies.push({
|
|
216
|
+
if (framework === "webpack" || framework === "rspack" || framework === "rsbuild") dependencies.push({
|
|
204
217
|
name: MASTER_CSS_PACKAGES.webpack,
|
|
205
218
|
version,
|
|
206
219
|
dev: false
|
|
@@ -288,9 +301,11 @@ function resolveFramework(root, packageJSON, framework) {
|
|
|
288
301
|
if (existsSync(join(root, "astro.config.mjs")) || existsSync(join(root, "astro.config.js")) || dependencies.astro) return "astro";
|
|
289
302
|
if (existsSync(join(root, "angular.json")) || dependencies["@angular/core"]) return "angular";
|
|
290
303
|
if (dependencies["laravel-vite-plugin"] || existsSync(join(root, "artisan"))) return "laravel";
|
|
291
|
-
if (
|
|
304
|
+
if (existsSync(join(root, "rsbuild.config.ts")) || existsSync(join(root, "rsbuild.config.mts")) || existsSync(join(root, "rsbuild.config.mjs")) || existsSync(join(root, "rsbuild.config.js")) || dependencies["@rsbuild/core"]) return "rsbuild";
|
|
305
|
+
if (existsSync(join(root, "rspack.config.ts")) || existsSync(join(root, "rspack.config.mts")) || existsSync(join(root, "rspack.config.mjs")) || existsSync(join(root, "rspack.config.js")) || existsSync(join(root, "rspack.config.cjs")) || dependencies["@rspack/core"] || dependencies["@rspack/cli"]) return "rspack";
|
|
292
306
|
if (existsSync(join(root, "react-router.config.ts")) || existsSync(join(root, "react-router.config.js")) || existsSync(join(root, "react-router.config.mjs")) || existsSync(join(root, "react-router.config.mts")) || dependencies["@react-router/dev"]) return "react-router";
|
|
293
307
|
if (dependencies.vue || dependencies["@vitejs/plugin-vue"] || existsSync(join(root, "src/App.vue"))) return "vue";
|
|
308
|
+
if (dependencies.lit) return "lit";
|
|
294
309
|
if (dependencies.react || dependencies["react-dom"]) return "react";
|
|
295
310
|
if (existsSync(join(root, "webpack.config.js")) || existsSync(join(root, "webpack.config.mjs")) || dependencies.webpack) return "webpack";
|
|
296
311
|
if (existsSync(join(root, "vite.config.ts")) || existsSync(join(root, "vite.config.js")) || dependencies.vite) return "vite";
|
package/dist/transforms.d.ts
CHANGED
|
@@ -4,8 +4,12 @@ declare function createMasterCSSStylesheet(): string;
|
|
|
4
4
|
declare function addMasterCSSVitePlugin(content: string): string;
|
|
5
5
|
declare function addReactRouterRootCSSImport(content: string): string;
|
|
6
6
|
declare function addMasterCSSStaticVitePlugin(content: string): string;
|
|
7
|
+
declare function addMasterCSSRspackPlugin(content: string): string;
|
|
8
|
+
declare function addMasterCSSRsbuildPlugin(content: string): string;
|
|
7
9
|
declare function createViteConfig(): string;
|
|
8
10
|
declare function createStaticViteConfig(): string;
|
|
11
|
+
declare function createRspackConfig(): string;
|
|
12
|
+
declare function createRsbuildConfig(): string;
|
|
9
13
|
declare function createNextConfig(): string;
|
|
10
14
|
declare function addMasterCSSNextConfig(content: string): string;
|
|
11
15
|
declare function addMasterCSSNuxtModule(content: string): string;
|
|
@@ -17,4 +21,4 @@ declare function addLitShadowRuntime(content: string): string;
|
|
|
17
21
|
declare function addAngularRuntimeSetup(content: string): string;
|
|
18
22
|
declare function addMasterCSSEslintConfig(content: string): string;
|
|
19
23
|
//#endregion
|
|
20
|
-
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createStaticViteConfig, createViteConfig };
|
|
24
|
+
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
|
package/dist/transforms.js
CHANGED
|
@@ -31,6 +31,36 @@ function addReactRouterRootCSSImport(content) {
|
|
|
31
31
|
function addMasterCSSStaticVitePlugin(content) {
|
|
32
32
|
return addMasterCSSVitePluginCall(content, "masterCSS({ mode: 'static' })");
|
|
33
33
|
}
|
|
34
|
+
function addMasterCSSRspackPlugin(content) {
|
|
35
|
+
if (content.includes("@master/css.webpack")) return content;
|
|
36
|
+
let next = addImport(content, "import MasterCSSPlugin from '@master/css.webpack'");
|
|
37
|
+
if (/plugins\s*:\s*\[/.test(next)) return replaceFirst(next, /plugins\s*:\s*\[/, "plugins: [\n new MasterCSSPlugin(),");
|
|
38
|
+
if (/export\s+default\s+\{/.test(next)) return replaceFirst(next, /export\s+default\s+\{/, "export default {\n plugins: [new MasterCSSPlugin()],");
|
|
39
|
+
return next;
|
|
40
|
+
}
|
|
41
|
+
function addMasterCSSRsbuildPlugin(content) {
|
|
42
|
+
if (content.includes("@master/css.webpack")) return content;
|
|
43
|
+
let next = addImport(content, "import MasterCSSPlugin from '@master/css.webpack'");
|
|
44
|
+
const rspackSetupBody = ` config.plugins ||= []
|
|
45
|
+
config.plugins.push(new MasterCSSPlugin())
|
|
46
|
+
return config`;
|
|
47
|
+
const rspackSetup = `rspack(config) {
|
|
48
|
+
${rspackSetupBody}
|
|
49
|
+
}`;
|
|
50
|
+
if (/rspack\s*\(\s*config\s*\)\s*\{/.test(next)) return replaceFirst(next, /rspack\s*\(\s*config\s*\)\s*\{/, `rspack(config) {
|
|
51
|
+
${rspackSetupBody}`);
|
|
52
|
+
if (/tools\s*:\s*\{/.test(next)) return replaceFirst(next, /tools\s*:\s*\{/, `tools: {
|
|
53
|
+
${rspackSetup},`);
|
|
54
|
+
if (/defineConfig\(\s*\{/.test(next)) return replaceFirst(next, /defineConfig\(\s*\{/, `defineConfig({
|
|
55
|
+
tools: {
|
|
56
|
+
${rspackSetup}
|
|
57
|
+
},`);
|
|
58
|
+
if (/export\s+default\s+\{/.test(next)) return replaceFirst(next, /export\s+default\s+\{/, `export default {
|
|
59
|
+
tools: {
|
|
60
|
+
${rspackSetup}
|
|
61
|
+
},`);
|
|
62
|
+
return next;
|
|
63
|
+
}
|
|
34
64
|
function addMasterCSSVitePluginCall(content, pluginCall) {
|
|
35
65
|
if (content.includes("@master/css.vite")) return content;
|
|
36
66
|
let next = addImport(content, "import masterCSS from '@master/css.vite'");
|
|
@@ -60,6 +90,39 @@ export default defineConfig({
|
|
|
60
90
|
})
|
|
61
91
|
`;
|
|
62
92
|
}
|
|
93
|
+
function createRspackConfig() {
|
|
94
|
+
return `import MasterCSSPlugin from '@master/css.webpack'
|
|
95
|
+
|
|
96
|
+
export default {
|
|
97
|
+
module: {
|
|
98
|
+
rules: [
|
|
99
|
+
{
|
|
100
|
+
test: /\\.css$/i,
|
|
101
|
+
type: 'css/auto'
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
plugins: [
|
|
106
|
+
new MasterCSSPlugin()
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
function createRsbuildConfig() {
|
|
112
|
+
return `import { defineConfig } from '@rsbuild/core'
|
|
113
|
+
import MasterCSSPlugin from '@master/css.webpack'
|
|
114
|
+
|
|
115
|
+
export default defineConfig({
|
|
116
|
+
tools: {
|
|
117
|
+
rspack(config) {
|
|
118
|
+
config.plugins ||= []
|
|
119
|
+
config.plugins.push(new MasterCSSPlugin())
|
|
120
|
+
return config
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
63
126
|
function createNextConfig() {
|
|
64
127
|
return `import { withMasterCSS } from '@master/css.next'
|
|
65
128
|
|
|
@@ -166,4 +229,4 @@ function addMasterCSSEslintConfig(content) {
|
|
|
166
229
|
`;
|
|
167
230
|
}
|
|
168
231
|
//#endregion
|
|
169
|
-
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createStaticViteConfig, createViteConfig };
|
|
232
|
+
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
|
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"commander": "^14.0.3"
|
|
43
43
|
},
|
|
44
|
-
"version": "2.0.0-rc.
|
|
44
|
+
"version": "2.0.0-rc.80",
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsdown --config ../../shared/tsdown-package.config.ts",
|
|
47
47
|
"dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",
|