@typestyles/vite 0.0.0-unstable.8bf64b0f3f7d → 0.0.0-unstable.921c88bcff7e

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
@@ -30,6 +30,7 @@ var import_node_path = require("path");
30
30
  var import_build_runner = require("@typestyles/build-runner");
31
31
  var import_build_runner2 = require("@typestyles/build-runner");
32
32
  var STYLES_COMPONENT_RE = /styles\.component\(\s*['"]([^'"]+)['"]/g;
33
+ var STYLES_CLASS_RE = /styles\.class\(\s*['"]([^'"]+)['"]/g;
33
34
  var TOKENS_CREATE_RE = /tokens\.create\(\s*['"]([^'"]+)['"]/g;
34
35
  var CREATE_THEME_RE = /(?:tokens\.)?createTheme\(\s*['"]([^'"]+)['"]/g;
35
36
  var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
@@ -47,6 +48,9 @@ function extractNamespaces(code) {
47
48
  for (const match of code.matchAll(STYLES_COMPONENT_RE)) {
48
49
  prefixes.push(`.${match[1]}-`);
49
50
  }
51
+ for (const match of code.matchAll(STYLES_CLASS_RE)) {
52
+ prefixes.push(`.${match[1]}-`);
53
+ }
50
54
  for (const match of code.matchAll(TOKENS_CREATE_RE)) {
51
55
  keys.push(`tokens:${match[1]}`);
52
56
  }
@@ -164,8 +168,8 @@ function typestylesPlugin(options = {}) {
164
168
  for (const prefix of prefixes) {
165
169
  if (other.prefixes.includes(prefix)) {
166
170
  const ns = prefix.slice(1, -1);
167
- this.warn(
168
- `Style namespace "${ns}" is also used in ${otherId}. Duplicate namespaces cause class name collisions.`
171
+ this.error(
172
+ `[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) }).`
169
173
  );
170
174
  }
171
175
  }
package/dist/index.d.cts CHANGED
@@ -17,7 +17,10 @@ interface TypestylesExtractOptions {
17
17
  fileName?: string;
18
18
  }
19
19
  interface TypestylesPluginOptions {
20
- /** Warn about duplicate namespaces across modules. Defaults to true. */
20
+ /**
21
+ * When true (default), fail the build if the same logical `styles.component` / `styles.class`
22
+ * namespace appears in more than one module. Set to `false` to skip this check.
23
+ */
21
24
  warnDuplicates?: boolean;
22
25
  /**
23
26
  * Mode for typestyles integration:
@@ -52,7 +55,7 @@ declare function extractNamespaces(code: string): {
52
55
  /**
53
56
  * Vite plugin for typestyles HMR support.
54
57
  *
55
- * When a module that registers typestyles (e.g. `styles.component`, `tokens.create`) is edited,
58
+ * When a module that registers typestyles (e.g. `styles.component`, `styles.class`, `tokens.create`) is edited,
56
59
  * this plugin injects HMR accept/dispose handlers that invalidate that module's registrations
57
60
  * before re-execution. Files may import from a local re-export such as `./typestyles` rather
58
61
  * than `from 'typestyles'` directly — we key off API call patterns in the source, not the import path.
package/dist/index.d.ts CHANGED
@@ -17,7 +17,10 @@ interface TypestylesExtractOptions {
17
17
  fileName?: string;
18
18
  }
19
19
  interface TypestylesPluginOptions {
20
- /** Warn about duplicate namespaces across modules. Defaults to true. */
20
+ /**
21
+ * When true (default), fail the build if the same logical `styles.component` / `styles.class`
22
+ * namespace appears in more than one module. Set to `false` to skip this check.
23
+ */
21
24
  warnDuplicates?: boolean;
22
25
  /**
23
26
  * Mode for typestyles integration:
@@ -52,7 +55,7 @@ declare function extractNamespaces(code: string): {
52
55
  /**
53
56
  * Vite plugin for typestyles HMR support.
54
57
  *
55
- * When a module that registers typestyles (e.g. `styles.component`, `tokens.create`) is edited,
58
+ * When a module that registers typestyles (e.g. `styles.component`, `styles.class`, `tokens.create`) is edited,
56
59
  * this plugin injects HMR accept/dispose handlers that invalidate that module's registrations
57
60
  * before re-execution. Files may import from a local re-export such as `./typestyles` rather
58
61
  * than `from 'typestyles'` directly — we key off API call patterns in the source, not the import path.
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  discoverDefaultExtractModules as discoverDefaultExtractModules2
7
7
  } from "@typestyles/build-runner";
8
8
  var STYLES_COMPONENT_RE = /styles\.component\(\s*['"]([^'"]+)['"]/g;
9
+ var STYLES_CLASS_RE = /styles\.class\(\s*['"]([^'"]+)['"]/g;
9
10
  var TOKENS_CREATE_RE = /tokens\.create\(\s*['"]([^'"]+)['"]/g;
10
11
  var CREATE_THEME_RE = /(?:tokens\.)?createTheme\(\s*['"]([^'"]+)['"]/g;
11
12
  var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
@@ -23,6 +24,9 @@ function extractNamespaces(code) {
23
24
  for (const match of code.matchAll(STYLES_COMPONENT_RE)) {
24
25
  prefixes.push(`.${match[1]}-`);
25
26
  }
27
+ for (const match of code.matchAll(STYLES_CLASS_RE)) {
28
+ prefixes.push(`.${match[1]}-`);
29
+ }
26
30
  for (const match of code.matchAll(TOKENS_CREATE_RE)) {
27
31
  keys.push(`tokens:${match[1]}`);
28
32
  }
@@ -140,8 +144,8 @@ function typestylesPlugin(options = {}) {
140
144
  for (const prefix of prefixes) {
141
145
  if (other.prefixes.includes(prefix)) {
142
146
  const ns = prefix.slice(1, -1);
143
- this.warn(
144
- `Style namespace "${ns}" is also used in ${otherId}. Duplicate namespaces cause class name collisions.`
147
+ this.error(
148
+ `[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) }).`
145
149
  );
146
150
  }
147
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typestyles/vite",
3
- "version": "0.0.0-unstable.8bf64b0f3f7d",
3
+ "version": "0.0.0-unstable.921c88bcff7e",
4
4
  "description": "Vite plugin for typestyles HMR support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -31,7 +31,7 @@
31
31
  "license": "Apache-2.0",
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "https://github.com/dbanksdesign/typestyles",
34
+ "url": "https://github.com/type-styles/typestyles",
35
35
  "directory": "packages/vite"
36
36
  },
37
37
  "peerDependencies": {
@@ -41,12 +41,12 @@
41
41
  "eslint": "^9.39.2",
42
42
  "tsup": "^8.0.0",
43
43
  "typescript": "^5.4.0",
44
- "typestyles": "0.0.0-unstable.8bf64b0f3f7d",
44
+ "typestyles": "0.0.0-unstable.921c88bcff7e",
45
45
  "vite": "^6.0.0",
46
46
  "vitest": "^3.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@typestyles/build-runner": "0.0.0-unstable.8bf64b0f3f7d"
49
+ "@typestyles/build-runner": "0.0.0-unstable.921c88bcff7e"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --external typestyles,@typestyles/build-runner",