@pandacss/postcss 2.0.0-beta.6 → 2.0.0-beta.8
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/index.cjs +23 -9
- package/dist/index.js +21 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts
|
|
2
2
|
var _compiler = require('@pandacss/compiler');
|
|
3
|
+
var _compilershared = require('@pandacss/compiler-shared');
|
|
3
4
|
var _path = require('path');
|
|
4
5
|
var PLUGIN_NAME = "pandacss";
|
|
5
6
|
var driverStates = /* @__PURE__ */ new Map();
|
|
@@ -15,18 +16,20 @@ var pandacss = (options = {}) => {
|
|
|
15
16
|
let state = driverStates.get(key);
|
|
16
17
|
if (!state) {
|
|
17
18
|
const driver2 = await _compiler.createNodeDriver.call(void 0, { cwd, configPath: options.configPath });
|
|
18
|
-
state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set() };
|
|
19
|
+
state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set(), parsedSources: /* @__PURE__ */ new Set() };
|
|
19
20
|
driverStates.set(key, state);
|
|
20
21
|
} else {
|
|
21
22
|
const diff = await state.driver.reload();
|
|
22
23
|
if (diff.hasChanged) {
|
|
23
24
|
state.generatedOutdirs.clear();
|
|
25
|
+
state.parsedSources.clear();
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
const { driver } = state;
|
|
27
29
|
if (!driver.compiler.hasLayerDeclaration(inputCss)) return;
|
|
28
30
|
ensureCodegen(state, { cwd, outdir: options.outdir });
|
|
29
|
-
|
|
31
|
+
syncProjectSources(state);
|
|
32
|
+
driver.syncDesignSystemSources();
|
|
30
33
|
registerDependencies(driver, result, cwd, fileName);
|
|
31
34
|
emitDiagnostics(root, result, _nullishCoalesce(driver.designSystemDiagnostics, () => ( [])));
|
|
32
35
|
const output = driver.cssgen({ emitLayerDeclaration: false });
|
|
@@ -73,6 +76,22 @@ function ensureCodegen(state, options) {
|
|
|
73
76
|
state.driver.codegen({ cwd: options.cwd, outdir: options.outdir });
|
|
74
77
|
state.generatedOutdirs.add(outdirKey);
|
|
75
78
|
}
|
|
79
|
+
function syncProjectSources(state) {
|
|
80
|
+
const files = new Set(state.driver.scan());
|
|
81
|
+
const changes = [];
|
|
82
|
+
for (const path of state.parsedSources) {
|
|
83
|
+
if (!files.has(path)) {
|
|
84
|
+
changes.push({ path, kind: "unlink" });
|
|
85
|
+
state.parsedSources.delete(path);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const path of files) {
|
|
89
|
+
const known = state.parsedSources.has(path);
|
|
90
|
+
changes.push({ path, kind: known ? "change" : "add" });
|
|
91
|
+
state.parsedSources.add(path);
|
|
92
|
+
}
|
|
93
|
+
state.driver.applyChanges(changes);
|
|
94
|
+
}
|
|
76
95
|
function registerDependencies(driver, result, cwd, parent) {
|
|
77
96
|
for (const source of driver.compiler.sources()) {
|
|
78
97
|
result.messages.push(
|
|
@@ -127,18 +146,13 @@ function withPluginMetadata(message, parent) {
|
|
|
127
146
|
parent
|
|
128
147
|
};
|
|
129
148
|
}
|
|
130
|
-
function formatDiagnostic(diagnostic) {
|
|
131
|
-
const file = diagnostic.file ? `${diagnostic.file}` : "";
|
|
132
|
-
const location = diagnostic.location ? `:${diagnostic.location.start.line}:${diagnostic.location.start.column}` : diagnostic.span ? `:${diagnostic.span.start}` : "";
|
|
133
|
-
return `${diagnostic.severity} ${diagnostic.code} ${file}${location} ${diagnostic.message}`.replace(/\s+/g, " ");
|
|
134
|
-
}
|
|
135
149
|
function emitDiagnostics(root, result, diagnostics) {
|
|
136
150
|
const error = diagnostics.find((diagnostic) => diagnostic.severity === "error");
|
|
137
151
|
if (error) {
|
|
138
|
-
throw root.error(formatDiagnostic(error), { plugin: PLUGIN_NAME });
|
|
152
|
+
throw root.error(_compilershared.formatDiagnostic.call(void 0, error), { plugin: PLUGIN_NAME });
|
|
139
153
|
}
|
|
140
154
|
for (const diagnostic of diagnostics) {
|
|
141
|
-
result.warn(formatDiagnostic(diagnostic), { plugin: PLUGIN_NAME });
|
|
155
|
+
result.warn(_compilershared.formatDiagnostic.call(void 0, diagnostic), { plugin: PLUGIN_NAME });
|
|
142
156
|
}
|
|
143
157
|
}
|
|
144
158
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { createNodeDriver } from "@pandacss/compiler";
|
|
3
|
+
import { formatDiagnostic } from "@pandacss/compiler-shared";
|
|
3
4
|
import { extname, normalize, resolve } from "path";
|
|
4
5
|
var PLUGIN_NAME = "pandacss";
|
|
5
6
|
var driverStates = /* @__PURE__ */ new Map();
|
|
@@ -15,18 +16,20 @@ var pandacss = (options = {}) => {
|
|
|
15
16
|
let state = driverStates.get(key);
|
|
16
17
|
if (!state) {
|
|
17
18
|
const driver2 = await createNodeDriver({ cwd, configPath: options.configPath });
|
|
18
|
-
state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set() };
|
|
19
|
+
state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set(), parsedSources: /* @__PURE__ */ new Set() };
|
|
19
20
|
driverStates.set(key, state);
|
|
20
21
|
} else {
|
|
21
22
|
const diff = await state.driver.reload();
|
|
22
23
|
if (diff.hasChanged) {
|
|
23
24
|
state.generatedOutdirs.clear();
|
|
25
|
+
state.parsedSources.clear();
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
const { driver } = state;
|
|
27
29
|
if (!driver.compiler.hasLayerDeclaration(inputCss)) return;
|
|
28
30
|
ensureCodegen(state, { cwd, outdir: options.outdir });
|
|
29
|
-
|
|
31
|
+
syncProjectSources(state);
|
|
32
|
+
driver.syncDesignSystemSources();
|
|
30
33
|
registerDependencies(driver, result, cwd, fileName);
|
|
31
34
|
emitDiagnostics(root, result, driver.designSystemDiagnostics ?? []);
|
|
32
35
|
const output = driver.cssgen({ emitLayerDeclaration: false });
|
|
@@ -73,6 +76,22 @@ function ensureCodegen(state, options) {
|
|
|
73
76
|
state.driver.codegen({ cwd: options.cwd, outdir: options.outdir });
|
|
74
77
|
state.generatedOutdirs.add(outdirKey);
|
|
75
78
|
}
|
|
79
|
+
function syncProjectSources(state) {
|
|
80
|
+
const files = new Set(state.driver.scan());
|
|
81
|
+
const changes = [];
|
|
82
|
+
for (const path of state.parsedSources) {
|
|
83
|
+
if (!files.has(path)) {
|
|
84
|
+
changes.push({ path, kind: "unlink" });
|
|
85
|
+
state.parsedSources.delete(path);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const path of files) {
|
|
89
|
+
const known = state.parsedSources.has(path);
|
|
90
|
+
changes.push({ path, kind: known ? "change" : "add" });
|
|
91
|
+
state.parsedSources.add(path);
|
|
92
|
+
}
|
|
93
|
+
state.driver.applyChanges(changes);
|
|
94
|
+
}
|
|
76
95
|
function registerDependencies(driver, result, cwd, parent) {
|
|
77
96
|
for (const source of driver.compiler.sources()) {
|
|
78
97
|
result.messages.push(
|
|
@@ -127,11 +146,6 @@ function withPluginMetadata(message, parent) {
|
|
|
127
146
|
parent
|
|
128
147
|
};
|
|
129
148
|
}
|
|
130
|
-
function formatDiagnostic(diagnostic) {
|
|
131
|
-
const file = diagnostic.file ? `${diagnostic.file}` : "";
|
|
132
|
-
const location = diagnostic.location ? `:${diagnostic.location.start.line}:${diagnostic.location.start.column}` : diagnostic.span ? `:${diagnostic.span.start}` : "";
|
|
133
|
-
return `${diagnostic.severity} ${diagnostic.code} ${file}${location} ${diagnostic.message}`.replace(/\s+/g, " ");
|
|
134
|
-
}
|
|
135
149
|
function emitDiagnostics(root, result, diagnostics) {
|
|
136
150
|
const error = diagnostics.find((diagnostic) => diagnostic.severity === "error");
|
|
137
151
|
if (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/postcss",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.8",
|
|
4
4
|
"description": "PostCSS plugin for Panda CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@pandacss/compiler": "2.0.0-beta.
|
|
34
|
-
"@pandacss/compiler-shared": "2.0.0-beta.
|
|
33
|
+
"@pandacss/compiler": "2.0.0-beta.8",
|
|
34
|
+
"@pandacss/compiler-shared": "2.0.0-beta.8"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"postcss": ">=8"
|