@master/create-css 2.0.0-rc.80 → 2.0.0-rc.82

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 CHANGED
@@ -26,6 +26,14 @@ Without `--yes`, TTY sessions ask about ESLint, MCP, AI guidance, and dependency
26
26
 
27
27
  Use `--minimal` for core framework setup only, or disable individual recommended integrations with `--no-eslint`, `--no-mcp`, or `--no-ai`.
28
28
 
29
+ Use `--mode <mode>` when the framework integration should be configured for a specific rendering mode during setup:
30
+
31
+ ```bash
32
+ npm create @master/css@rc -- --framework nextjs --mode static --yes
33
+ ```
34
+
35
+ Supported `--mode` values are `runtime`, `static`, `progressive`, and `pre-render`. Mode setup is supported for `vite`, `react`, `react-router`, `tanstack-start`, `vue`, `nextjs`, `nuxt`, `astro`, `webpack`, `rspack`, `rsbuild`, `laravel`, and `lit`; Laravel supports `static` only.
36
+
29
37
  If you do not have a project yet, create one first:
30
38
 
31
39
  ```bash
@@ -52,10 +60,18 @@ npx @master/create-css@rc add --no-mcp --no-ai
52
60
  npx @master/create-css@rc add --json --minimal --eslint
53
61
  ```
54
62
 
63
+ ```bash
64
+ npx @master/create-css@rc add --framework nextjs --mode runtime --yes
65
+ ```
66
+
67
+ ```bash
68
+ npx @master/create-css@rc add --framework webpack --mode static --yes
69
+ ```
70
+
55
71
  Supported `--framework` values:
56
72
 
57
73
  ```txt
58
- auto, vite, react, react-router, vue, nextjs, svelte, nuxt, astro, webpack, rspack, rsbuild, laravel, lit, angular, none
74
+ auto, vite, react, react-router, tanstack-start, vue, nextjs, svelte, nuxt, astro, webpack, rspack, rsbuild, laravel, lit, angular, none
59
75
  ```
60
76
 
61
77
  SvelteKit setup is delegated to the Svelte CLI add-on:
package/dist/core.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { RenderingMode } from "./modes.js";
2
+
1
3
  //#region src/core.d.ts
2
- type CommandFramework = 'none' | 'vite' | 'react' | 'react-router' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
4
+ type CommandFramework = 'none' | 'vite' | 'react' | 'react-router' | 'tanstack-start' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
3
5
  type CommandFrameworkOption = CommandFramework | 'auto';
4
6
  type CommandPackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
