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

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
@@ -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();
@@ -28,6 +29,7 @@ var pandacss = (options = {}) => {
28
29
  ensureCodegen(state, { cwd, outdir: options.outdir });
29
30
  driver.parseFiles();
30
31
  registerDependencies(driver, result, cwd, fileName);
32
+ emitDiagnostics(root, result, _nullishCoalesce(driver.designSystemDiagnostics, () => ( [])));
31
33
  const output = driver.cssgen({ emitLayerDeclaration: false });
32
34
  emitDiagnostics(root, result, output.diagnostics);
33
35
  root.append(output.css);
@@ -99,6 +101,19 @@ function registerDependencies(driver, result, cwd, parent) {
99
101
  )
100
102
  );
101
103
  }
104
+ for (const target of _nullishCoalesce(_optionalChain([driver, 'access', _3 => _3.designSystemWatchTargets, 'optionalCall', _4 => _4()]), () => ( []))) {
105
+ for (const file of [target.manifestPath, target.buildInfoPath, target.presetPath, ...target.sourceFiles]) {
106
+ result.messages.push(
107
+ withPluginMetadata(
108
+ {
109
+ type: "dependency",
110
+ file: _path.normalize.call(void 0, file)
111
+ },
112
+ parent
113
+ )
114
+ );
115
+ }
116
+ }
102
117
  }
103
118
  function createSourceDependency(source) {
104
119
  if (process.env.ROLLUP_WATCH === "true") {
@@ -113,18 +128,13 @@ function withPluginMetadata(message, parent) {
113
128
  parent
114
129
  };
115
130
  }
116
- function formatDiagnostic(diagnostic) {
117
- const file = diagnostic.file ? `${diagnostic.file}` : "";
118
- const location = diagnostic.location ? `:${diagnostic.location.start.line}:${diagnostic.location.start.column}` : diagnostic.span ? `:${diagnostic.span.start}` : "";
119
- return `${diagnostic.severity} ${diagnostic.code} ${file}${location} ${diagnostic.message}`.replace(/\s+/g, " ");
120
- }
121
131
  function emitDiagnostics(root, result, diagnostics) {
122
132
  const error = diagnostics.find((diagnostic) => diagnostic.severity === "error");
123
133
  if (error) {
124
- throw root.error(formatDiagnostic(error), { plugin: PLUGIN_NAME });
134
+ throw root.error(_compilershared.formatDiagnostic.call(void 0, error), { plugin: PLUGIN_NAME });
125
135
  }
126
136
  for (const diagnostic of diagnostics) {
127
- result.warn(formatDiagnostic(diagnostic), { plugin: PLUGIN_NAME });
137
+ result.warn(_compilershared.formatDiagnostic.call(void 0, diagnostic), { plugin: PLUGIN_NAME });
128
138
  }
129
139
  }
130
140
 
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();
@@ -28,6 +29,7 @@ var pandacss = (options = {}) => {
28
29
  ensureCodegen(state, { cwd, outdir: options.outdir });
29
30
  driver.parseFiles();
30
31
  registerDependencies(driver, result, cwd, fileName);
32
+ emitDiagnostics(root, result, driver.designSystemDiagnostics ?? []);
31
33
  const output = driver.cssgen({ emitLayerDeclaration: false });
32
34
  emitDiagnostics(root, result, output.diagnostics);
33
35
  root.append(output.css);
@@ -99,6 +101,19 @@ function registerDependencies(driver, result, cwd, parent) {
99
101
  )
100
102
  );
101
103
  }
104
+ for (const target of driver.designSystemWatchTargets?.() ?? []) {
105
+ for (const file of [target.manifestPath, target.buildInfoPath, target.presetPath, ...target.sourceFiles]) {
106
+ result.messages.push(
107
+ withPluginMetadata(
108
+ {
109
+ type: "dependency",
110
+ file: normalize(file)
111
+ },
112
+ parent
113
+ )
114
+ );
115
+ }
116
+ }
102
117
  }
103
118
  function createSourceDependency(source) {
104
119
  if (process.env.ROLLUP_WATCH === "true") {
@@ -113,11 +128,6 @@ function withPluginMetadata(message, parent) {
113
128
  parent
114
129
  };
115
130
  }
116
- function formatDiagnostic(diagnostic) {
117
- const file = diagnostic.file ? `${diagnostic.file}` : "";
118
- const location = diagnostic.location ? `:${diagnostic.location.start.line}:${diagnostic.location.start.column}` : diagnostic.span ? `:${diagnostic.span.start}` : "";
119
- return `${diagnostic.severity} ${diagnostic.code} ${file}${location} ${diagnostic.message}`.replace(/\s+/g, " ");
120
- }
121
131
  function emitDiagnostics(root, result, diagnostics) {
122
132
  const error = diagnostics.find((diagnostic) => diagnostic.severity === "error");
123
133
  if (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/postcss",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.7",
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.5",
34
- "@pandacss/compiler-shared": "2.0.0-beta.5"
33
+ "@pandacss/compiler": "2.0.0-beta.7",
34
+ "@pandacss/compiler-shared": "2.0.0-beta.7"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "postcss": ">=8"