@pandacss/postcss 2.0.0-beta.7 → 2.0.0-beta.9

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 CHANGED
@@ -16,18 +16,20 @@ var pandacss = (options = {}) => {
16
16
  let state = driverStates.get(key);
17
17
  if (!state) {
18
18
  const driver2 = await _compiler.createNodeDriver.call(void 0, { cwd, configPath: options.configPath });
19
- state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set() };
19
+ state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set(), parsedSources: /* @__PURE__ */ new Set() };
20
20
  driverStates.set(key, state);
21
21
  } else {
22
22
  const diff = await state.driver.reload();
23
23
  if (diff.hasChanged) {
24
24
  state.generatedOutdirs.clear();
25
+ state.parsedSources.clear();
25
26
  }
26
27
  }
27
28
  const { driver } = state;
28
29
  if (!driver.compiler.hasLayerDeclaration(inputCss)) return;
29
30
  ensureCodegen(state, { cwd, outdir: options.outdir });
30
- driver.parseFiles();
31
+ syncProjectSources(state);
32
+ driver.syncDesignSystemSources();
31
33
  registerDependencies(driver, result, cwd, fileName);
32
34
  emitDiagnostics(root, result, _nullishCoalesce(driver.designSystemDiagnostics, () => ( [])));
33
35
  const output = driver.cssgen({ emitLayerDeclaration: false });
@@ -74,6 +76,22 @@ function ensureCodegen(state, options) {
74
76
  state.driver.codegen({ cwd: options.cwd, outdir: options.outdir });
75
77
  state.generatedOutdirs.add(outdirKey);
76
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
+ }
77
95
  function registerDependencies(driver, result, cwd, parent) {
78
96
  for (const source of driver.compiler.sources()) {
79
97
  result.messages.push(
@@ -134,6 +152,10 @@ function emitDiagnostics(root, result, diagnostics) {
134
152
  throw root.error(_compilershared.formatDiagnostic.call(void 0, error), { plugin: PLUGIN_NAME });
135
153
  }
136
154
  for (const diagnostic of diagnostics) {
155
+ if (diagnostic.severity === "info") {
156
+ result.messages.push({ type: "pandacss-diagnostic", plugin: PLUGIN_NAME, diagnostic });
157
+ continue;
158
+ }
137
159
  result.warn(_compilershared.formatDiagnostic.call(void 0, diagnostic), { plugin: PLUGIN_NAME });
138
160
  }
139
161
  }
package/dist/index.js CHANGED
@@ -16,18 +16,20 @@ var pandacss = (options = {}) => {
16
16
  let state = driverStates.get(key);
17
17
  if (!state) {
18
18
  const driver2 = await createNodeDriver({ cwd, configPath: options.configPath });
19
- state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set() };
19
+ state = { driver: driver2, generatedOutdirs: /* @__PURE__ */ new Set(), parsedSources: /* @__PURE__ */ new Set() };
20
20
  driverStates.set(key, state);
21
21
  } else {
22
22
  const diff = await state.driver.reload();
23
23
  if (diff.hasChanged) {
24
24
  state.generatedOutdirs.clear();
25
+ state.parsedSources.clear();
25
26
  }
26
27
  }
27
28
  const { driver } = state;
28
29
  if (!driver.compiler.hasLayerDeclaration(inputCss)) return;
29
30
  ensureCodegen(state, { cwd, outdir: options.outdir });
30
- driver.parseFiles();
31
+ syncProjectSources(state);
32
+ driver.syncDesignSystemSources();
31
33
  registerDependencies(driver, result, cwd, fileName);
32
34
  emitDiagnostics(root, result, driver.designSystemDiagnostics ?? []);
33
35
  const output = driver.cssgen({ emitLayerDeclaration: false });
@@ -74,6 +76,22 @@ function ensureCodegen(state, options) {
74
76
  state.driver.codegen({ cwd: options.cwd, outdir: options.outdir });
75
77
  state.generatedOutdirs.add(outdirKey);
76
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
+ }
77
95
  function registerDependencies(driver, result, cwd, parent) {
78
96
  for (const source of driver.compiler.sources()) {
79
97
  result.messages.push(
@@ -134,6 +152,10 @@ function emitDiagnostics(root, result, diagnostics) {
134
152
  throw root.error(formatDiagnostic(error), { plugin: PLUGIN_NAME });
135
153
  }
136
154
  for (const diagnostic of diagnostics) {
155
+ if (diagnostic.severity === "info") {
156
+ result.messages.push({ type: "pandacss-diagnostic", plugin: PLUGIN_NAME, diagnostic });
157
+ continue;
158
+ }
137
159
  result.warn(formatDiagnostic(diagnostic), { plugin: PLUGIN_NAME });
138
160
  }
139
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/postcss",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.9",
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.7",
34
- "@pandacss/compiler-shared": "2.0.0-beta.7"
33
+ "@pandacss/compiler": "2.0.0-beta.9",
34
+ "@pandacss/compiler-shared": "2.0.0-beta.9"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "postcss": ">=8"