5
7
  interface CommandOptions {
@@ -13,6 +15,7 @@ interface CommandOptions {
13
15
  dryRun?: boolean;
14
16
  json?: boolean;
15
17
  yes?: boolean;
18
+ mode?: RenderingMode;
16
19
  }
17
20
  type InstallResolution = CommandPackageManager | false | 'detected' | undefined;
18
21
  type PromptQuestion = (question: string) => Promise<string>;
package/dist/core.js CHANGED
@@ -1,9 +1,10 @@
1
+ import { formatRenderingModes, isRenderingMode } from "./modes.js";
1
2
  import { applySetupPlan, createSetupPlan } from "./index.js";
2
3
  import { existsSync, readFileSync } from "node:fs";
3
4
  import { dirname, join, resolve } from "node:path";
4
5
  import { createInterface } from "node:readline/promises";
5
6
  import { fileURLToPath } from "node:url";
6
- import { Command } from "commander";
7
+ import { Command, InvalidArgumentError } from "commander";
7
8
  //#region src/core.ts
8
9
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
10
  const pkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf8"));
@@ -15,7 +16,7 @@ const newProjectCommands = [
15
16
  async function runProgram(argv = process.argv) {
16
17
  const program = new Command();
17
18
  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.");
19
+ 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("--mode <mode>", `Rendering mode: ${formatRenderingModes()}.`, parseRenderingModeOption).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
20
  configure(program).argument("[project name]", "Deprecated. The installer now updates the current project; use --cwd for another root.").action(async (projectName, options) => {
20
21
  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
22
  await runAdd(options);
@@ -37,14 +38,16 @@ async function runAdd(options) {
37
38
  prompt?.close();
38
39
  }
39
40
  const planInstall = resolvedOptions.install === "detected" ? void 0 : resolvedOptions.install;
40
- const plan = createSetupPlan({
41
+ const plan = createCommandSetupPlan({
41
42
  root,
42
43
  framework: options.framework,
43
44
  eslint: resolvedOptions.eslint,
44
45
  mcp: resolvedOptions.mcp,
45
46
  ai: resolvedOptions.ai,
46
- install: planInstall
47
+ install: planInstall,
48
+ mode: options.mode
47
49
  });
50
+ if (!plan) return;
48
51
  if (options.dryRun || options.json) {
49
52
  process.stdout.write(`${JSON.stringify(plan, null, 2)}\n`);
50
53
  return;
@@ -52,6 +55,18 @@ async function runAdd(options) {
52
55
  applySetupPlan(plan, { install: resolvedOptions.install === "detected" ? plan.packageManager : resolvedOptions.install });
53
56
  if (!options.json) printSummary(plan);
54
57
  }
58
+ function createCommandSetupPlan(options) {
59
+ try {
60
+ return createSetupPlan(options);
61
+ } catch (error) {
62
+ if (error instanceof Error) {
63
+ process.stderr.write(`${error.message}\n`);
64
+ process.exitCode = 1;
65
+ return;
66
+ }
67
+ throw error;
68
+ }
69
+ }
55
70
  async function resolveCommandOptions(options, prompt) {
56
71
  const question = options.yes ? void 0 : prompt;
57
72
  return {
@@ -83,6 +98,10 @@ async function confirm(question, prompt) {
83
98
  function shouldPrompt(options) {
84
99
  return !options.yes && !options.json && !options.dryRun && Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
85
100
  }
101
+ function parseRenderingModeOption(value) {
102
+ if (isRenderingMode(value)) return value;
103
+ throw new InvalidArgumentError(`Invalid rendering mode "${value}". Supported modes: ${formatRenderingModes()}.`);
104
+ }
86
105
  function createTTYPrompt() {
87
106
  const input = process.stdin;
88
107
  const output = process.stdout;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { RenderingMode } from "./modes.js";
2
+
1
3
  //#region src/index.d.ts
2
- type Framework = 'none' | 'vite' | 'react' | 'react-router' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
4
+ type Framework = 'none' | 'vite' | 'react' | 'react-router' | 'tanstack-start' | 'vue' | 'nextjs' | 'svelte' | 'nuxt' | 'astro' | 'webpack' | 'rspack' | 'rsbuild' | 'laravel' | 'lit' | 'angular';
3
5
  type FrameworkOption = Framework | 'auto';
4
6
  type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
5
7
  type FileAction = 'create' | 'update' | 'skip';
@@ -13,6 +15,7 @@ interface SetupOptions {
13
15
  install?: PackageManager | false;
14
16
  yes?: boolean;
15
17
  packageTag?: string;
18
+ mode?: RenderingMode;
16
19
  }
17
20
  interface PlannedDependency {
18
21
  name: string;
@@ -38,6 +41,7 @@ interface SetupPlan {
38
41
  files: PlannedFileChange[];
39
42
  commands: PlannedCommand[];
40
43
  warnings: string[];
44
+ mode?: RenderingMode;
41
45
  summary: {
42
46
  dependencies: number;
43
47
  filesToCreate: number;
@@ -50,4 +54,4 @@ declare function createSetupPlan(options?: SetupOptions): SetupPlan;
50
54
  declare function applySetupPlan(plan: SetupPlan, options?: SetupOptions): void;
51
55
  declare function applySetup(options?: SetupOptions): SetupPlan;
52
56
  //#endregion
53
- export { FileAction, Framework, FrameworkOption, PackageManager, PlannedCommand, PlannedDependency, PlannedFileChange, SetupOptions, SetupPlan, applySetup, applySetupPlan, createSetupPlan };
57
+ export { FileAction, Framework, FrameworkOption, PackageManager, PlannedCommand, PlannedDependency, PlannedFileChange, type RenderingMode, SetupOptions, SetupPlan, applySetup, applySetupPlan, createSetupPlan };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
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 { resolveRenderingMode } from "./modes.js";
3
+ import { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSTanStackStartVitePlugin, addMasterCSSVitePlugin, addMasterCSSWebpackPlugin, addReactRouterRootCSSImport, addTanStackStartRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig, createWebpackConfig } from "./transforms.js";
3
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
5
  import { dirname, join, resolve } from "node:path";
5
6
  import { spawnSync } from "node:child_process";
@@ -15,6 +16,8 @@ function createSetupPlan(options = {}) {
15
16
  const packageJSON = readPackageJSON(root);
16
17
  const packageManager = resolvePackageManager(root, packageJSON, options.install || void 0);
17
18
  const framework = resolveFramework(root, packageJSON, options.framework || "auto");
19
+ const mode = resolveRenderingMode(options.mode);
20
+ assertFrameworkSupportsMode(framework, mode);
18
21
  const version = options.packageTag || "rc";
19
22
  const eslint = resolveRecommendedOption(options.eslint, options.minimal);
20
23
  const mcp = resolveRecommendedOption(options.mcp, options.minimal);
@@ -29,7 +32,7 @@ function createSetupPlan(options = {}) {
29
32
  });
30
33
  else {
31
34
  for (const dependency of dependenciesForFramework(framework, version)) pushDependency(dependencies, dependency.name, dependency.dev, dependency.version);
32
- files.push(...filesForFramework(root, framework, warnings));
35
+ files.push(...filesForFramework(root, framework, warnings, mode));
33
36
  }
34
37
  if (eslint) {
35
38
  pushDependency(dependencies, MASTER_CSS_PACKAGES.eslintConfig, true, version);
@@ -55,6 +58,7 @@ function createSetupPlan(options = {}) {
55
58
  files,
56
59
  commands,
57
60
  warnings,
61
+ ...mode ? { mode } : {},
58
62
  summary: {
59
63
  dependencies: dependencies.length,
60
64
  filesToCreate: files.filter((file) => file.action === "create").length,
@@ -87,13 +91,13 @@ function applySetup(options = {}) {
87
91
  applySetupPlan(plan, options);
88
92
  return plan;
89
93
  }
90
- function filesForFramework(root, framework, warnings) {
94
+ function filesForFramework(root, framework, warnings, mode) {
91
95
  switch (framework) {
92
96
  case "vite": return [planTextFile(root, firstExistingPath(root, [
93
97
  "vite.config.ts",
94
98
  "vite.config.js",
95
99
  "vite.config.mjs"
96
- ], "vite.config.js"), addMasterCSSVitePlugin, createViteConfig(), "Register the Master CSS Vite plugin."), planTextFile(root, firstExistingPath(root, [
100
+ ], "vite.config.js"), (content) => addMasterCSSVitePlugin(content, mode), createViteConfig(mode), "Register the Master CSS Vite plugin."), planTextFile(root, firstExistingPath(root, [
97
101
  "src/style.css",
98
102
  "src/index.css",
99
103
  "src/main.css"
@@ -102,13 +106,13 @@ function filesForFramework(root, framework, warnings) {
102
106
  "vite.config.ts",
103
107
  "vite.config.js",
104
108
  "vite.config.mjs"
105
- ], "vite.config.js"), addMasterCSSVitePlugin, createViteConfig(), "Register the Master CSS Vite plugin."), planTextFile(root, firstExistingPath(root, ["src/index.css", "src/style.css"], "src/index.css"), addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the React project CSS entry.")];
109
+ ], "vite.config.js"), (content) => addMasterCSSVitePlugin(content, mode), createViteConfig(mode), "Register the Master CSS Vite plugin."), planTextFile(root, firstExistingPath(root, ["src/index.css", "src/style.css"], "src/index.css"), addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the React project CSS entry.")];
106
110
  case "react-router": {
107
111
  const files = [planTextFile(root, firstExistingPath(root, [
108
112
  "vite.config.ts",
109
113
  "vite.config.js",
110
114
  "vite.config.mjs"
111
- ], "vite.config.ts"), addMasterCSSVitePlugin, createViteConfig(), "Register the Master CSS Vite plugin."), planTextFile(root, "app/app.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the React Router app stylesheet entry.")];
115
+ ], "vite.config.ts"), (content) => addMasterCSSVitePlugin(content, mode), createViteConfig(mode), "Register the Master CSS Vite plugin."), planTextFile(root, "app/app.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the React Router app stylesheet entry.")];
112
116
  const rootEntryPath = findExistingPath(root, [
113
117
  "app/root.tsx",
114
118
  "app/root.jsx",
@@ -119,11 +123,28 @@ function filesForFramework(root, framework, warnings) {
119
123
  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
124
  return files;
121
125
  }
126
+ case "tanstack-start": {
127
+ const pluginMode = mode ?? "static";
128
+ const files = [planTextFile(root, firstExistingPath(root, [
129
+ "vite.config.ts",
130
+ "vite.config.js",
131
+ "vite.config.mjs"
132
+ ], "vite.config.ts"), (content) => addMasterCSSTanStackStartVitePlugin(content, pluginMode), createViteConfig(pluginMode), `Register the Master CSS Vite plugin in ${pluginMode} mode.`), planTextFile(root, "src/styles/app.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the TanStack Start stylesheet entry.")];
133
+ const rootEntryPath = findExistingPath(root, [
134
+ "src/routes/__root.tsx",
135
+ "src/routes/__root.jsx",
136
+ "src/routes/__root.ts",
137
+ "src/routes/__root.js"
138
+ ]);
139
+ if (rootEntryPath) files.push(planTextFile(root, rootEntryPath, addTanStackStartRootCSSImport, "", "Import the TanStack Start stylesheet from the root route."));
140
+ 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.");
141
+ return files;
142
+ }
122
143
  case "vue": return [planTextFile(root, firstExistingPath(root, [
123
144
  "vite.config.ts",
124
145
  "vite.config.js",
125
146
  "vite.config.mjs"
126
- ], "vite.config.ts"), addMasterCSSVitePlugin, createViteConfig(), "Register the Master CSS Vite plugin."), planTextFile(root, firstExistingPath(root, [
147
+ ], "vite.config.ts"), (content) => addMasterCSSVitePlugin(content, mode), createViteConfig(mode), "Register the Master CSS Vite plugin."), planTextFile(root, firstExistingPath(root, [
127
148
  "src/assets/main.css",
128
149
  "src/style.css",
129
150
  "src/main.css"
@@ -132,13 +153,13 @@ function filesForFramework(root, framework, warnings) {
132
153
  "next.config.ts",
133
154
  "next.config.mjs",
134
155
  "next.config.js"
135
- ], "next.config.js"), addMasterCSSNextConfig, createNextConfig(), "Register the Master CSS Next.js adapter."), planTextFile(root, "app/globals.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the Next.js global stylesheet entry.")];
136
- case "nuxt": return [planTextFile(root, firstExistingPath(root, ["nuxt.config.ts", "nuxt.config.js"], "nuxt.config.ts"), addMasterCSSNuxtModule, createNuxtConfig(), "Register the Master CSS Nuxt module."), planTextFile(root, "assets/css/master.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create the Nuxt CSS entry referenced by nuxt.config.")];
156
+ ], "next.config.js"), (content) => addMasterCSSNextConfig(content, mode), createNextConfig(mode), "Register the Master CSS Next.js adapter."), planTextFile(root, "app/globals.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the Next.js global stylesheet entry.")];
157
+ case "nuxt": return [planTextFile(root, firstExistingPath(root, ["nuxt.config.ts", "nuxt.config.js"], "nuxt.config.ts"), (content) => addMasterCSSNuxtModule(content, mode), createNuxtConfig(mode), "Register the Master CSS Nuxt module."), planTextFile(root, "assets/css/master.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create the Nuxt CSS entry referenced by nuxt.config.")];
137
158
  case "astro": return [planTextFile(root, firstExistingPath(root, [
138
159
  "astro.config.mjs",
139
160
  "astro.config.js",
140
161
  "astro.config.ts"
141
- ], "astro.config.mjs"), addMasterCSSAstroIntegration, createAstroConfig(), "Register the Master CSS Astro integration."), planTextFile(root, "src/styles/global.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create the Astro project CSS entry.")];
162
+ ], "astro.config.mjs"), (content) => addMasterCSSAstroIntegration(content, mode), createAstroConfig(mode), "Register the Master CSS Astro integration."), planTextFile(root, "src/styles/global.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create the Astro project CSS entry.")];
142
163
  case "laravel": {
143
164
  const viteConfigPath = findExistingPath(root, ["vite.config.ts", "vite.config.js"]);
144
165
  const files = [planTextFile(root, "resources/css/app.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the Laravel Vite CSS entry.")];
@@ -152,7 +173,7 @@ function filesForFramework(root, framework, warnings) {
152
173
  "vite.config.ts",
153
174
  "vite.config.js",
154
175
  "vite.config.mjs"
155
- ], "vite.config.ts"), addMasterCSSVitePlugin, createViteConfig(), "Register the Master CSS Vite plugin."),
176
+ ], "vite.config.ts"), (content) => addMasterCSSVitePlugin(content, mode), createViteConfig(mode), "Register the Master CSS Vite plugin."),
156
177
  planTextFile(root, "src/index.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the Lit project CSS entry."),
157
178
  planTextFile(root, "src/vite-env.d.ts", addViteClientTypes, `/// <reference types="vite/client" />
158
179
  /// <reference types="@master/css-integration/client" />
@@ -176,24 +197,38 @@ function filesForFramework(root, framework, warnings) {
176
197
  "rspack.config.mjs",
177
198
  "rspack.config.js",
178
199
  "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.")];
200
+ ], "rspack.config.mjs"), (content) => addMasterCSSRspackPlugin(content, mode), createRspackConfig(mode), "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
201
  case "rsbuild": return [planTextFile(root, firstExistingPath(root, [
181
202
  "rsbuild.config.ts",
182
203
  "rsbuild.config.mts",
183
204
  "rsbuild.config.mjs",
184
205
  "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.")];
186
- case "webpack": return [planTextFile(root, "src/index.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the project CSS entry for Webpack.")];
206
+ ], "rsbuild.config.ts"), (content) => addMasterCSSRsbuildPlugin(content, mode), createRsbuildConfig(mode), "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.")];
207
+ case "webpack": return [planTextFile(root, firstExistingPath(root, [
208
+ "webpack.config.ts",
209
+ "webpack.config.mts",
210
+ "webpack.config.mjs",
211
+ "webpack.config.js",
212
+ "webpack.config.cjs"
213
+ ], "webpack.config.mjs"), (content) => addMasterCSSWebpackPlugin(content, mode), createWebpackConfig(mode), "Register the Master CSS Webpack plugin."), planTextFile(root, "src/index.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create or update the project CSS entry for Webpack.")];
187
214
  default: return [planTextFile(root, "src/master.css", addMasterCSSImportToStylesheet, createMasterCSSStylesheet(), "Create a standalone Master CSS stylesheet entry.")];
188
215
  }
189
216
  }
217
+ function assertFrameworkSupportsMode(framework, mode) {
218
+ if (!mode) return;
219
+ if (framework === "laravel") {
220
+ if (mode === "static") return;
221
+ throw new Error(`--mode ${mode} is not supported for laravel. The Laravel installer only supports --mode static.`);
222
+ }
223
+ if (framework === "angular" || framework === "svelte" || framework === "none") throw new Error(`--mode is not supported for ${framework}. Supported frameworks: vite, react, react-router, tanstack-start, vue, nextjs, nuxt, astro, webpack, rspack, rsbuild, laravel, lit.`);
224
+ }
190
225
  function dependenciesForFramework(framework, version) {
191
226
  const dependencies = [{
192
227
  name: MASTER_CSS_PACKAGES.css,
193
228
  version,
194
229
  dev: false
195
230
  }];
196
- if (framework === "vite" || framework === "react" || framework === "react-router" || framework === "vue" || framework === "laravel" || framework === "lit") dependencies.push({
231
+ if (framework === "vite" || framework === "react" || framework === "react-router" || framework === "tanstack-start" || framework === "vue" || framework === "laravel" || framework === "lit") dependencies.push({
197
232
  name: MASTER_CSS_PACKAGES.vite,
198
233
  version,
199
234
  dev: false
@@ -295,6 +330,7 @@ function resolveFramework(root, packageJSON, framework) {
295
330
  ...packageJSON?.dependencies,
296
331
  ...packageJSON?.devDependencies
297
332
  };
333
+ const hasWebpackConfig = existsSync(join(root, "webpack.config.ts")) || existsSync(join(root, "webpack.config.mts")) || existsSync(join(root, "webpack.config.mjs")) || existsSync(join(root, "webpack.config.js")) || existsSync(join(root, "webpack.config.cjs"));
298
334
  if (existsSync(join(root, "next.config.js")) || existsSync(join(root, "next.config.mjs")) || existsSync(join(root, "next.config.ts")) || dependencies.next) return "nextjs";
299
335
  if (existsSync(join(root, "svelte.config.js")) || existsSync(join(root, "svelte.config.mjs")) || dependencies["@sveltejs/kit"]) return "svelte";
300
336
  if (existsSync(join(root, "nuxt.config.ts")) || existsSync(join(root, "nuxt.config.js")) || dependencies.nuxt) return "nuxt";
@@ -303,11 +339,13 @@ function resolveFramework(root, packageJSON, framework) {
303
339
  if (dependencies["laravel-vite-plugin"] || existsSync(join(root, "artisan"))) return "laravel";
304
340
  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
341
  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";
342
+ if (hasWebpackConfig) return "webpack";
306
343
  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";
344
+ if (dependencies["@tanstack/react-start"]) return "tanstack-start";
307
345
  if (dependencies.vue || dependencies["@vitejs/plugin-vue"] || existsSync(join(root, "src/App.vue"))) return "vue";
308
346
  if (dependencies.lit) return "lit";
309
347
  if (dependencies.react || dependencies["react-dom"]) return "react";
310
- if (existsSync(join(root, "webpack.config.js")) || existsSync(join(root, "webpack.config.mjs")) || dependencies.webpack) return "webpack";
348
+ if (dependencies.webpack) return "webpack";
311
349
  if (existsSync(join(root, "vite.config.ts")) || existsSync(join(root, "vite.config.js")) || dependencies.vite) return "vite";
312
350
  return "none";
313
351
  }
@@ -0,0 +1,8 @@
1
+ //#region src/modes.d.ts
2
+ declare const renderingModes: readonly ["runtime", "static", "progressive", "pre-render"];
3
+ type RenderingMode = typeof renderingModes[number];
4
+ declare function isRenderingMode(value: unknown): value is RenderingMode;
5
+ declare function formatRenderingModes(): string;
6
+ declare function resolveRenderingMode(value: unknown): RenderingMode | undefined;
7
+ //#endregion
8
+ export { RenderingMode, formatRenderingModes, isRenderingMode, renderingModes, resolveRenderingMode };
package/dist/modes.js ADDED
@@ -0,0 +1,20 @@
1
+ //#region src/modes.ts
2
+ const renderingModes = [
3
+ "runtime",
4
+ "static",
5
+ "progressive",
6
+ "pre-render"
7
+ ];
8
+ function isRenderingMode(value) {
9
+ return renderingModes.includes(value);
10
+ }
11
+ function formatRenderingModes() {
12
+ return renderingModes.join(", ");
13
+ }
14
+ function resolveRenderingMode(value) {
15
+ if (value === void 0) return void 0;
16
+ if (isRenderingMode(value)) return value;
17
+ throw new Error(`Invalid rendering mode "${String(value)}". Supported modes: ${formatRenderingModes()}.`);
18
+ }
19
+ //#endregion
20
+ export { formatRenderingModes, isRenderingMode, renderingModes, resolveRenderingMode };
@@ -1,24 +1,30 @@
1
+ import { RenderingMode } from "./modes.js";
2
+
1
3
  //#region src/transforms.d.ts
2
4
  declare function addMasterCSSImportToStylesheet(content: string): string;
3
5
  declare function createMasterCSSStylesheet(): string;
4
- declare function addMasterCSSVitePlugin(content: string): string;
6
+ declare function addMasterCSSVitePlugin(content: string, mode?: RenderingMode): string;
5
7
  declare function addReactRouterRootCSSImport(content: string): string;
8
+ declare function addTanStackStartRootCSSImport(content: string): string;
6
9
  declare function addMasterCSSStaticVitePlugin(content: string): string;
7
- declare function addMasterCSSRspackPlugin(content: string): string;
8
- declare function addMasterCSSRsbuildPlugin(content: string): string;
9
- declare function createViteConfig(): string;
10
+ declare function addMasterCSSTanStackStartVitePlugin(content: string, mode?: RenderingMode): string;
11
+ declare function addMasterCSSRspackPlugin(content: string, mode?: RenderingMode): string;
12
+ declare function addMasterCSSWebpackPlugin(content: string, mode?: RenderingMode): string;
13
+ declare function addMasterCSSRsbuildPlugin(content: string, mode?: RenderingMode): string;
14
+ declare function createViteConfig(mode?: RenderingMode): string;
10
15
  declare function createStaticViteConfig(): string;
11
- declare function createRspackConfig(): string;
12
- declare function createRsbuildConfig(): string;
13
- declare function createNextConfig(): string;
14
- declare function addMasterCSSNextConfig(content: string): string;
15
- declare function addMasterCSSNuxtModule(content: string): string;
16
- declare function createNuxtConfig(): string;
17
- declare function addMasterCSSAstroIntegration(content: string): string;
18
- declare function createAstroConfig(): string;
16
+ declare function createRspackConfig(mode?: RenderingMode): string;
17
+ declare function createWebpackConfig(mode?: RenderingMode): string;
18
+ declare function createRsbuildConfig(mode?: RenderingMode): string;
19
+ declare function createNextConfig(mode?: RenderingMode): string;
20
+ declare function addMasterCSSNextConfig(content: string, mode?: RenderingMode): string;
21
+ declare function addMasterCSSNuxtModule(content: string, mode?: RenderingMode): string;
22
+ declare function createNuxtConfig(mode?: RenderingMode): string;
23
+ declare function addMasterCSSAstroIntegration(content: string, mode?: RenderingMode): string;
24
+ declare function createAstroConfig(mode?: RenderingMode): string;
19
25
  declare function addViteClientTypes(content: string): string;
20
26
  declare function addLitShadowRuntime(content: string): string;
21
27
  declare function addAngularRuntimeSetup(content: string): string;
22
28
  declare function addMasterCSSEslintConfig(content: string): string;
23
29
  //#endregion
24
- export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
30
+ export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSTanStackStartVitePlugin, addMasterCSSVitePlugin, addMasterCSSWebpackPlugin, addReactRouterRootCSSImport, addTanStackStartRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig, createWebpackConfig };
@@ -1,5 +1,17 @@
1
1
  import { CANONICAL_ESLINT_CONFIG } from "./constants.js";
2
2
  //#region src/transforms.ts
3
+ function formatMasterCSSCall(mode) {
4
+ return mode ? `masterCSS({ mode: '${mode}' })` : "masterCSS()";
5
+ }
6
+ function formatWebpackPluginCall(mode) {
7
+ return mode ? `new MasterCSSPlugin({ mode: '${mode}' })` : "new MasterCSSPlugin()";
8
+ }
9
+ function formatNuxtModule(mode) {
10
+ return mode ? `['@master/css.nuxt', { mode: '${mode}' }]` : "'@master/css.nuxt'";
11
+ }
12
+ function formatNextCall(target, mode) {
13
+ return mode ? `${mode === "static" ? "await " : ""}withMasterCSS(${target}, { mode: '${mode}' })` : `withMasterCSS(${target})`;
14
+ }
3
15
  function addImport(content, statement) {
4
16
  if (content.includes(statement)) return content;
5
17
  const lines = content.split("\n");
@@ -21,28 +33,53 @@ function addMasterCSSImportToStylesheet(content) {
21
33
  function createMasterCSSStylesheet() {
22
34
  return "@import '@master/css';\n";
23
35
  }
24
- function addMasterCSSVitePlugin(content) {
25
- return addMasterCSSVitePluginCall(content, "masterCSS()");
36
+ function addMasterCSSVitePlugin(content, mode) {
37
+ return addMasterCSSVitePluginCall(content, formatMasterCSSCall(mode));
26
38
  }
27
39
  function addReactRouterRootCSSImport(content) {
28
40
  if (/^\s*import\s+['"]\.\/app\.css['"]\s*;?/m.test(content)) return content;
29
41
  return addImport(content, "import './app.css'");
30
42
  }
43
+ function addTanStackStartRootCSSImport(content) {
44
+ if (/^\s*import\s+['"]\.\.\/styles\/app\.css['"]\s*;?/m.test(content)) return content;
45
+ return addImport(content, "import '../styles/app.css'");
46
+ }
31
47
  function addMasterCSSStaticVitePlugin(content) {
32
- return addMasterCSSVitePluginCall(content, "masterCSS({ mode: 'static' })");
48
+ return addMasterCSSVitePlugin(content, "static");
49
+ }
50
+ function addMasterCSSTanStackStartVitePlugin(content, mode = "static") {
51
+ const pluginCall = formatMasterCSSCall(mode);
52
+ if (content.includes("@master/css.vite")) return content;
53
+ let next = addImport(content, "import masterCSS from '@master/css.vite'");
54
+ const tanStackStartPluginPattern = /^(\s*)tanstackStart\([^)]*\),?/m;
55
+ if (tanStackStartPluginPattern.test(next)) return next.replace(tanStackStartPluginPattern, (match, indent) => {
56
+ return `${match.endsWith(",") ? match : `${match},`}\n${indent}${pluginCall},`;
57
+ });
58
+ if (/plugins\s*:\s*\[/.test(next)) return replaceFirst(next, /plugins\s*:\s*\[/, `plugins: [\n ${pluginCall},`);
59
+ if (/defineConfig\(\s*\{/.test(next)) return replaceFirst(next, /defineConfig\(\s*\{/, `defineConfig({\n plugins: [${pluginCall}],`);
60
+ return next;
61
+ }
62
+ function addMasterCSSRspackPlugin(content, mode) {
63
+ if (content.includes("@master/css.webpack")) return content;
64
+ const pluginCall = formatWebpackPluginCall(mode);
65
+ let next = addImport(content, "import MasterCSSPlugin from '@master/css.webpack'");
66
+ if (/plugins\s*:\s*\[/.test(next)) return replaceFirst(next, /plugins\s*:\s*\[/, `plugins: [\n ${pluginCall},`);
67
+ if (/export\s+default\s+\{/.test(next)) return replaceFirst(next, /export\s+default\s+\{/, `export default {\n plugins: [${pluginCall}],`);
68
+ return next;
33
69
  }
34
- function addMasterCSSRspackPlugin(content) {
70
+ function addMasterCSSWebpackPlugin(content, mode) {
35
71
  if (content.includes("@master/css.webpack")) return content;
72
+ const pluginCall = formatWebpackPluginCall(mode);
36
73
  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()],");
74
+ if (/plugins\s*:\s*\[/.test(next)) return replaceFirst(next, /plugins\s*:\s*\[/, `plugins: [\n ${pluginCall},`);
75
+ if (/export\s+default\s+\{/.test(next)) return replaceFirst(next, /export\s+default\s+\{/, `export default {\n plugins: [${pluginCall}],`);
39
76
  return next;
40
77
  }
41
- function addMasterCSSRsbuildPlugin(content) {
78
+ function addMasterCSSRsbuildPlugin(content, mode) {
42
79
  if (content.includes("@master/css.webpack")) return content;
43
80
  let next = addImport(content, "import MasterCSSPlugin from '@master/css.webpack'");
44
81
  const rspackSetupBody = ` config.plugins ||= []
45
- config.plugins.push(new MasterCSSPlugin())
82
+ config.plugins.push(${formatWebpackPluginCall(mode)})
46
83
  return config`;
47
84
  const rspackSetup = `rspack(config) {
48
85
  ${rspackSetupBody}
@@ -68,29 +105,21 @@ function addMasterCSSVitePluginCall(content, pluginCall) {
68
105
  if (/defineConfig\(\s*\{/.test(next)) return replaceFirst(next, /defineConfig\(\s*\{/, `defineConfig({\n plugins: [${pluginCall}],`);
69
106
  return next;
70
107
  }
71
- function createViteConfig() {
108
+ function createViteConfig(mode) {
72
109
  return `import { defineConfig } from 'vite'
73
110
  import masterCSS from '@master/css.vite'
74
111
 
75
112
  export default defineConfig({
76
113
  plugins: [
77
- masterCSS()
114
+ ${formatMasterCSSCall(mode)}
78
115
  ]
79
116
  })
80
117
  `;
81
118
  }
82
119
  function createStaticViteConfig() {
83
- return `import { defineConfig } from 'vite'
84
- import masterCSS from '@master/css.vite'
85
-
86
- export default defineConfig({
87
- plugins: [
88
- masterCSS({ mode: 'static' })
89
- ]
90
- })
91
- `;
120
+ return createViteConfig("static");
92
121
  }
93
- function createRspackConfig() {
122
+ function createRspackConfig(mode) {
94
123
  return `import MasterCSSPlugin from '@master/css.webpack'
95
124
 
96
125
  export default {
@@ -103,12 +132,22 @@ export default {
103
132
  ]
104
133
  },
105
134
  plugins: [
106
- new MasterCSSPlugin()
135
+ ${formatWebpackPluginCall(mode)}
136
+ ]
137
+ }
138
+ `;
139
+ }
140
+ function createWebpackConfig(mode) {
141
+ return `import MasterCSSPlugin from '@master/css.webpack'
142
+
143
+ export default {
144
+ plugins: [
145
+ ${formatWebpackPluginCall(mode)}
107
146
  ]
108
147
  }
109
148
  `;
110
149
  }
111
- function createRsbuildConfig() {
150
+ function createRsbuildConfig(mode) {
112
151
  return `import { defineConfig } from '@rsbuild/core'
113
152
  import MasterCSSPlugin from '@master/css.webpack'
114
153
 
@@ -116,57 +155,62 @@ export default defineConfig({
116
155
  tools: {
117
156
  rspack(config) {
118
157
  config.plugins ||= []
119
- config.plugins.push(new MasterCSSPlugin())
158
+ config.plugins.push(${formatWebpackPluginCall(mode)})
120
159
  return config
121
160
  }
122
161
  }
123
162
  })
124
163
  `;
125
164
  }
126
- function createNextConfig() {
165
+ function createNextConfig(mode) {
127
166
  return `import { withMasterCSS } from '@master/css.next'
128
167
 
129
- const nextConfig = withMasterCSS({})
168
+ const nextConfig = ${formatNextCall("{}", mode)}
130
169
 
131
170
  export default nextConfig
132
171
  `;
133
172
  }
134
- function addMasterCSSNextConfig(content) {
135
- if (content.includes("@master/css.next")) return content;
173
+ function addMasterCSSNextConfig(content, mode) {
174
+ if (content.includes("@master/css.next")) return mode ? addMasterCSSNextMode(content, mode) : content;
136
175
  const next = addImport(content, "import { withMasterCSS } from '@master/css.next'");
137
- if (/export\s+default\s+/.test(next)) return next.replace(/export\s+default\s+([^;\n]+)(;?)(\n|$)/, "export default withMasterCSS($1)$2$3");
176
+ if (/export\s+default\s+/.test(next)) return next.replace(/export\s+default\s+([^;\n]+)(;?)(\n|$)/, `export default ${formatNextCall("$1", mode)}$2$3`);
138
177
  return `${next.trimEnd()}
139
178
 
140
- export default withMasterCSS({})
179
+ export default ${formatNextCall("{}", mode)}
141
180
  `;
142
181
  }
143
- function addMasterCSSNuxtModule(content) {
182
+ function addMasterCSSNextMode(content, mode) {
183
+ return content.replace(/(?:await\s+)?withMasterCSS\(\s*(\{\s*\}|[A-Za-z_$][\w$]*)\s*(?:,\s*\{[^)]*\})?\s*\)/g, (_match, target) => formatNextCall(target, mode));
184
+ }
185
+ function addMasterCSSNuxtModule(content, mode) {
144
186
  if (content.includes("@master/css.nuxt")) return content;
145
- if (/modules\s*:\s*\[/.test(content)) return replaceFirst(content, /modules\s*:\s*\[/, "modules: [\n '@master/css.nuxt',");
146
- if (/defineNuxtConfig\(\s*\{/.test(content)) return replaceFirst(content, /defineNuxtConfig\(\s*\{/, "defineNuxtConfig({\n modules: ['@master/css.nuxt'],");
187
+ const moduleEntry = formatNuxtModule(mode);
188
+ if (/modules\s*:\s*\[/.test(content)) return replaceFirst(content, /modules\s*:\s*\[/, `modules: [\n ${moduleEntry},`);
189
+ if (/defineNuxtConfig\(\s*\{/.test(content)) return replaceFirst(content, /defineNuxtConfig\(\s*\{/, `defineNuxtConfig({\n modules: [${moduleEntry}],`);
147
190
  return content;
148
191
  }
149
- function createNuxtConfig() {
192
+ function createNuxtConfig(mode) {
150
193
  return `export default defineNuxtConfig({
151
- modules: ['@master/css.nuxt'],
194
+ modules: [${formatNuxtModule(mode)}],
152
195
  css: ['~/assets/css/master.css']
153
196
  })
154
197
  `;
155
198
  }
156
- function addMasterCSSAstroIntegration(content) {
199
+ function addMasterCSSAstroIntegration(content, mode) {
157
200
  if (content.includes("@master/css.astro")) return content;
201
+ const pluginCall = formatMasterCSSCall(mode);
158
202
  let next = addImport(content, "import masterCSS from '@master/css.astro'");
159
- if (/integrations\s*:\s*\[/.test(next)) return replaceFirst(next, /integrations\s*:\s*\[/, "integrations: [\n masterCSS(),");
160
- if (/defineConfig\(\s*\{/.test(next)) return replaceFirst(next, /defineConfig\(\s*\{/, "defineConfig({\n integrations: [masterCSS()],");
203
+ if (/integrations\s*:\s*\[/.test(next)) return replaceFirst(next, /integrations\s*:\s*\[/, `integrations: [\n ${pluginCall},`);
204
+ if (/defineConfig\(\s*\{/.test(next)) return replaceFirst(next, /defineConfig\(\s*\{/, `defineConfig({\n integrations: [${pluginCall}],`);
161
205
  return next;
162
206
  }
163
- function createAstroConfig() {
207
+ function createAstroConfig(mode) {
164
208
  return `import { defineConfig } from 'astro/config'
165
209
  import masterCSS from '@master/css.astro'
166
210
 
167
211
  export default defineConfig({
168
212
  integrations: [
169
- masterCSS()
213
+ ${formatMasterCSSCall(mode)}
170
214
  ]
171
215
  })
172
216
  `;
@@ -185,7 +229,7 @@ function addViteClientTypes(content) {
185
229
  function addLitShadowRuntime(content) {
186
230
  if (content.includes("@master/css-runtime") && content.includes("virtual:master-css-manifest") && content.includes("@cssRuntime({ manifest, emittedGlobals })") && content.includes("cssRuntime?: CSSRuntime")) return content;
187
231
  let next = addImport(content, "import { cssRuntime } from '@master/css-runtime'");
188
- next = addImport(next, "import type { CSSRuntime } from '@master/css-runtime'");
232
+ next = addImport(next, "import type CSSRuntime from '@master/css-runtime'");
189
233
  next = addImport(next, "import manifest from 'virtual:master-css-manifest'");
190
234
  next = addImport(next, "import emittedGlobals from 'virtual:master-css-emitted-globals'");
191
235
  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 +240,7 @@ function addLitShadowRuntime(content) {
196
240
  function addAngularRuntimeSetup(content) {
197
241
  if (content.includes("@master/css-runtime")) return content;
198
242
  let next = addImport(content, "import defaultManifestJSON from '@master/css-preset/default-manifest.json'");
199
- next = addImport(next, "import { CSSRuntime } from '@master/css-runtime'");
243
+ next = addImport(next, "import CSSRuntime from '@master/css-runtime'");
200
244
  next = addImport(next, "import type { MasterCSSManifest } from '@master/css-runtime'");
201
245
  const setup = `const defaultManifest = defaultManifestJSON as unknown as MasterCSSManifest
202
246
 
@@ -229,4 +273,4 @@ function addMasterCSSEslintConfig(content) {
229
273
  `;
230
274
  }
231
275
  //#endregion
232
- export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSVitePlugin, addReactRouterRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig };
276
+ export { addAngularRuntimeSetup, addLitShadowRuntime, addMasterCSSAstroIntegration, addMasterCSSEslintConfig, addMasterCSSImportToStylesheet, addMasterCSSNextConfig, addMasterCSSNuxtModule, addMasterCSSRsbuildPlugin, addMasterCSSRspackPlugin, addMasterCSSStaticVitePlugin, addMasterCSSTanStackStartVitePlugin, addMasterCSSVitePlugin, addMasterCSSWebpackPlugin, addReactRouterRootCSSImport, addTanStackStartRootCSSImport, addViteClientTypes, createAstroConfig, createMasterCSSStylesheet, createNextConfig, createNuxtConfig, createRsbuildConfig, createRspackConfig, createStaticViteConfig, createViteConfig, createWebpackConfig };
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.80",
44
+ "version": "2.0.0-rc.82",
45
45
  "scripts": {
46
46
  "build": "tsdown --config ../../shared/tsdown-package.config.ts",
47
47
  "dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",