@0001-labs/idv1 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/bin/idv1.mjs +11 -2
  2. package/package.json +1 -1
package/bin/idv1.mjs CHANGED
@@ -3,9 +3,18 @@ import { existsSync, readFileSync } from 'node:fs'
3
3
  import { dirname, join, resolve } from 'node:path'
4
4
  import { register } from 'node:module'
5
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)
6
+ const source = new URL('../src/', import.meta.url).href
7
+ register('data:text/javascript,' + encodeURIComponent(`import { readFileSync } from 'node:fs'
8
+ import { stripTypeScriptTypes } from 'node:module'
9
+ import { fileURLToPath } from 'node:url'
10
+ const source = ${JSON.stringify(source)}
11
+ export async function resolve(specifier, context, next) {
12
+ if (context.parentURL?.startsWith(source) && /^\\.\\.?\\//.test(specifier) && !/\\.[cm]?[jt]s$/.test(specifier)) return next(specifier + '.ts', context)
8
13
  return next(specifier, context)
14
+ }
15
+ export async function load(url, context, next) {
16
+ if (url.startsWith(source) && url.endsWith('.ts')) return { format: 'module', source: stripTypeScriptTypes(readFileSync(fileURLToPath(url), 'utf8')), shortCircuit: true }
17
+ return next(url, context)
9
18
  }`))
10
19
  const { runArchitectureCommand } = await import('../src/architecture.ts')
11
20
 
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.2",
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": {