@master/create-css 2.0.0-rc.80 → 2.0.0-rc.81
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/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -2
- package/dist/transforms.d.ts +3 -1
- package/dist/transforms.js +19 -3
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/core.d.ts
|
|
2
|
-
type CommandFramework = 'none' | 'vite' | 'react' | 'react-router' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
|
|
2
|
+
type CommandFramework = 'none' | 'vite' | 'react' | 'react-router' | 'tanstack-start' | '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, 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.");
|
|
18
|
+
const configure = (command) => command.option("-C, --cwd <path>", "Project root to update.").option("--framework <framework>", "Framework: auto, vite, react, react-router, tanstack-start, 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' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
|
|
2
|
+
type Framework = 'none' | 'vite' | 'react' | 'react-router' | 'tanstack-start' | '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, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig } from "./transforms.js";
|
|
2
|
+
import { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSTanStackStartVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addTanStackStartRootCSSImport, 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";
|
|
@@ -119,6 +119,22 @@ function filesForFramework(root, framework, warnings) {
|
|
|
119
119
|
else warnings.push("No app/root.tsx, app/root.jsx, app/root.ts, or app/root.js file was found. Import ./app.css from the React Router root route manually after setup.");
|
|
120
120
|
return files;
|
|
121
121
|
}
|
|
122
|
+
case "tanstack-start": {
|
|
123
|
+
const files = [planTextFile(root, firstExistingPath(root, [
|
|
124
|
+
"vite.config.ts",
|
|
125
|
+
"vite.config.js",
|
|
126
|
+
"vite.config.mjs"
|
|
127
|
+
], "vite.config.ts"), addMasterCSSTanStackStartVitePlugin, createStaticViteConfig(), "Register the Master CSS Vite plugin in static mode."), planTextFile(root, "src/styles/app.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the TanStack Start stylesheet entry.")];
|
|
128
|
+
const rootEntryPath = findExistingPath(root, [
|
|
129
|
+
"src/routes/__root.tsx",
|
|
130
|
+
"src/routes/__root.jsx",
|
|
131
|
+
"src/routes/__root.ts",
|
|
132
|
+
"src/routes/__root.js"
|
|
133
|
+
]);
|
|
134
|
+
if (rootEntryPath) files.push(planTextFile(root, rootEntryPath, addTanStackStartRootCSSImport, "", "Import the TanStack Start stylesheet from the root route."));
|
|
135
|
+
else warnings.push("No src/routes/__root.tsx, src/routes/__root.jsx, src/routes/__root.ts, or src/routes/__root.js file was found. Import ../styles/app.css from the TanStack Start root route manually after setup.");
|
|
136
|
+
return files;
|
|
137
|
+
}
|
|
122
138
|
case "vue": return [planTextFile(root, firstExistingPath(root, [
|
|
123
139
|
"vite.config.ts",
|
|
124
140
|
"vite.config.js",
|
|
@@ -193,7 +209,7 @@ function dependenciesForFramework(framework, version) {
|
|
|
193
209
|
version,
|
|
194
210
|
dev: false
|
|
195
211
|
}];
|
|
196
|
-
if (framework === "vite" || framework === "react" || framework === "react-router" || framework === "vue" || framework === "laravel" || framework === "lit") dependencies.push({
|
|
212
|
+
if (framework === "vite" || framework === "react" || framework === "react-router" || framework === "tanstack-start" || framework === "vue" || framework === "laravel" || framework === "lit") dependencies.push({
|
|
197
213
|
name: MASTER_CSS_PACKAGES.vite,
|
|
198
214
|
version,
|
|
199
215
|
dev: false
|
|
@@ -304,6 +320,7 @@ function resolveFramework(root, packageJSON, framework) {
|
|
|
304
320
|
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
321
|
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";
|
|
306
322
|
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";
|
|
323
|
+
if (dependencies["@tanstack/react-start"]) return "tanstack-start";
|
|
307
324
|
if (dependencies.vue || dependencies["@vitejs/plugin-vue"] || existsSync(join(root, "src/App.vue"))) return "vue";
|
|
308
325
|
if (dependencies.lit) return "lit";
|
|
309
326
|
if (dependencies.react || dependencies["react-dom"]) return "react";
|
package/dist/transforms.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ declare function addMasterCSSImportToStylesheet(content: string): string;
|
|
|
3
3
|
declare function createMasterCSSStylesheet(): string;
|
|
4
4
|
declare function addMasterCSSVitePlugin(content: string): string;
|
|
5
5
|
declare function addReactRouterRootCSSImport(content: string): string;
|
|
6
|
+
declare function addTanStackStartRootCSSImport(content: string): string;
|
|
6
7
|
declare function addMasterCSSStaticVitePlugin(content: string): string;
|
|
8
|
+
declare function addMasterCSSTanStackStartVitePlugin(content: string): string;
|
|
7
9
|
declare function addMasterCSSRspackPlugin(content: string): string;
|
|
8
10
|
declare function addMasterCSSRsbuildPlugin(content: string): string;
|
|
9
11
|
declare function createViteConfig(): string;
|
|
@@ -21,4 +23,4 @@ declare function addLitShadowRuntime(content: string): string;
|
|
|
21
23
|
declare function addAngularRuntimeSetup(content: string): string;
|
|
22
24
|
declare function addMasterCSSEslintConfig(content: string): string;
|
|
23
25
|
//#endregion
|
|
24
|
-
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
|
|
26
|
+
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSTanStackStartVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addTanStackStartRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
|
package/dist/transforms.js
CHANGED
|
@@ -28,9 +28,25 @@ function addReactRouterRootCSSImport(content) {
|
|
|
28
28
|
if (/^\s*import\s+['"]\.\/app\.css['"]\s*;?/m.test(content)) return content;
|
|
29
29
|
return addImport(content, "import './app.css'");
|
|
30
30
|
}
|
|
31
|
+
function addTanStackStartRootCSSImport(content) {
|
|
32
|
+
if (/^\s*import\s+['"]\.\.\/styles\/app\.css['"]\s*;?/m.test(content)) return content;
|
|
33
|
+
return addImport(content, "import '../styles/app.css'");
|
|
34
|
+
}
|
|
31
35
|
function addMasterCSSStaticVitePlugin(content) {
|
|
32
36
|
return addMasterCSSVitePluginCall(content, "masterCSS({ mode: 'static' })");
|
|
33
37
|
}
|
|
38
|
+
function addMasterCSSTanStackStartVitePlugin(content) {
|
|
39
|
+
const pluginCall = "masterCSS({ mode: 'static' })";
|
|
40
|
+
if (content.includes("@master/css.vite")) return content;
|
|
41
|
+
let next = addImport(content, "import masterCSS from '@master/css.vite'");
|
|
42
|
+
const tanStackStartPluginPattern = /^(\s*)tanstackStart\([^)]*\),?/m;
|
|
43
|
+
if (tanStackStartPluginPattern.test(next)) return next.replace(tanStackStartPluginPattern, (match, indent) => {
|
|
44
|
+
return `${match.endsWith(",") ? match : `${match},`}\n${indent}${pluginCall},`;
|
|
45
|
+
});
|
|
46
|
+
if (/plugins\s*:\s*\[/.test(next)) return replaceFirst(next, /plugins\s*:\s*\[/, `plugins: [\n ${pluginCall},`);
|
|
47
|
+
if (/defineConfig\(\s*\{/.test(next)) return replaceFirst(next, /defineConfig\(\s*\{/, `defineConfig({\n plugins: [${pluginCall}],`);
|
|
48
|
+
return next;
|
|
49
|
+
}
|
|
34
50
|
function addMasterCSSRspackPlugin(content) {
|
|
35
51
|
if (content.includes("@master/css.webpack")) return content;
|
|
36
52
|
let next = addImport(content, "import MasterCSSPlugin from '@master/css.webpack'");
|
|
@@ -185,7 +201,7 @@ function addViteClientTypes(content) {
|
|
|
185
201
|
function addLitShadowRuntime(content) {
|
|
186
202
|
if (content.includes("@master/css-runtime") && content.includes("virtual:master-css-manifest") && content.includes("@cssRuntime({ manifest, emittedGlobals })") && content.includes("cssRuntime?: CSSRuntime")) return content;
|
|
187
203
|
let next = addImport(content, "import { cssRuntime } from '@master/css-runtime'");
|
|
188
|
-
next = addImport(next, "import type
|
|
204
|
+
next = addImport(next, "import type CSSRuntime from '@master/css-runtime'");
|
|
189
205
|
next = addImport(next, "import manifest from 'virtual:master-css-manifest'");
|
|
190
206
|
next = addImport(next, "import emittedGlobals from 'virtual:master-css-emitted-globals'");
|
|
191
207
|
if (!next.includes("@cssRuntime({ manifest, emittedGlobals })")) if (/@customElement\([^\n]+\)\nexport\s+class\s/.test(next)) next = next.replace(/(@customElement\([^\n]+\)\n)(export\s+class\s)/, "$1@cssRuntime({ manifest, emittedGlobals })\n$2");
|
|
@@ -196,7 +212,7 @@ function addLitShadowRuntime(content) {
|
|
|
196
212
|
function addAngularRuntimeSetup(content) {
|
|
197
213
|
if (content.includes("@master/css-runtime")) return content;
|
|
198
214
|
let next = addImport(content, "import defaultManifestJSON from '@master/css-preset/default-manifest.json'");
|
|
199
|
-
next = addImport(next, "import
|
|
215
|
+
next = addImport(next, "import CSSRuntime from '@master/css-runtime'");
|
|
200
216
|
next = addImport(next, "import type { MasterCSSManifest } from '@master/css-runtime'");
|
|
201
217
|
const setup = `const defaultManifest = defaultManifestJSON as unknown as MasterCSSManifest
|
|
202
218
|
|
|
@@ -229,4 +245,4 @@ function addMasterCSSEslintConfig(content) {
|
|
|
229
245
|
`;
|
|
230
246
|
}
|
|
231
247
|
//#endregion
|
|
232
|
-
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
|
|
248
|
+
export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSTanStackStartVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addTanStackStartRootCSSImport, 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.81",
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsdown --config ../../shared/tsdown-package.config.ts",
|
|
47
47
|
"dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",
|