@pandacss/webpack 2.0.0-beta.10
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.md +21 -0
- package/dist/css-loader.cjs +69 -0
- package/dist/css-loader.d.cts +17 -0
- package/dist/css-loader.d.ts +17 -0
- package/dist/css-loader.js +48 -0
- package/dist/index.cjs +122 -0
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +97 -0
- package/dist/next.cjs +136 -0
- package/dist/next.d.cts +19 -0
- package/dist/next.d.ts +19 -0
- package/dist/next.js +109 -0
- package/package.json +66 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Chakra Systems Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/css-loader.ts
|
|
21
|
+
var css_loader_exports = {};
|
|
22
|
+
__export(css_loader_exports, {
|
|
23
|
+
default: () => pandaCssLoader
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(css_loader_exports);
|
|
26
|
+
var import_compiler_shared = require("@pandacss/compiler-shared");
|
|
27
|
+
function pandaCssLoader(source) {
|
|
28
|
+
const driver = this.getOptions().getDriver();
|
|
29
|
+
if (!driver || !driver.compiler.hasLayerDeclaration(source)) return source;
|
|
30
|
+
addPandaDependencies(this, driver);
|
|
31
|
+
warnDiagnostics(this, driver.designSystemDiagnostics, "while loading the design system");
|
|
32
|
+
const polyfill = driver.config.polyfill === true;
|
|
33
|
+
const output = driver.cssgen({ emitLayerDeclaration: false, polyfill });
|
|
34
|
+
warnDiagnostics(this, output.diagnostics, "while compiling the stylesheet");
|
|
35
|
+
const entry = polyfill ? driver.compiler.stripLayerOrderStatements(source) : source;
|
|
36
|
+
return `${entry}
|
|
37
|
+
${output.css}`;
|
|
38
|
+
}
|
|
39
|
+
function addPandaDependencies(loader, driver) {
|
|
40
|
+
const seen = /* @__PURE__ */ new Set();
|
|
41
|
+
const watch = (file) => {
|
|
42
|
+
if (seen.has(file)) return;
|
|
43
|
+
seen.add(file);
|
|
44
|
+
loader.addDependency(file);
|
|
45
|
+
};
|
|
46
|
+
for (const file of driver.scan()) watch(file);
|
|
47
|
+
for (const dep of driver.watchTargets().config) {
|
|
48
|
+
watch(driver.resolvePath(dep));
|
|
49
|
+
}
|
|
50
|
+
if (driver.configPath) {
|
|
51
|
+
watch(driver.configPath);
|
|
52
|
+
}
|
|
53
|
+
for (const target of driver.designSystemWatchTargets?.() ?? []) {
|
|
54
|
+
watch(target.manifestPath);
|
|
55
|
+
watch(target.buildInfoPath);
|
|
56
|
+
watch(target.presetPath);
|
|
57
|
+
for (const file of target.sourceFiles) {
|
|
58
|
+
watch(file);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function warnDiagnostics(loader, diagnostics, context) {
|
|
63
|
+
if (!diagnostics?.length) return;
|
|
64
|
+
const shown = diagnostics.slice(0, 3).map((diagnostic) => (0, import_compiler_shared.formatDiagnostic)((0, import_compiler_shared.withDiagnosticFile)(diagnostic))).join("\n");
|
|
65
|
+
const hidden = diagnostics.length > 3 ? `
|
|
66
|
+
...and ${diagnostics.length - 3} more` : "";
|
|
67
|
+
loader.emitWarning(new Error(`panda: ${diagnostics.length} diagnostic(s) ${context}
|
|
68
|
+
${shown}${hidden}`));
|
|
69
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Driver } from '@pandacss/compiler';
|
|
2
|
+
import { LoaderContext } from 'webpack';
|
|
3
|
+
|
|
4
|
+
/** Options the plugin passes to this loader — a live handle to the driver. */
|
|
5
|
+
interface PandaCssLoaderOptions {
|
|
6
|
+
getDriver: () => Driver | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `pre` loader for `.css` files. When a stylesheet declares Panda layers
|
|
10
|
+
* (`@layer reset, base, …;`), append the generated CSS in-memory — the webpack
|
|
11
|
+
* analog of the Vite plugin's `.css` transform. No file is written to disk.
|
|
12
|
+
* Registers project sources, config deps, and design-system watch targets so
|
|
13
|
+
* webpack rebuilds this stylesheet when they change.
|
|
14
|
+
*/
|
|
15
|
+
declare function pandaCssLoader(this: LoaderContext<PandaCssLoaderOptions>, source: string): string;
|
|
16
|
+
|
|
17
|
+
export { type PandaCssLoaderOptions, pandaCssLoader as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Driver } from '@pandacss/compiler';
|
|
2
|
+
import { LoaderContext } from 'webpack';
|
|
3
|
+
|
|
4
|
+
/** Options the plugin passes to this loader — a live handle to the driver. */
|
|
5
|
+
interface PandaCssLoaderOptions {
|
|
6
|
+
getDriver: () => Driver | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `pre` loader for `.css` files. When a stylesheet declares Panda layers
|
|
10
|
+
* (`@layer reset, base, …;`), append the generated CSS in-memory — the webpack
|
|
11
|
+
* analog of the Vite plugin's `.css` transform. No file is written to disk.
|
|
12
|
+
* Registers project sources, config deps, and design-system watch targets so
|
|
13
|
+
* webpack rebuilds this stylesheet when they change.
|
|
14
|
+
*/
|
|
15
|
+
declare function pandaCssLoader(this: LoaderContext<PandaCssLoaderOptions>, source: string): string;
|
|
16
|
+
|
|
17
|
+
export { type PandaCssLoaderOptions, pandaCssLoader as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/css-loader.ts
|
|
2
|
+
import { formatDiagnostic, withDiagnosticFile } from "@pandacss/compiler-shared";
|
|
3
|
+
function pandaCssLoader(source) {
|
|
4
|
+
const driver = this.getOptions().getDriver();
|
|
5
|
+
if (!driver || !driver.compiler.hasLayerDeclaration(source)) return source;
|
|
6
|
+
addPandaDependencies(this, driver);
|
|
7
|
+
warnDiagnostics(this, driver.designSystemDiagnostics, "while loading the design system");
|
|
8
|
+
const polyfill = driver.config.polyfill === true;
|
|
9
|
+
const output = driver.cssgen({ emitLayerDeclaration: false, polyfill });
|
|
10
|
+
warnDiagnostics(this, output.diagnostics, "while compiling the stylesheet");
|
|
11
|
+
const entry = polyfill ? driver.compiler.stripLayerOrderStatements(source) : source;
|
|
12
|
+
return `${entry}
|
|
13
|
+
${output.css}`;
|
|
14
|
+
}
|
|
15
|
+
function addPandaDependencies(loader, driver) {
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
const watch = (file) => {
|
|
18
|
+
if (seen.has(file)) return;
|
|
19
|
+
seen.add(file);
|
|
20
|
+
loader.addDependency(file);
|
|
21
|
+
};
|
|
22
|
+
for (const file of driver.scan()) watch(file);
|
|
23
|
+
for (const dep of driver.watchTargets().config) {
|
|
24
|
+
watch(driver.resolvePath(dep));
|
|
25
|
+
}
|
|
26
|
+
if (driver.configPath) {
|
|
27
|
+
watch(driver.configPath);
|
|
28
|
+
}
|
|
29
|
+
for (const target of driver.designSystemWatchTargets?.() ?? []) {
|
|
30
|
+
watch(target.manifestPath);
|
|
31
|
+
watch(target.buildInfoPath);
|
|
32
|
+
watch(target.presetPath);
|
|
33
|
+
for (const file of target.sourceFiles) {
|
|
34
|
+
watch(file);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function warnDiagnostics(loader, diagnostics, context) {
|
|
39
|
+
if (!diagnostics?.length) return;
|
|
40
|
+
const shown = diagnostics.slice(0, 3).map((diagnostic) => formatDiagnostic(withDiagnosticFile(diagnostic))).join("\n");
|
|
41
|
+
const hidden = diagnostics.length > 3 ? `
|
|
42
|
+
...and ${diagnostics.length - 3} more` : "";
|
|
43
|
+
loader.emitWarning(new Error(`panda: ${diagnostics.length} diagnostic(s) ${context}
|
|
44
|
+
${shown}${hidden}`));
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
pandaCssLoader as default
|
|
48
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
PandaWebpackPlugin: () => PandaWebpackPlugin,
|
|
24
|
+
default: () => index_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
var import_compiler = require("@pandacss/compiler");
|
|
28
|
+
var import_compiler_shared = require("@pandacss/compiler-shared");
|
|
29
|
+
var import_transformer = require("@pandacss/transformer");
|
|
30
|
+
var NAME = "PandaWebpackPlugin";
|
|
31
|
+
var PandaWebpackPlugin = class {
|
|
32
|
+
#options;
|
|
33
|
+
#driver;
|
|
34
|
+
#ready;
|
|
35
|
+
#designSystemDiagnosticsRef;
|
|
36
|
+
constructor(options = {}) {
|
|
37
|
+
this.#options = options;
|
|
38
|
+
}
|
|
39
|
+
#build(cwd) {
|
|
40
|
+
if (!this.#ready) {
|
|
41
|
+
this.#ready = (async () => {
|
|
42
|
+
const driver = await (0, import_compiler.createNodeDriver)({ cwd, configPath: this.#options.configPath });
|
|
43
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
44
|
+
driver.parseFiles();
|
|
45
|
+
this.#driver = driver;
|
|
46
|
+
})();
|
|
47
|
+
}
|
|
48
|
+
return this.#ready;
|
|
49
|
+
}
|
|
50
|
+
/** Watch-mode incremental sync: fold changed files into the driver before this
|
|
51
|
+
* rebuild's modules (including the layer-declaring CSS) are read. The driver
|
|
52
|
+
* re-reads changed files through its own fs. */
|
|
53
|
+
async #sync(cwd, changed, warn) {
|
|
54
|
+
await this.#build(cwd);
|
|
55
|
+
const driver = this.#driver;
|
|
56
|
+
let configChanged = false;
|
|
57
|
+
let designSystemChanged = false;
|
|
58
|
+
for (const file of changed) {
|
|
59
|
+
const designSystemFile = driver.isDesignSystemFile?.(file) ?? false;
|
|
60
|
+
if (designSystemFile) {
|
|
61
|
+
const synced = await driver.syncDesignSystemFileChange({ path: file, kind: "change" });
|
|
62
|
+
if (synced) designSystemChanged = true;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (driver.isConfigFile(file)) {
|
|
66
|
+
configChanged = true;
|
|
67
|
+
} else if (driver.isSourceFile(file)) {
|
|
68
|
+
driver.applyChange({ path: file, kind: "change" });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (configChanged) {
|
|
72
|
+
const diff = await driver.reload();
|
|
73
|
+
if (diff.hasChanged) {
|
|
74
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
75
|
+
driver.parseFiles();
|
|
76
|
+
designSystemChanged = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (designSystemChanged) {
|
|
80
|
+
this.#warnDesignSystemDiagnostics(warn);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
#warnDesignSystemDiagnostics(warn) {
|
|
84
|
+
if (!warn) return;
|
|
85
|
+
const diagnostics = this.#driver?.designSystemDiagnostics ?? [];
|
|
86
|
+
if (diagnostics === this.#designSystemDiagnosticsRef) return;
|
|
87
|
+
this.#designSystemDiagnosticsRef = diagnostics;
|
|
88
|
+
if (!diagnostics.length) return;
|
|
89
|
+
const shown = diagnostics.slice(0, 3).map((diagnostic) => (0, import_compiler_shared.formatDiagnostic)((0, import_compiler_shared.withDiagnosticFile)(diagnostic))).join("\n");
|
|
90
|
+
const hidden = diagnostics.length > 3 ? `
|
|
91
|
+
...and ${diagnostics.length - 3} more` : "";
|
|
92
|
+
warn(`panda: ${diagnostics.length} diagnostic(s) while loading the design system
|
|
93
|
+
${shown}${hidden}`);
|
|
94
|
+
}
|
|
95
|
+
apply(compiler) {
|
|
96
|
+
const cwd = this.#options.cwd ?? compiler.context ?? process.cwd();
|
|
97
|
+
const logger = compiler.getInfrastructureLogger?.(NAME);
|
|
98
|
+
if (this.#options.transform) {
|
|
99
|
+
import_transformer.pandaTransformer.webpack({
|
|
100
|
+
exclude: [/node_modules/],
|
|
101
|
+
getCompiler: () => this.#driver?.compiler
|
|
102
|
+
}).apply(compiler);
|
|
103
|
+
}
|
|
104
|
+
const options = { getDriver: () => this.#driver };
|
|
105
|
+
compiler.options.module.rules.push({
|
|
106
|
+
test: /\.css$/,
|
|
107
|
+
exclude: /node_modules/,
|
|
108
|
+
enforce: "pre",
|
|
109
|
+
use: [{ loader: "@pandacss/webpack/css-loader", options }]
|
|
110
|
+
});
|
|
111
|
+
compiler.hooks.beforeCompile.tapPromise(NAME, () => this.#build(cwd));
|
|
112
|
+
compiler.hooks.watchRun.tapPromise(
|
|
113
|
+
NAME,
|
|
114
|
+
(c) => this.#sync(cwd, c.modifiedFiles ?? [], (message) => logger?.warn(message))
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var index_default = PandaWebpackPlugin;
|
|
119
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
120
|
+
0 && (module.exports = {
|
|
121
|
+
PandaWebpackPlugin
|
|
122
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
2
|
+
|
|
3
|
+
interface PandaWebpackPluginOptions {
|
|
4
|
+
/** Project root. Defaults to the webpack compiler `context`. */
|
|
5
|
+
cwd?: string;
|
|
6
|
+
/** Explicit config file (relative to `cwd`); otherwise discovered upward. */
|
|
7
|
+
configPath?: string;
|
|
8
|
+
/** Where codegen artifacts are written. Defaults to the config `outdir`. */
|
|
9
|
+
outdir?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Opt-in source rewrite (`css()` → class strings, etc.). Default: `false`.
|
|
12
|
+
* CSS injection, codegen, and watch sync always run.
|
|
13
|
+
*/
|
|
14
|
+
transform?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* webpack plugin for Panda CSS. Runs codegen and injects generated CSS
|
|
18
|
+
* in-memory into any stylesheet that declares Panda layers — no file is
|
|
19
|
+
* written. Pass `transform: true` to also rewrite source via the shared
|
|
20
|
+
* `@pandacss/transformer` unplugin (and resolve `@pandacss-internal/css`).
|
|
21
|
+
*/
|
|
22
|
+
declare class PandaWebpackPlugin {
|
|
23
|
+
#private;
|
|
24
|
+
constructor(options?: PandaWebpackPluginOptions);
|
|
25
|
+
apply(compiler: Compiler): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { PandaWebpackPlugin, type PandaWebpackPluginOptions, PandaWebpackPlugin as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
2
|
+
|
|
3
|
+
interface PandaWebpackPluginOptions {
|
|
4
|
+
/** Project root. Defaults to the webpack compiler `context`. */
|
|
5
|
+
cwd?: string;
|
|
6
|
+
/** Explicit config file (relative to `cwd`); otherwise discovered upward. */
|
|
7
|
+
configPath?: string;
|
|
8
|
+
/** Where codegen artifacts are written. Defaults to the config `outdir`. */
|
|
9
|
+
outdir?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Opt-in source rewrite (`css()` → class strings, etc.). Default: `false`.
|
|
12
|
+
* CSS injection, codegen, and watch sync always run.
|
|
13
|
+
*/
|
|
14
|
+
transform?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* webpack plugin for Panda CSS. Runs codegen and injects generated CSS
|
|
18
|
+
* in-memory into any stylesheet that declares Panda layers — no file is
|
|
19
|
+
* written. Pass `transform: true` to also rewrite source via the shared
|
|
20
|
+
* `@pandacss/transformer` unplugin (and resolve `@pandacss-internal/css`).
|
|
21
|
+
*/
|
|
22
|
+
declare class PandaWebpackPlugin {
|
|
23
|
+
#private;
|
|
24
|
+
constructor(options?: PandaWebpackPluginOptions);
|
|
25
|
+
apply(compiler: Compiler): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { PandaWebpackPlugin, type PandaWebpackPluginOptions, PandaWebpackPlugin as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { createNodeDriver } from "@pandacss/compiler";
|
|
3
|
+
import { formatDiagnostic, withDiagnosticFile } from "@pandacss/compiler-shared";
|
|
4
|
+
import { pandaTransformer } from "@pandacss/transformer";
|
|
5
|
+
var NAME = "PandaWebpackPlugin";
|
|
6
|
+
var PandaWebpackPlugin = class {
|
|
7
|
+
#options;
|
|
8
|
+
#driver;
|
|
9
|
+
#ready;
|
|
10
|
+
#designSystemDiagnosticsRef;
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.#options = options;
|
|
13
|
+
}
|
|
14
|
+
#build(cwd) {
|
|
15
|
+
if (!this.#ready) {
|
|
16
|
+
this.#ready = (async () => {
|
|
17
|
+
const driver = await createNodeDriver({ cwd, configPath: this.#options.configPath });
|
|
18
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
19
|
+
driver.parseFiles();
|
|
20
|
+
this.#driver = driver;
|
|
21
|
+
})();
|
|
22
|
+
}
|
|
23
|
+
return this.#ready;
|
|
24
|
+
}
|
|
25
|
+
/** Watch-mode incremental sync: fold changed files into the driver before this
|
|
26
|
+
* rebuild's modules (including the layer-declaring CSS) are read. The driver
|
|
27
|
+
* re-reads changed files through its own fs. */
|
|
28
|
+
async #sync(cwd, changed, warn) {
|
|
29
|
+
await this.#build(cwd);
|
|
30
|
+
const driver = this.#driver;
|
|
31
|
+
let configChanged = false;
|
|
32
|
+
let designSystemChanged = false;
|
|
33
|
+
for (const file of changed) {
|
|
34
|
+
const designSystemFile = driver.isDesignSystemFile?.(file) ?? false;
|
|
35
|
+
if (designSystemFile) {
|
|
36
|
+
const synced = await driver.syncDesignSystemFileChange({ path: file, kind: "change" });
|
|
37
|
+
if (synced) designSystemChanged = true;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (driver.isConfigFile(file)) {
|
|
41
|
+
configChanged = true;
|
|
42
|
+
} else if (driver.isSourceFile(file)) {
|
|
43
|
+
driver.applyChange({ path: file, kind: "change" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (configChanged) {
|
|
47
|
+
const diff = await driver.reload();
|
|
48
|
+
if (diff.hasChanged) {
|
|
49
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
50
|
+
driver.parseFiles();
|
|
51
|
+
designSystemChanged = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (designSystemChanged) {
|
|
55
|
+
this.#warnDesignSystemDiagnostics(warn);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
#warnDesignSystemDiagnostics(warn) {
|
|
59
|
+
if (!warn) return;
|
|
60
|
+
const diagnostics = this.#driver?.designSystemDiagnostics ?? [];
|
|
61
|
+
if (diagnostics === this.#designSystemDiagnosticsRef) return;
|
|
62
|
+
this.#designSystemDiagnosticsRef = diagnostics;
|
|
63
|
+
if (!diagnostics.length) return;
|
|
64
|
+
const shown = diagnostics.slice(0, 3).map((diagnostic) => formatDiagnostic(withDiagnosticFile(diagnostic))).join("\n");
|
|
65
|
+
const hidden = diagnostics.length > 3 ? `
|
|
66
|
+
...and ${diagnostics.length - 3} more` : "";
|
|
67
|
+
warn(`panda: ${diagnostics.length} diagnostic(s) while loading the design system
|
|
68
|
+
${shown}${hidden}`);
|
|
69
|
+
}
|
|
70
|
+
apply(compiler) {
|
|
71
|
+
const cwd = this.#options.cwd ?? compiler.context ?? process.cwd();
|
|
72
|
+
const logger = compiler.getInfrastructureLogger?.(NAME);
|
|
73
|
+
if (this.#options.transform) {
|
|
74
|
+
pandaTransformer.webpack({
|
|
75
|
+
exclude: [/node_modules/],
|
|
76
|
+
getCompiler: () => this.#driver?.compiler
|
|
77
|
+
}).apply(compiler);
|
|
78
|
+
}
|
|
79
|
+
const options = { getDriver: () => this.#driver };
|
|
80
|
+
compiler.options.module.rules.push({
|
|
81
|
+
test: /\.css$/,
|
|
82
|
+
exclude: /node_modules/,
|
|
83
|
+
enforce: "pre",
|
|
84
|
+
use: [{ loader: "@pandacss/webpack/css-loader", options }]
|
|
85
|
+
});
|
|
86
|
+
compiler.hooks.beforeCompile.tapPromise(NAME, () => this.#build(cwd));
|
|
87
|
+
compiler.hooks.watchRun.tapPromise(
|
|
88
|
+
NAME,
|
|
89
|
+
(c) => this.#sync(cwd, c.modifiedFiles ?? [], (message) => logger?.warn(message))
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var index_default = PandaWebpackPlugin;
|
|
94
|
+
export {
|
|
95
|
+
PandaWebpackPlugin,
|
|
96
|
+
index_default as default
|
|
97
|
+
};
|
package/dist/next.cjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/next.ts
|
|
21
|
+
var next_exports = {};
|
|
22
|
+
__export(next_exports, {
|
|
23
|
+
default: () => next_default,
|
|
24
|
+
withPandaCss: () => withPandaCss
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(next_exports);
|
|
27
|
+
|
|
28
|
+
// src/index.ts
|
|
29
|
+
var import_compiler = require("@pandacss/compiler");
|
|
30
|
+
var import_compiler_shared = require("@pandacss/compiler-shared");
|
|
31
|
+
var import_transformer = require("@pandacss/transformer");
|
|
32
|
+
var NAME = "PandaWebpackPlugin";
|
|
33
|
+
var PandaWebpackPlugin = class {
|
|
34
|
+
#options;
|
|
35
|
+
#driver;
|
|
36
|
+
#ready;
|
|
37
|
+
#designSystemDiagnosticsRef;
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.#options = options;
|
|
40
|
+
}
|
|
41
|
+
#build(cwd) {
|
|
42
|
+
if (!this.#ready) {
|
|
43
|
+
this.#ready = (async () => {
|
|
44
|
+
const driver = await (0, import_compiler.createNodeDriver)({ cwd, configPath: this.#options.configPath });
|
|
45
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
46
|
+
driver.parseFiles();
|
|
47
|
+
this.#driver = driver;
|
|
48
|
+
})();
|
|
49
|
+
}
|
|
50
|
+
return this.#ready;
|
|
51
|
+
}
|
|
52
|
+
/** Watch-mode incremental sync: fold changed files into the driver before this
|
|
53
|
+
* rebuild's modules (including the layer-declaring CSS) are read. The driver
|
|
54
|
+
* re-reads changed files through its own fs. */
|
|
55
|
+
async #sync(cwd, changed, warn) {
|
|
56
|
+
await this.#build(cwd);
|
|
57
|
+
const driver = this.#driver;
|
|
58
|
+
let configChanged = false;
|
|
59
|
+
let designSystemChanged = false;
|
|
60
|
+
for (const file of changed) {
|
|
61
|
+
const designSystemFile = driver.isDesignSystemFile?.(file) ?? false;
|
|
62
|
+
if (designSystemFile) {
|
|
63
|
+
const synced = await driver.syncDesignSystemFileChange({ path: file, kind: "change" });
|
|
64
|
+
if (synced) designSystemChanged = true;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (driver.isConfigFile(file)) {
|
|
68
|
+
configChanged = true;
|
|
69
|
+
} else if (driver.isSourceFile(file)) {
|
|
70
|
+
driver.applyChange({ path: file, kind: "change" });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (configChanged) {
|
|
74
|
+
const diff = await driver.reload();
|
|
75
|
+
if (diff.hasChanged) {
|
|
76
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
77
|
+
driver.parseFiles();
|
|
78
|
+
designSystemChanged = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (designSystemChanged) {
|
|
82
|
+
this.#warnDesignSystemDiagnostics(warn);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
#warnDesignSystemDiagnostics(warn) {
|
|
86
|
+
if (!warn) return;
|
|
87
|
+
const diagnostics = this.#driver?.designSystemDiagnostics ?? [];
|
|
88
|
+
if (diagnostics === this.#designSystemDiagnosticsRef) return;
|
|
89
|
+
this.#designSystemDiagnosticsRef = diagnostics;
|
|
90
|
+
if (!diagnostics.length) return;
|
|
91
|
+
const shown = diagnostics.slice(0, 3).map((diagnostic) => (0, import_compiler_shared.formatDiagnostic)((0, import_compiler_shared.withDiagnosticFile)(diagnostic))).join("\n");
|
|
92
|
+
const hidden = diagnostics.length > 3 ? `
|
|
93
|
+
...and ${diagnostics.length - 3} more` : "";
|
|
94
|
+
warn(`panda: ${diagnostics.length} diagnostic(s) while loading the design system
|
|
95
|
+
${shown}${hidden}`);
|
|
96
|
+
}
|
|
97
|
+
apply(compiler) {
|
|
98
|
+
const cwd = this.#options.cwd ?? compiler.context ?? process.cwd();
|
|
99
|
+
const logger = compiler.getInfrastructureLogger?.(NAME);
|
|
100
|
+
if (this.#options.transform) {
|
|
101
|
+
import_transformer.pandaTransformer.webpack({
|
|
102
|
+
exclude: [/node_modules/],
|
|
103
|
+
getCompiler: () => this.#driver?.compiler
|
|
104
|
+
}).apply(compiler);
|
|
105
|
+
}
|
|
106
|
+
const options = { getDriver: () => this.#driver };
|
|
107
|
+
compiler.options.module.rules.push({
|
|
108
|
+
test: /\.css$/,
|
|
109
|
+
exclude: /node_modules/,
|
|
110
|
+
enforce: "pre",
|
|
111
|
+
use: [{ loader: "@pandacss/webpack/css-loader", options }]
|
|
112
|
+
});
|
|
113
|
+
compiler.hooks.beforeCompile.tapPromise(NAME, () => this.#build(cwd));
|
|
114
|
+
compiler.hooks.watchRun.tapPromise(
|
|
115
|
+
NAME,
|
|
116
|
+
(c) => this.#sync(cwd, c.modifiedFiles ?? [], (message) => logger?.warn(message))
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// src/next.ts
|
|
122
|
+
function withPandaCss(nextConfig = {}, pandaOptions = {}) {
|
|
123
|
+
const plugin = new PandaWebpackPlugin(pandaOptions);
|
|
124
|
+
return {
|
|
125
|
+
...nextConfig,
|
|
126
|
+
webpack(config, context) {
|
|
127
|
+
config.plugins.push(plugin);
|
|
128
|
+
return typeof nextConfig.webpack === "function" ? nextConfig.webpack(config, context) : config;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
var next_default = withPandaCss;
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
withPandaCss
|
|
136
|
+
});
|
package/dist/next.d.cts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PandaWebpackPluginOptions } from './index.cjs';
|
|
2
|
+
import 'webpack';
|
|
3
|
+
|
|
4
|
+
type WebpackConfig = {
|
|
5
|
+
plugins: unknown[];
|
|
6
|
+
};
|
|
7
|
+
type NextConfig = {
|
|
8
|
+
webpack?: (config: WebpackConfig, context: unknown) => WebpackConfig;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wrap a Next.js config to run Panda's webpack plugin. Composes with any
|
|
13
|
+
* existing `webpack` function. Only affects the webpack build — Turbopack needs
|
|
14
|
+
* its own integration. Pass `transform: true` in `pandaOptions` to enable
|
|
15
|
+
* source rewrite.
|
|
16
|
+
*/
|
|
17
|
+
declare function withPandaCss(nextConfig?: NextConfig, pandaOptions?: PandaWebpackPluginOptions): NextConfig;
|
|
18
|
+
|
|
19
|
+
export { withPandaCss as default, withPandaCss };
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PandaWebpackPluginOptions } from './index.js';
|
|
2
|
+
import 'webpack';
|
|
3
|
+
|
|
4
|
+
type WebpackConfig = {
|
|
5
|
+
plugins: unknown[];
|
|
6
|
+
};
|
|
7
|
+
type NextConfig = {
|
|
8
|
+
webpack?: (config: WebpackConfig, context: unknown) => WebpackConfig;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wrap a Next.js config to run Panda's webpack plugin. Composes with any
|
|
13
|
+
* existing `webpack` function. Only affects the webpack build — Turbopack needs
|
|
14
|
+
* its own integration. Pass `transform: true` in `pandaOptions` to enable
|
|
15
|
+
* source rewrite.
|
|
16
|
+
*/
|
|
17
|
+
declare function withPandaCss(nextConfig?: NextConfig, pandaOptions?: PandaWebpackPluginOptions): NextConfig;
|
|
18
|
+
|
|
19
|
+
export { withPandaCss as default, withPandaCss };
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { createNodeDriver } from "@pandacss/compiler";
|
|
3
|
+
import { formatDiagnostic, withDiagnosticFile } from "@pandacss/compiler-shared";
|
|
4
|
+
import { pandaTransformer } from "@pandacss/transformer";
|
|
5
|
+
var NAME = "PandaWebpackPlugin";
|
|
6
|
+
var PandaWebpackPlugin = class {
|
|
7
|
+
#options;
|
|
8
|
+
#driver;
|
|
9
|
+
#ready;
|
|
10
|
+
#designSystemDiagnosticsRef;
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.#options = options;
|
|
13
|
+
}
|
|
14
|
+
#build(cwd) {
|
|
15
|
+
if (!this.#ready) {
|
|
16
|
+
this.#ready = (async () => {
|
|
17
|
+
const driver = await createNodeDriver({ cwd, configPath: this.#options.configPath });
|
|
18
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
19
|
+
driver.parseFiles();
|
|
20
|
+
this.#driver = driver;
|
|
21
|
+
})();
|
|
22
|
+
}
|
|
23
|
+
return this.#ready;
|
|
24
|
+
}
|
|
25
|
+
/** Watch-mode incremental sync: fold changed files into the driver before this
|
|
26
|
+
* rebuild's modules (including the layer-declaring CSS) are read. The driver
|
|
27
|
+
* re-reads changed files through its own fs. */
|
|
28
|
+
async #sync(cwd, changed, warn) {
|
|
29
|
+
await this.#build(cwd);
|
|
30
|
+
const driver = this.#driver;
|
|
31
|
+
let configChanged = false;
|
|
32
|
+
let designSystemChanged = false;
|
|
33
|
+
for (const file of changed) {
|
|
34
|
+
const designSystemFile = driver.isDesignSystemFile?.(file) ?? false;
|
|
35
|
+
if (designSystemFile) {
|
|
36
|
+
const synced = await driver.syncDesignSystemFileChange({ path: file, kind: "change" });
|
|
37
|
+
if (synced) designSystemChanged = true;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (driver.isConfigFile(file)) {
|
|
41
|
+
configChanged = true;
|
|
42
|
+
} else if (driver.isSourceFile(file)) {
|
|
43
|
+
driver.applyChange({ path: file, kind: "change" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (configChanged) {
|
|
47
|
+
const diff = await driver.reload();
|
|
48
|
+
if (diff.hasChanged) {
|
|
49
|
+
driver.codegen({ cwd, outdir: this.#options.outdir });
|
|
50
|
+
driver.parseFiles();
|
|
51
|
+
designSystemChanged = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (designSystemChanged) {
|
|
55
|
+
this.#warnDesignSystemDiagnostics(warn);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
#warnDesignSystemDiagnostics(warn) {
|
|
59
|
+
if (!warn) return;
|
|
60
|
+
const diagnostics = this.#driver?.designSystemDiagnostics ?? [];
|
|
61
|
+
if (diagnostics === this.#designSystemDiagnosticsRef) return;
|
|
62
|
+
this.#designSystemDiagnosticsRef = diagnostics;
|
|
63
|
+
if (!diagnostics.length) return;
|
|
64
|
+
const shown = diagnostics.slice(0, 3).map((diagnostic) => formatDiagnostic(withDiagnosticFile(diagnostic))).join("\n");
|
|
65
|
+
const hidden = diagnostics.length > 3 ? `
|
|
66
|
+
...and ${diagnostics.length - 3} more` : "";
|
|
67
|
+
warn(`panda: ${diagnostics.length} diagnostic(s) while loading the design system
|
|
68
|
+
${shown}${hidden}`);
|
|
69
|
+
}
|
|
70
|
+
apply(compiler) {
|
|
71
|
+
const cwd = this.#options.cwd ?? compiler.context ?? process.cwd();
|
|
72
|
+
const logger = compiler.getInfrastructureLogger?.(NAME);
|
|
73
|
+
if (this.#options.transform) {
|
|
74
|
+
pandaTransformer.webpack({
|
|
75
|
+
exclude: [/node_modules/],
|
|
76
|
+
getCompiler: () => this.#driver?.compiler
|
|
77
|
+
}).apply(compiler);
|
|
78
|
+
}
|
|
79
|
+
const options = { getDriver: () => this.#driver };
|
|
80
|
+
compiler.options.module.rules.push({
|
|
81
|
+
test: /\.css$/,
|
|
82
|
+
exclude: /node_modules/,
|
|
83
|
+
enforce: "pre",
|
|
84
|
+
use: [{ loader: "@pandacss/webpack/css-loader", options }]
|
|
85
|
+
});
|
|
86
|
+
compiler.hooks.beforeCompile.tapPromise(NAME, () => this.#build(cwd));
|
|
87
|
+
compiler.hooks.watchRun.tapPromise(
|
|
88
|
+
NAME,
|
|
89
|
+
(c) => this.#sync(cwd, c.modifiedFiles ?? [], (message) => logger?.warn(message))
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/next.ts
|
|
95
|
+
function withPandaCss(nextConfig = {}, pandaOptions = {}) {
|
|
96
|
+
const plugin = new PandaWebpackPlugin(pandaOptions);
|
|
97
|
+
return {
|
|
98
|
+
...nextConfig,
|
|
99
|
+
webpack(config, context) {
|
|
100
|
+
config.plugins.push(plugin);
|
|
101
|
+
return typeof nextConfig.webpack === "function" ? nextConfig.webpack(config, context) : config;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var next_default = withPandaCss;
|
|
106
|
+
export {
|
|
107
|
+
next_default as default,
|
|
108
|
+
withPandaCss
|
|
109
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pandacss/webpack",
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
|
+
"description": "webpack plugin for Panda CSS (Next.js compatible)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"author": "Segun Adebayo <joseshegs@gmail.com>",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"source": "./src/index.ts",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./next": {
|
|
17
|
+
"source": "./src/next.ts",
|
|
18
|
+
"types": "./dist/next.d.ts",
|
|
19
|
+
"default": "./dist/next.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./css-loader": {
|
|
23
|
+
"source": "./src/css-loader.ts",
|
|
24
|
+
"types": "./dist/css-loader.d.ts",
|
|
25
|
+
"default": "./dist/css-loader.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"homepage": "https://panda-css.com",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/chakra-ui/panda.git",
|
|
33
|
+
"directory": "packages/webpack"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@pandacss/compiler": "2.0.0-beta.10",
|
|
43
|
+
"@pandacss/compiler-shared": "2.0.0-beta.10",
|
|
44
|
+
"@pandacss/transformer": "2.0.0-beta.10"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"webpack": ">=5.0.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"webpack": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"webpack": "5.102.1"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=22"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsup src/index.ts src/next.ts src/css-loader.ts --format=cjs,esm --platform=node --dts --no-splitting",
|
|
62
|
+
"build:fast": "tsup src/index.ts src/next.ts src/css-loader.ts --format=cjs,esm --platform=node --no-dts --no-splitting",
|
|
63
|
+
"dev": "pnpm build:fast --watch src",
|
|
64
|
+
"test": "vitest run"
|
|
65
|
+
}
|
|
66
|
+
}
|