@0001-labs/idv1 1.0.1 → 1.0.3

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 CHANGED
@@ -32,6 +32,8 @@ npx idv1 resolve co14Ch # one id, a -SH- qualified id or a junction, with i
32
32
 
33
33
  It runs on Node 22.18 or later. The same functions are exported for apps: `readArchitecture`, `architectureHealth`, `resolveCode`, `taxonomyOf`, `describeArchitecture`, `describeStatus` and `runArchitectureCommand`.
34
34
 
35
+ The package ships TypeScript source. Bundlers and `tsx` read it as is; for a plain Node script, import `@0001-labs/idv1/register` first, then load the code that imports the package with `await import()`.
36
+
35
37
  ## Upgrading from 0.3.x to Release 1
36
38
 
37
39
  Release 1 uses five shapes. Here `L` is an ASCII letter and `N` is a digit.
package/bin/idv1.mjs CHANGED
@@ -1,12 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, readFileSync } from 'node:fs'
3
3
  import { dirname, join, resolve } from 'node:path'
4
- import { register } from 'node:module'
5
-
6
- register('data:text/javascript,' + encodeURIComponent(`export async function resolve(specifier, context, next) {
7
- if (/^\\.\\.?\\//.test(specifier) && !/\\.[cm]?[jt]s$/.test(specifier) && context.parentURL?.includes('/src/')) return next(specifier + '.ts', context)
8
- return next(specifier, context)
9
- }`))
4
+ import '../register.mjs'
10
5
  const { runArchitectureCommand } = await import('../src/architecture.ts')
11
6
 
12
7
  const [command, ...args] = process.argv.slice(2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0001-labs/idv1",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Six-character IDs for agents: five shapes, taxonomy and namespaces, and a CLI that reads a codebase's .id file.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,18 +13,21 @@
13
13
  "files": [
14
14
  "bin/",
15
15
  "src/",
16
+ "register.mjs",
16
17
  "README.md",
17
18
  "LICENSE"
18
19
  ],
19
20
  "type": "module",
20
21
  "exports": {
21
- ".": "./src/index.ts"
22
+ ".": "./src/index.ts",
23
+ "./register": "./register.mjs"
22
24
  },
23
25
  "engines": {
24
26
  "node": ">=22.18"
25
27
  },
26
28
  "devDependencies": {
27
29
  "@types/node": "^22.13.1",
30
+ "tsrs": "0.18.0-ts7.1.0-dev.20260929",
28
31
  "typescript": "^6.0.3",
29
32
  "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
30
33
  "vite-plus": "1.3.0"
@@ -42,7 +45,7 @@
42
45
  }
43
46
  },
44
47
  "scripts": {
45
- "check": "vp exec tsc --noEmit",
48
+ "check": "vp exec tsrs --noEmit",
46
49
  "test": "vp test run",
47
50
  "release": "node scripts/release.mjs",
48
51
  "release:pilot": "node scripts/release-pilot.mjs"
package/register.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import { readFileSync } from 'node:fs'
2
+ import { registerHooks, stripTypeScriptTypes } from 'node:module'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const source = new URL('./src/', import.meta.url).href
6
+ const warn = process.emitWarning
7
+ process.emitWarning = (warning, ...rest) => String(warning).includes('stripTypeScriptTypes') ? undefined : warn.call(process, warning, ...rest)
8
+ registerHooks({
9
+ resolve: (specifier, context, next) => context.parentURL?.startsWith(source) && /^\.\.?\//.test(specifier) && !/\.[cm]?[jt]s$/.test(specifier) ? next(specifier + '.ts', context) : next(specifier, context),
10
+ load: (url, context, next) => url.startsWith(source) && url.endsWith('.ts') ? { format: 'module', source: stripTypeScriptTypes(readFileSync(fileURLToPath(url), 'utf8')), shortCircuit: true } : next(url, context),
11
+ })