@typestyles/build-runner 0.0.0-unstable.34d7fe289eb2 → 0.0.0-unstable.35e02a7f332b

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
@@ -31,7 +31,6 @@ __export(index_exports, {
31
31
  extractNamespaces: () => extractNamespaces,
32
32
  getRouteCss: () => getRouteCss,
33
33
  isManifestV2: () => isManifestV2,
34
- moduleNeedsOverrideHmr: () => moduleNeedsOverrideHmr,
35
34
  normalizeRoutePath: () => normalizeRoutePath,
36
35
  pageRelPathToRoutePath: () => pageRelPathToRoutePath,
37
36
  readCssFile: () => readCssFile,
@@ -81,50 +80,7 @@ var CREATE_THEME_RE = /(?:tokens\.)?createTheme\(\s*['"]([^'"]+)['"]/g;
81
80
  var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
82
81
  var GLOBAL_STYLE_RE = /global\.style\(\s*['"]([^'"]+)['"]/g;
83
82
  var GLOBAL_FONT_FACE_RE = /global\.fontFace\(\s*['"]([^'"]+)['"]/g;
84
- var OVERRIDE_HMR_EXPORT_NAMES = /* @__PURE__ */ new Set(["createDesignTheme", "overrideComponent"]);
85
83
  var TYPESTYLES_IMPORT_RE = /(?:from\s+|import\s+|require\s*\(\s*)['"]typestyles['"]/;
86
- function stripCommentsForHmrScan(code) {
87
- return code.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
88
- }
89
- function collectOverrideHmrCallTargets(code) {
90
- const locals = new Set(OVERRIDE_HMR_EXPORT_NAMES);
91
- const namespaces = /* @__PURE__ */ new Set();
92
- for (const match of code.matchAll(/import\s*{([^}]+)}\s*from\s*['"][^'"]+['"]/g)) {
93
- for (const rawPart of match[1].split(",")) {
94
- const part = rawPart.trim();
95
- if (!part || part.startsWith("type ")) continue;
96
- const asMatch = part.match(/^(\w+)\s+as\s+(\w+)$/);
97
- if (asMatch) {
98
- if (OVERRIDE_HMR_EXPORT_NAMES.has(asMatch[1])) {
99
- locals.add(asMatch[2]);
100
- }
101
- continue;
102
- }
103
- const name = part.match(/^(\w+)$/)?.[1];
104
- if (name && OVERRIDE_HMR_EXPORT_NAMES.has(name)) {
105
- locals.add(name);
106
- }
107
- }
108
- }
109
- for (const match of code.matchAll(/import\s*\*\s*as\s+(\w+)\s*from\s*['"][^'"]+['"]/g)) {
110
- namespaces.add(match[1]);
111
- }
112
- return { locals, namespaces };
113
- }
114
- function moduleNeedsOverrideHmr(code) {
115
- const scan = stripCommentsForHmrScan(code);
116
- if (/\bstyles\.override\s*\(/.test(scan)) return true;
117
- const { locals, namespaces } = collectOverrideHmrCallTargets(scan);
118
- for (const name of locals) {
119
- if (new RegExp(`\\b${name}\\s*\\(`).test(scan)) return true;
120
- }
121
- for (const ns of namespaces) {
122
- if (new RegExp(`\\b${ns}\\.(?:createDesignTheme|overrideComponent)\\s*\\(`).test(scan)) {
123
- return true;
124
- }
125
- }
126
- return false;
127
- }
128
84
  function extractNamespaces(code) {
129
85
  const keys = [];
130
86
  const prefixes = [];
@@ -657,7 +613,6 @@ ${result.stderr || result.stdout || "unknown error"}`
657
613
  extractNamespaces,
658
614
  getRouteCss,
659
615
  isManifestV2,
660
- moduleNeedsOverrideHmr,
661
616
  normalizeRoutePath,
662
617
  pageRelPathToRoutePath,
663
618
  readCssFile,
package/dist/index.d.cts CHANGED
@@ -10,15 +10,6 @@ declare const DEFAULT_EXTRACT_MODULE_CANDIDATES: readonly string[];
10
10
  declare function discoverDefaultExtractModules(root: string): string[];
11
11
 
12
12
  declare const TYPESTYLES_IMPORT_RE: RegExp;
13
- /**
14
- * True when this module may register `styles.override` rules and needs Vite HMR
15
- * dispose tracking — including Var UI sugar (`createDesignTheme` / `overrideComponent`)
16
- * that never spells `styles.override` in source.
17
- *
18
- * Detects renamed imports (`createDesignTheme as cdt`) and namespace imports
19
- * (`Core.createDesignTheme(`), not only the canonical identifier spelling.
20
- */
21
- declare function moduleNeedsOverrideHmr(code: string): boolean;
22
13
  /**
23
14
  * Extract namespace information from source code for invalidation and duplicate checks.
24
15
  */
@@ -203,4 +194,4 @@ interface RunTypestylesBuildOptions {
203
194
  */
204
195
  declare function runTypestylesBuild({ root, modules, }: RunTypestylesBuildOptions): Promise<string>;
205
196
 
206
- export { type CollectRouteCssOptions, type CollectRouteCssResult, DEFAULT_EXTRACT_MODULE_CANDIDATES, type DuplicateNamespaceReporter, type GetRouteCssOptions, type NextAppRoute, type RunTypestylesBuildOptions, TYPESTYLES_IMPORT_RE, type TypestylesExtractManifest, type TypestylesExtractManifestV1, type TypestylesExtractManifestV2, type TypestylesExtractOptions, type TypestylesIntegrationMode, type TypestylesRouteCssEntry, VerifyTypestylesBuildError, type VerifyTypestylesBuildOptions, type VerifyTypestylesBuildResult, buildManifestV2, collectAndWriteRouteCss, createModuleLoader, discoverDefaultExtractModules, discoverNextAppRoutes, extractNamespaces, getRouteCss, isManifestV2, moduleNeedsOverrideHmr, normalizeRoutePath, pageRelPathToRoutePath, readCssFile, readTypestylesManifest, reportDuplicateNamespaces, resolveExtractMode, resolveExtractModules, runTypestylesBuild, traceTypestylesModules, verifyTypestylesBuild };
197
+ export { type CollectRouteCssOptions, type CollectRouteCssResult, DEFAULT_EXTRACT_MODULE_CANDIDATES, type DuplicateNamespaceReporter, type GetRouteCssOptions, type NextAppRoute, type RunTypestylesBuildOptions, TYPESTYLES_IMPORT_RE, type TypestylesExtractManifest, type TypestylesExtractManifestV1, type TypestylesExtractManifestV2, type TypestylesExtractOptions, type TypestylesIntegrationMode, type TypestylesRouteCssEntry, VerifyTypestylesBuildError, type VerifyTypestylesBuildOptions, type VerifyTypestylesBuildResult, buildManifestV2, collectAndWriteRouteCss, createModuleLoader, discoverDefaultExtractModules, discoverNextAppRoutes, extractNamespaces, getRouteCss, isManifestV2, normalizeRoutePath, pageRelPathToRoutePath, readCssFile, readTypestylesManifest, reportDuplicateNamespaces, resolveExtractMode, resolveExtractModules, runTypestylesBuild, traceTypestylesModules, verifyTypestylesBuild };
package/dist/index.d.ts CHANGED
@@ -10,15 +10,6 @@ declare const DEFAULT_EXTRACT_MODULE_CANDIDATES: readonly string[];
10
10
  declare function discoverDefaultExtractModules(root: string): string[];
11
11
 
12
12
  declare const TYPESTYLES_IMPORT_RE: RegExp;
13
- /**
14
- * True when this module may register `styles.override` rules and needs Vite HMR
15
- * dispose tracking — including Var UI sugar (`createDesignTheme` / `overrideComponent`)
16
- * that never spells `styles.override` in source.
17
- *
18
- * Detects renamed imports (`createDesignTheme as cdt`) and namespace imports
19
- * (`Core.createDesignTheme(`), not only the canonical identifier spelling.
20
- */
21
- declare function moduleNeedsOverrideHmr(code: string): boolean;
22
13
  /**
23
14
  * Extract namespace information from source code for invalidation and duplicate checks.
24
15
  */
@@ -203,4 +194,4 @@ interface RunTypestylesBuildOptions {
203
194
  */
204
195
  declare function runTypestylesBuild({ root, modules, }: RunTypestylesBuildOptions): Promise<string>;
205
196
 
206
- export { type CollectRouteCssOptions, type CollectRouteCssResult, DEFAULT_EXTRACT_MODULE_CANDIDATES, type DuplicateNamespaceReporter, type GetRouteCssOptions, type NextAppRoute, type RunTypestylesBuildOptions, TYPESTYLES_IMPORT_RE, type TypestylesExtractManifest, type TypestylesExtractManifestV1, type TypestylesExtractManifestV2, type TypestylesExtractOptions, type TypestylesIntegrationMode, type TypestylesRouteCssEntry, VerifyTypestylesBuildError, type VerifyTypestylesBuildOptions, type VerifyTypestylesBuildResult, buildManifestV2, collectAndWriteRouteCss, createModuleLoader, discoverDefaultExtractModules, discoverNextAppRoutes, extractNamespaces, getRouteCss, isManifestV2, moduleNeedsOverrideHmr, normalizeRoutePath, pageRelPathToRoutePath, readCssFile, readTypestylesManifest, reportDuplicateNamespaces, resolveExtractMode, resolveExtractModules, runTypestylesBuild, traceTypestylesModules, verifyTypestylesBuild };
197
+ export { type CollectRouteCssOptions, type CollectRouteCssResult, DEFAULT_EXTRACT_MODULE_CANDIDATES, type DuplicateNamespaceReporter, type GetRouteCssOptions, type NextAppRoute, type RunTypestylesBuildOptions, TYPESTYLES_IMPORT_RE, type TypestylesExtractManifest, type TypestylesExtractManifestV1, type TypestylesExtractManifestV2, type TypestylesExtractOptions, type TypestylesIntegrationMode, type TypestylesRouteCssEntry, VerifyTypestylesBuildError, type VerifyTypestylesBuildOptions, type VerifyTypestylesBuildResult, buildManifestV2, collectAndWriteRouteCss, createModuleLoader, discoverDefaultExtractModules, discoverNextAppRoutes, extractNamespaces, getRouteCss, isManifestV2, normalizeRoutePath, pageRelPathToRoutePath, readCssFile, readTypestylesManifest, reportDuplicateNamespaces, resolveExtractMode, resolveExtractModules, runTypestylesBuild, traceTypestylesModules, verifyTypestylesBuild };
package/dist/index.js CHANGED
@@ -34,50 +34,7 @@ var CREATE_THEME_RE = /(?:tokens\.)?createTheme\(\s*['"]([^'"]+)['"]/g;
34
34
  var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
35
35
  var GLOBAL_STYLE_RE = /global\.style\(\s*['"]([^'"]+)['"]/g;
36
36
  var GLOBAL_FONT_FACE_RE = /global\.fontFace\(\s*['"]([^'"]+)['"]/g;
37
- var OVERRIDE_HMR_EXPORT_NAMES = /* @__PURE__ */ new Set(["createDesignTheme", "overrideComponent"]);
38
37
  var TYPESTYLES_IMPORT_RE = /(?:from\s+|import\s+|require\s*\(\s*)['"]typestyles['"]/;
39
- function stripCommentsForHmrScan(code) {
40
- return code.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
41
- }
42
- function collectOverrideHmrCallTargets(code) {
43
- const locals = new Set(OVERRIDE_HMR_EXPORT_NAMES);
44
- const namespaces = /* @__PURE__ */ new Set();
45
- for (const match of code.matchAll(/import\s*{([^}]+)}\s*from\s*['"][^'"]+['"]/g)) {
46
- for (const rawPart of match[1].split(",")) {
47
- const part = rawPart.trim();
48
- if (!part || part.startsWith("type ")) continue;
49
- const asMatch = part.match(/^(\w+)\s+as\s+(\w+)$/);
50
- if (asMatch) {
51
- if (OVERRIDE_HMR_EXPORT_NAMES.has(asMatch[1])) {
52
- locals.add(asMatch[2]);
53
- }
54
- continue;
55
- }
56
- const name = part.match(/^(\w+)$/)?.[1];
57
- if (name && OVERRIDE_HMR_EXPORT_NAMES.has(name)) {
58
- locals.add(name);
59
- }
60
- }
61
- }
62
- for (const match of code.matchAll(/import\s*\*\s*as\s+(\w+)\s*from\s*['"][^'"]+['"]/g)) {
63
- namespaces.add(match[1]);
64
- }
65
- return { locals, namespaces };
66
- }
67
- function moduleNeedsOverrideHmr(code) {
68
- const scan = stripCommentsForHmrScan(code);
69
- if (/\bstyles\.override\s*\(/.test(scan)) return true;
70
- const { locals, namespaces } = collectOverrideHmrCallTargets(scan);
71
- for (const name of locals) {
72
- if (new RegExp(`\\b${name}\\s*\\(`).test(scan)) return true;
73
- }
74
- for (const ns of namespaces) {
75
- if (new RegExp(`\\b${ns}\\.(?:createDesignTheme|overrideComponent)\\s*\\(`).test(scan)) {
76
- return true;
77
- }
78
- }
79
- return false;
80
- }
81
38
  function extractNamespaces(code) {
82
39
  const keys = [];
83
40
  const prefixes = [];
@@ -609,7 +566,6 @@ export {
609
566
  extractNamespaces,
610
567
  getRouteCss,
611
568
  isManifestV2,
612
- moduleNeedsOverrideHmr,
613
569
  normalizeRoutePath,
614
570
  pageRelPathToRoutePath,
615
571
  readCssFile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typestyles/build-runner",
3
- "version": "0.0.0-unstable.34d7fe289eb2",
3
+ "version": "0.0.0-unstable.35e02a7f332b",
4
4
  "description": "Shared module execution utilities for typestyles build integrations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -29,7 +29,7 @@
29
29
  "eslint": "^9.39.2",
30
30
  "tsup": "^8.0.0",
31
31
  "typescript": "^5.4.0",
32
- "typestyles": "0.0.0-unstable.34d7fe289eb2",
32
+ "typestyles": "0.0.0-unstable.35e02a7f332b",
33
33
  "vitest": "^3.0.0"
34
34
  },
35
35
  "license": "Apache-2.0",