@typestyles/build-runner 0.0.0-unstable.1b93cffb0f10 → 0.0.0-unstable.1e43920aecc4
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/README.md +1 -1
- package/dist/index.cjs +6 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -164,7 +164,7 @@ Parses a file for typestyles registration calls. Returns `{ keys, prefixes }` fo
|
|
|
164
164
|
import { extractNamespaces } from '@typestyles/build-runner';
|
|
165
165
|
|
|
166
166
|
const { prefixes } = extractNamespaces(source);
|
|
167
|
-
//
|
|
167
|
+
// recipe('button', ...) → prefixes includes '.button-'
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
### `reportDuplicateNamespaces(map, fileId, prefixes, reporter)`
|
package/dist/index.cjs
CHANGED
|
@@ -94,12 +94,12 @@ function discoverRegisteredComponentsModule(root) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// src/namespaces.ts
|
|
97
|
-
var STYLES_COMPONENT_RE = /styles\.component\(\s*['"]([^'"]+)['"]/g;
|
|
98
|
-
var STYLES_CLASS_RE = /styles\.class\(\s*['"]([^'"]+)['"]/g;
|
|
97
|
+
var STYLES_COMPONENT_RE = /(?:styles\.component|(?<![\w.])recipe)\(\s*['"]([^'"]+)['"]/g;
|
|
98
|
+
var STYLES_CLASS_RE = /(?:styles\.class|(?<![\w.])style)\(\s*['"]([^'"]+)['"]/g;
|
|
99
99
|
var TOKENS_CREATE_RE = /tokens\.create\(\s*['"]([^'"]+)['"]/g;
|
|
100
100
|
var CREATE_THEME_CALL_RE = /(?:tokens\.)?createTheme\s*\(/g;
|
|
101
101
|
var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
|
|
102
|
-
var GLOBAL_STYLE_RE = /global\.style\(\s*['"]([^'"]+)['"]/g;
|
|
102
|
+
var GLOBAL_STYLE_RE = /global\.(?:rule|style)\(\s*['"]([^'"]+)['"]/g;
|
|
103
103
|
var GLOBAL_FONT_FACE_RE = /global\.fontFace\(\s*['"]([^'"]+)['"]/g;
|
|
104
104
|
var CREATE_THEME_ARG_SCAN = 4e3;
|
|
105
105
|
function extractCreateThemeNames(code) {
|
|
@@ -150,7 +150,7 @@ function collectOverrideHmrCallTargets(code) {
|
|
|
150
150
|
}
|
|
151
151
|
function moduleNeedsOverrideHmr(code) {
|
|
152
152
|
const scan = stripCommentsForHmrScan(code);
|
|
153
|
-
if (/\
|
|
153
|
+
if (/\b(?:styles\.)?override\s*\(/.test(scan)) return true;
|
|
154
154
|
const { locals, namespaces } = collectOverrideHmrCallTargets(scan);
|
|
155
155
|
for (const name of locals) {
|
|
156
156
|
if (new RegExp(`\\b${name}\\s*\\(`).test(scan)) return true;
|
|
@@ -515,10 +515,11 @@ async function traceTypestylesModules(root, entryFiles) {
|
|
|
515
515
|
}
|
|
516
516
|
return [...traced].sort();
|
|
517
517
|
}
|
|
518
|
+
var moduleLoadNonce = 0;
|
|
518
519
|
function createModuleLoader(root, modulePath) {
|
|
519
520
|
const abs = (0, import_node_path4.resolve)(root, modulePath);
|
|
520
521
|
const href = (0, import_node_url.pathToFileURL)(abs).href;
|
|
521
|
-
return () => import(href);
|
|
522
|
+
return () => import(`${href}?typestyles-extract=${++moduleLoadNonce}`);
|
|
522
523
|
}
|
|
523
524
|
|
|
524
525
|
// src/route-css.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -167,7 +167,7 @@ declare function discoverNextAppRoutes(root: string, appDir?: string): NextAppRo
|
|
|
167
167
|
* Paths are relative to `root` with `/` separators.
|
|
168
168
|
*/
|
|
169
169
|
declare function traceTypestylesModules(root: string, entryFiles: string[]): Promise<string[]>;
|
|
170
|
-
/** Load a traced module for style extraction. */
|
|
170
|
+
/** Load a traced module for style extraction (cache-busted so re-runs re-register styles). */
|
|
171
171
|
declare function createModuleLoader(root: string, modulePath: string): () => Promise<unknown>;
|
|
172
172
|
|
|
173
173
|
interface CollectRouteCssOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ declare function discoverNextAppRoutes(root: string, appDir?: string): NextAppRo
|
|
|
167
167
|
* Paths are relative to `root` with `/` separators.
|
|
168
168
|
*/
|
|
169
169
|
declare function traceTypestylesModules(root: string, entryFiles: string[]): Promise<string[]>;
|
|
170
|
-
/** Load a traced module for style extraction. */
|
|
170
|
+
/** Load a traced module for style extraction (cache-busted so re-runs re-register styles). */
|
|
171
171
|
declare function createModuleLoader(root: string, modulePath: string): () => Promise<unknown>;
|
|
172
172
|
|
|
173
173
|
interface CollectRouteCssOptions {
|
package/dist/index.js
CHANGED
|
@@ -45,12 +45,12 @@ function discoverRegisteredComponentsModule(root) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// src/namespaces.ts
|
|
48
|
-
var STYLES_COMPONENT_RE = /styles\.component\(\s*['"]([^'"]+)['"]/g;
|
|
49
|
-
var STYLES_CLASS_RE = /styles\.class\(\s*['"]([^'"]+)['"]/g;
|
|
48
|
+
var STYLES_COMPONENT_RE = /(?:styles\.component|(?<![\w.])recipe)\(\s*['"]([^'"]+)['"]/g;
|
|
49
|
+
var STYLES_CLASS_RE = /(?:styles\.class|(?<![\w.])style)\(\s*['"]([^'"]+)['"]/g;
|
|
50
50
|
var TOKENS_CREATE_RE = /tokens\.create\(\s*['"]([^'"]+)['"]/g;
|
|
51
51
|
var CREATE_THEME_CALL_RE = /(?:tokens\.)?createTheme\s*\(/g;
|
|
52
52
|
var KEYFRAMES_CREATE_RE = /keyframes\.create\(\s*['"]([^'"]+)['"]/g;
|
|
53
|
-
var GLOBAL_STYLE_RE = /global\.style\(\s*['"]([^'"]+)['"]/g;
|
|
53
|
+
var GLOBAL_STYLE_RE = /global\.(?:rule|style)\(\s*['"]([^'"]+)['"]/g;
|
|
54
54
|
var GLOBAL_FONT_FACE_RE = /global\.fontFace\(\s*['"]([^'"]+)['"]/g;
|
|
55
55
|
var CREATE_THEME_ARG_SCAN = 4e3;
|
|
56
56
|
function extractCreateThemeNames(code) {
|
|
@@ -101,7 +101,7 @@ function collectOverrideHmrCallTargets(code) {
|
|
|
101
101
|
}
|
|
102
102
|
function moduleNeedsOverrideHmr(code) {
|
|
103
103
|
const scan = stripCommentsForHmrScan(code);
|
|
104
|
-
if (/\
|
|
104
|
+
if (/\b(?:styles\.)?override\s*\(/.test(scan)) return true;
|
|
105
105
|
const { locals, namespaces } = collectOverrideHmrCallTargets(scan);
|
|
106
106
|
for (const name of locals) {
|
|
107
107
|
if (new RegExp(`\\b${name}\\s*\\(`).test(scan)) return true;
|
|
@@ -466,10 +466,11 @@ async function traceTypestylesModules(root, entryFiles) {
|
|
|
466
466
|
}
|
|
467
467
|
return [...traced].sort();
|
|
468
468
|
}
|
|
469
|
+
var moduleLoadNonce = 0;
|
|
469
470
|
function createModuleLoader(root, modulePath) {
|
|
470
471
|
const abs = resolve3(root, modulePath);
|
|
471
472
|
const href = pathToFileURL(abs).href;
|
|
472
|
-
return () => import(href);
|
|
473
|
+
return () => import(`${href}?typestyles-extract=${++moduleLoadNonce}`);
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
// src/route-css.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typestyles/build-runner",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.1e43920aecc4",
|
|
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.
|
|
32
|
+
"typestyles": "0.0.0-unstable.1e43920aecc4",
|
|
33
33
|
"vitest": "^3.0.0"
|
|
34
34
|
},
|
|
35
35
|
"license": "Apache-2.0",
|