@typestyles/rollup 0.0.0-unstable.6daacd18f2a2 → 0.0.0-unstable.74cb86313f08

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
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  module.exports = __toCommonJS(index_exports);
27
27
  var import_build_runner = require("@typestyles/build-runner");
28
28
  var STYLES_COMPONENT_RE = /styles\.component\(\s*['"]([^'"]+)['"]/g;
29
+ var STYLES_CLASS_RE = /styles\.class\(\s*['"]([^'"]+)['"]/g;
29
30
  var TOKENS_CREATE_RE = /tokens\.create\(\s*['"]([^'"]+)['"]/g;
30
31
  var CREATE_THEME_RE = /(?:tokens\.)?createTheme\(\s*['"]([^'"]+)['"]/g;
31
32
  var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
@@ -38,6 +39,9 @@ function extractNamespaces(code) {
38
39
  for (const match of code.matchAll(STYLES_COMPONENT_RE)) {
39
40
  prefixes.push(`.${match[1]}-`);
40
41
  }
42
+ for (const match of code.matchAll(STYLES_CLASS_RE)) {
43
+ prefixes.push(`.${match[1]}-`);
44
+ }
41
45
  for (const match of code.matchAll(TOKENS_CREATE_RE)) {
42
46
  keys.push(`tokens:${match[1]}`);
43
47
  }
@@ -78,8 +82,8 @@ function typestylesRollupPlugin(options = {}) {
78
82
  for (const prefix of prefixes) {
79
83
  if (other.prefixes.includes(prefix)) {
80
84
  const ns = prefix.slice(1, -1);
81
- this.warn(
82
- `Style namespace "${ns}" is also used in ${otherId}. Duplicate namespaces cause class name collisions.`
85
+ this.error(
86
+ `[typestyles] Style namespace "${ns}" is also used in ${otherId}. Duplicate namespaces cause class name collisions. Use a distinct name or isolate with createStyles({ scopeId: fileScopeId(import.meta) }).`
83
87
  );
84
88
  }
85
89
  }
package/dist/index.d.cts CHANGED
@@ -12,7 +12,10 @@ interface TypestylesExtractOptions {
12
12
  fileName?: string;
13
13
  }
14
14
  interface TypestylesRollupPluginOptions {
15
- /** Warn about duplicate namespaces across modules. Defaults to true. */
15
+ /**
16
+ * When true (default), fail the build if the same logical `styles.component` / `styles.class`
17
+ * namespace appears in more than one module. Set to `false` to skip this check.
18
+ */
16
19
  warnDuplicates?: boolean;
17
20
  /**
18
21
  * Integration mode:
package/dist/index.d.ts CHANGED
@@ -12,7 +12,10 @@ interface TypestylesExtractOptions {
12
12
  fileName?: string;
13
13
  }
14
14
  interface TypestylesRollupPluginOptions {
15
- /** Warn about duplicate namespaces across modules. Defaults to true. */
15
+ /**
16
+ * When true (default), fail the build if the same logical `styles.component` / `styles.class`
17
+ * namespace appears in more than one module. Set to `false` to skip this check.
18
+ */
16
19
  warnDuplicates?: boolean;
17
20
  /**
18
21
  * Integration mode:
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/index.ts
2
2
  import { runTypestylesBuild } from "@typestyles/build-runner";
3
3
  var STYLES_COMPONENT_RE = /styles\.component\(\s*['"]([^'"]+)['"]/g;
4
+ var STYLES_CLASS_RE = /styles\.class\(\s*['"]([^'"]+)['"]/g;
4
5
  var TOKENS_CREATE_RE = /tokens\.create\(\s*['"]([^'"]+)['"]/g;
5
6
  var CREATE_THEME_RE = /(?:tokens\.)?createTheme\(\s*['"]([^'"]+)['"]/g;
6
7
  var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
@@ -13,6 +14,9 @@ function extractNamespaces(code) {
13
14
  for (const match of code.matchAll(STYLES_COMPONENT_RE)) {
14
15
  prefixes.push(`.${match[1]}-`);
15
16
  }
17
+ for (const match of code.matchAll(STYLES_CLASS_RE)) {
18
+ prefixes.push(`.${match[1]}-`);
19
+ }
16
20
  for (const match of code.matchAll(TOKENS_CREATE_RE)) {
17
21
  keys.push(`tokens:${match[1]}`);
18
22
  }
@@ -53,8 +57,8 @@ function typestylesRollupPlugin(options = {}) {
53
57
  for (const prefix of prefixes) {
54
58
  if (other.prefixes.includes(prefix)) {
55
59
  const ns = prefix.slice(1, -1);
56
- this.warn(
57
- `Style namespace "${ns}" is also used in ${otherId}. Duplicate namespaces cause class name collisions.`
60
+ this.error(
61
+ `[typestyles] Style namespace "${ns}" is also used in ${otherId}. Duplicate namespaces cause class name collisions. Use a distinct name or isolate with createStyles({ scopeId: fileScopeId(import.meta) }).`
58
62
  );
59
63
  }
60
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typestyles/rollup",
3
- "version": "0.0.0-unstable.6daacd18f2a2",
3
+ "version": "0.0.0-unstable.74cb86313f08",
4
4
  "description": "Rollup and Rolldown plugin for typestyles",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -38,7 +38,7 @@
38
38
  "rollup": ">=4.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@typestyles/build-runner": "0.0.0-unstable.6daacd18f2a2"
41
+ "@typestyles/build-runner": "0.0.0-unstable.74cb86313f08"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^25.2.1",