@venizia/ignis-boot 0.4.7-2 → 0.4.7-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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-cache.d.ts","sourceRoot":"","sources":["../../../src/bun/scan-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scan-cache.d.ts","sourceRoot":"","sources":["../../../src/bun/scan-cache.ts"],"names":[],"mappings":"AAUA,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,oNAAoN;AACpN,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,KAAK;IAE5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAM/C,4KAA4K;IAC5K,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAmClD,iGAAiG;IACjG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,gBAAgB,EAAE,GAAG,SAAS;IAsBnE,uIAAuI;IACvI,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,gBAAgB,EAAE,CAAA;KAAE,GAAG,OAAO;CAoB7E"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { existsSync, globSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync, } from 'node:fs';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
2
|
import { dirname, join, resolve } from 'node:path';
|
|
4
3
|
import { ArtifactStereotypes } from '../generator/common/index.js';
|
|
5
4
|
/** The scanner's answer for one `src`, kept under the package's `node_modules/.cache` and valid while no `.ts` file under `src`, the package manifest or the lockfile changed - a hit skips TypeScript entirely. */
|
|
@@ -7,7 +6,7 @@ export class ArtifactScanCache {
|
|
|
7
6
|
static { this.VERSION = 2; }
|
|
8
7
|
static location(opts) {
|
|
9
8
|
const root = resolve(opts.root);
|
|
10
|
-
const key =
|
|
9
|
+
const key = new Bun.CryptoHasher('sha1').update(root).digest('hex').slice(0, 16);
|
|
11
10
|
return join(dirname(root), 'node_modules', '.cache', 'ignis-artifacts', `${key}.json`);
|
|
12
11
|
}
|
|
13
12
|
/** Path, size and mtime of every `.ts`/`.tsx` under `root`, plus the package manifest and the nearest lockfile (a dependency upgrade can change which decorators count). */
|
|
@@ -39,7 +38,7 @@ export class ArtifactScanCache {
|
|
|
39
38
|
const stats = statSync(file);
|
|
40
39
|
entries.push(`${file}:${stats.size}:${stats.mtimeMs}`);
|
|
41
40
|
}
|
|
42
|
-
return
|
|
41
|
+
return new Bun.CryptoHasher('sha1')
|
|
43
42
|
.update(`${ArtifactScanCache.VERSION}\n${entries.join('\n')}`)
|
|
44
43
|
.digest('hex');
|
|
45
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-cache.js","sourceRoot":"","sources":["../../../src/bun/scan-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"scan-cache.js","sourceRoot":"","sources":["../../../src/bun/scan-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,qBAAqB,CAAC;AAEjF,oNAAoN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AC,MAAM,CAAC;YACP,+DAA+D;YAC/D,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IACE,MAAM,CAAC,WAAW,KAAK,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC;YAC1D,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAChC,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,uIAAuI;IACvI,MAAM,CAAC,KAAK,CAAC,IAAqD;QAChE,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;QAC/C,IAAI,CAAC;YACH,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,aAAa,CACX,SAAS,EACT,IAAI,CAAC,SAAS,CAAC;gBACb,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC;gBAChD,SAAS,EAAE,IAAI,CAAC,SAAS;aAC1B,CAAC,CACH,CAAC;YACF,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;YACZ,uKAAuK;QACzK,CAAC;QAAC,MAAM,CAAC;YACP,oGAAoG;YACpG,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC","sourcesContent":["import {\n existsSync,\n globSync,\n mkdirSync,\n readFileSync,\n renameSync,\n statSync,\n writeFileSync,\n} from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { ArtifactStereotypes, type IScannedArtifact } from '../generator/common';\n\n/** The scanner's answer for one `src`, kept under the package's `node_modules/.cache` and valid while no `.ts` file under `src`, the package manifest or the lockfile changed - a hit skips TypeScript entirely. */\nexport class ArtifactScanCache {\n static readonly VERSION = 2;\n\n static location(opts: { root: string }): string {\n const root = resolve(opts.root);\n const key = new Bun.CryptoHasher('sha1').update(root).digest('hex').slice(0, 16);\n return join(dirname(root), 'node_modules', '.cache', 'ignis-artifacts', `${key}.json`);\n }\n\n /** Path, size and mtime of every `.ts`/`.tsx` under `root`, plus the package manifest and the nearest lockfile (a dependency upgrade can change which decorators count). */\n static fingerprint(opts: { root: string }): string {\n const root = resolve(opts.root);\n const entries: string[] = [];\n for (const relativePath of globSync(ArtifactStereotypes.SOURCE_GLOB, { cwd: root })) {\n const stats = statSync(join(root, relativePath));\n entries.push(`${relativePath}:${stats.size}:${stats.mtimeMs}`);\n }\n entries.sort();\n\n const extras = [join(dirname(root), 'package.json')];\n let directory = dirname(root);\n while (true) {\n const lockfile = ['bun.lock', 'bun.lockb', 'package-lock.json']\n .map((name) => join(directory, name))\n .find(existsSync);\n if (lockfile) {\n extras.push(lockfile);\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) {\n break;\n }\n directory = parent;\n }\n for (const file of extras.filter(existsSync)) {\n const stats = statSync(file);\n entries.push(`${file}:${stats.size}:${stats.mtimeMs}`);\n }\n\n return new Bun.CryptoHasher('sha1')\n .update(`${ArtifactScanCache.VERSION}\\n${entries.join('\\n')}`)\n .digest('hex');\n }\n\n /** The cached scan, or `undefined` for a missing, stale or unreadable cache - never an error. */\n static read(opts: { root: string }): IScannedArtifact[] | undefined {\n const file = ArtifactScanCache.location(opts);\n if (!existsSync(file)) {\n return undefined;\n }\n let stored: { fingerprint?: unknown; artifacts?: unknown };\n try {\n stored = JSON.parse(readFileSync(file, 'utf8'));\n // eslint-disable-next-line venizia/no-silent-catch -- a corrupt cache is a miss; the cause is not reported and the only cost is one fresh scan\n } catch {\n // A corrupt cache is a miss: the caller scans and rewrites it.\n return undefined;\n }\n if (\n stored.fingerprint !== ArtifactScanCache.fingerprint(opts) ||\n !Array.isArray(stored.artifacts)\n ) {\n return undefined;\n }\n return stored.artifacts;\n }\n\n /** Stores a scan; `false` when the cache directory cannot be written (a read-only install), which only costs the next start a scan. */\n static write(opts: { root: string; artifacts: IScannedArtifact[] }): boolean {\n const file = ArtifactScanCache.location(opts);\n const temporary = `${file}.${process.pid}.tmp`;\n try {\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(\n temporary,\n JSON.stringify({\n fingerprint: ArtifactScanCache.fingerprint(opts),\n artifacts: opts.artifacts,\n }),\n );\n renameSync(temporary, file);\n return true;\n // eslint-disable-next-line venizia/no-silent-catch -- the `false` returned below is the report; the cause of the failed write is lost and the next start pays one scan\n } catch {\n // Caching is an optimisation; reporting `false` lets the caller go on with the scan it already has.\n return false;\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-boot",
|
|
3
|
-
"version": "0.4.7-
|
|
3
|
+
"version": "0.4.7-3",
|
|
4
4
|
"description": "Build-time artifact index generator for IGNIS applications: scans decorated classes with the TypeScript AST and emits one static registration file per package, so bun build --compile sees plain imports.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"artifact-index",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"test": "bun test ./src"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@venizia/ignis-helpers": "0.4.7-
|
|
82
|
+
"@venizia/ignis-helpers": "0.4.7-3",
|
|
83
83
|
"@venizia/ignis-inversion": "0.4.6-1"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/bun": "^1.4.3",
|
|
87
|
-
"@venizia/dev-configs": "0.4.7-
|
|
87
|
+
"@venizia/dev-configs": "0.4.7-3",
|
|
88
88
|
"eslint": "^10.13.0",
|
|
89
89
|
"oxlint": "1.89.0",
|
|
90
90
|
"oxlint-tsgolint": "7.0.2004",
|