@10stars/config 16.0.1 → 16.0.4

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.
@@ -17,6 +17,18 @@
17
17
  "ignore": ["sx"]
18
18
  }
19
19
  ],
20
- "react/react-in-jsx-scope": "off"
20
+ "react/react-in-jsx-scope": "off",
21
+ "no-restricted-imports": [
22
+ "error",
23
+ {
24
+ "paths": [
25
+ {
26
+ "name": "@vanilla-extract/css",
27
+ "importNames": ["style"],
28
+ "message": "Do not use 'style' from '@vanilla-extract/css'. Use 'theme.layerStyle(import.meta, ...)' instead so the rule lands in a cascade layer"
29
+ }
30
+ ]
31
+ }
32
+ ]
21
33
  }
22
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10stars/config",
3
- "version": "16.0.1",
3
+ "version": "16.0.4",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "config": "./src/index.ts"
@@ -26,11 +26,12 @@
26
26
  "@types/node": "^26.1.0",
27
27
  "@types/react": "^19.2.17",
28
28
  "@types/react-dom": "^19.2.3",
29
+ "@typescript/native-preview": "7.0.0-dev.20260704.1",
29
30
  "husky": "^9.1.7",
30
31
  "oxfmt": "0.57.0",
31
32
  "oxlint": "^1.72.0",
32
33
  "oxlint-tsgolint": "^0.24.0",
33
- "tsx": "^4.22.5",
34
+ "tsx": "^4.23.0",
34
35
  "type-fest": "^5.7.0",
35
36
  "typescript": "7.0.1-rc"
36
37
  }
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import path from "node:path"
6
6
  import { resetColorIndex } from "./colors"
7
7
  import { checkIsMonorepo, dedupeSingletons, linkPackages } from "./link-packages"
8
8
  import { setupOverrides } from "./manage-overrides"
9
+ import { patchVanillaExtract } from "./patch-vanilla-extract"
9
10
  import { runConcurrently, type CommandConfig } from "./runner"
10
11
  import { setupVSCode } from "./vscode-config"
11
12
 
@@ -38,12 +39,12 @@ const getOxlintCommonCmd = async () => {
38
39
  return `${paths} ${quiet} --ignore-pattern '**/node_modules/**' --ignore-pattern '**/dist/**'`
39
40
  }
40
41
 
41
- const typecheckAndWatch = () => exec(`tsc --project ./tsconfig.json --noEmit --watch`)
42
-
43
42
  const actions = {
44
43
  prepare: {
45
44
  info: `Runs husky and links packages`,
46
45
  action: async () => {
46
+ await patchVanillaExtract(cwd) // patch VE before the CI guard: builds (incl. CI) need the `css.ts`-only filter in node_modules
47
+
47
48
  if (process.env.CI) return
48
49
 
49
50
  // we must copy it first, because the following steps might have formatting cmds
@@ -67,13 +68,9 @@ const actions = {
67
68
  }
68
69
  },
69
70
  },
70
- typecheckWatch: {
71
- info: "Typecheck code (in watch mode)",
72
- action: typecheckAndWatch,
73
- },
74
71
  ts: {
75
- info: `alias for 'typecheckWatch'`,
76
- action: typecheckAndWatch,
72
+ info: `Typecheck code (in watch mode)`,
73
+ action: () => exec(`tsgo --project ./tsconfig.json --noEmit --watch`), // watch uses tsgo (native-preview) for the FSEvents watcher fix absent from typescript@7.0.1-rc; non-watch typecheck stays on tsc
77
74
  },
78
75
  typecheck: {
79
76
  info: `Typecheck code (no watch)`,
@@ -0,0 +1,57 @@
1
+ import fs from "node:fs/promises"
2
+ import path from "node:path"
3
+
4
+ // Vanilla Extract hardcodes its file filter as a `const` regex in @vanilla-extract/integration and
5
+ // imports it into both its vite-plugin and its compiler — there's no option to customize it. We
6
+ // rewrite the regex on disk so ONLY `css.ts` (our single-filename convention) is treated as a VE
7
+ // module; the conventional `.css.ts` suffix is intentionally no longer matched.
8
+ // original: matches any `*.css.ts` (a `.` may precede `css`)
9
+ // patched: matches a `css.ts` filename (only start-of-path or a separator may precede `css`)
10
+ const ORIGINAL = String.raw`/\.css\.(js|cjs|mjs|jsx|ts|tsx)(\?used)?$/`
11
+ const PATCHED = String.raw`/(?:^|[/\\])css\.(js|cjs|mjs|jsx|ts|tsx)(\?used)?$/`
12
+
13
+ /**
14
+ * Rewrite VE's `cssFileFilter` to a `css.ts`-only matcher in every installed copy.
15
+ *
16
+ * Runs on `prepare` (postinstall), so it re-applies after each `bun install` re-materializes
17
+ * node_modules. Idempotent, and a no-op for repos without VE (e.g. backend-only). If VE is present
18
+ * but the filter definition can't be found, it throws: a silent miss would stop every `css.ts` from
19
+ * compiling, so a VE build change must surface at install time rather than as missing styles.
20
+ */
21
+ export const patchVanillaExtract = async (cwd: string) => {
22
+ const nodeModules = path.join(cwd, `node_modules`)
23
+ const glob = new Bun.Glob(`**/@vanilla-extract/integration/dist/*.js`)
24
+
25
+ let integrationFound = false
26
+ let definitionFound = false
27
+ const patched: string[] = []
28
+
29
+ for await (const rel of glob.scan({ cwd: nodeModules, onlyFiles: true })) {
30
+ integrationFound = true
31
+ const file = path.join(nodeModules, rel)
32
+ const content = await fs.readFile(file, `utf8`)
33
+
34
+ if (content.includes(PATCHED)) {
35
+ definitionFound = true // already patched by an earlier run
36
+ continue
37
+ }
38
+ if (!content.includes(ORIGINAL)) continue // entry stub / file without the filter definition
39
+
40
+ definitionFound = true
41
+ await fs.writeFile(file, content.replaceAll(ORIGINAL, PATCHED))
42
+ patched.push(rel)
43
+ }
44
+
45
+ if (!integrationFound) return // VE not installed here
46
+
47
+ if (!definitionFound) {
48
+ throw new Error(
49
+ `@10stars/config: found @vanilla-extract/integration but not its cssFileFilter definition — ` +
50
+ `the VE build likely changed. Update ORIGINAL in src/patch-vanilla-extract.ts.`,
51
+ )
52
+ }
53
+
54
+ if (patched.length) {
55
+ console.info(`Patched @vanilla-extract file filter to css.ts (${patched.length} file(s))`)
56
+ }
57
+ }