@venizia/ignis-boot 0.4.7 → 0.4.8-1
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/dist/esm/build-info/resolver.js.map +1 -1
- package/dist/esm/build-info/stamp.js.map +1 -1
- package/dist/esm/bun/auto-group.js.map +1 -1
- package/dist/esm/bun/auto-loader.js.map +1 -1
- package/dist/esm/bun/group-resolver.js.map +1 -1
- package/dist/esm/bun/plugin.js.map +1 -1
- package/dist/esm/bun/scan-cache.js.map +1 -1
- package/dist/esm/bun/sources.js.map +1 -1
- package/dist/esm/clis/artifacts.js.map +1 -1
- package/dist/esm/common/quiet-logger.js.map +1 -1
- package/dist/esm/generator/common/constants.d.ts +4 -0
- package/dist/esm/generator/common/constants.js +1 -0
- package/dist/esm/generator/common/constants.js.map +1 -1
- package/dist/esm/generator/common/types.d.ts +8 -1
- package/dist/esm/generator/common/types.js.map +1 -1
- package/dist/esm/generator/emitter.js.map +1 -1
- package/dist/esm/generator/generator.d.ts +6 -1
- package/dist/esm/generator/generator.js.map +1 -1
- package/dist/esm/generator/reexport.js.map +1 -1
- package/dist/esm/generator/scanner.js.map +1 -1
- package/dist/esm/vite/plugin.js.map +1 -1
- package/package.json +5 -4
- package/dist/esm/build-info/common/constants.d.ts.map +0 -1
- package/dist/esm/build-info/common/index.d.ts.map +0 -1
- package/dist/esm/build-info/index.d.ts.map +0 -1
- package/dist/esm/build-info/resolver.d.ts.map +0 -1
- package/dist/esm/build-info/stamp.d.ts.map +0 -1
- package/dist/esm/bun/auto-group.d.ts.map +0 -1
- package/dist/esm/bun/auto-loader.d.ts.map +0 -1
- package/dist/esm/bun/auto.d.ts.map +0 -1
- package/dist/esm/bun/group-resolver.d.ts.map +0 -1
- package/dist/esm/bun/index.d.ts.map +0 -1
- package/dist/esm/bun/plugin.d.ts.map +0 -1
- package/dist/esm/bun/scan-cache.d.ts.map +0 -1
- package/dist/esm/bun/sources.d.ts.map +0 -1
- package/dist/esm/clis/artifacts.d.ts.map +0 -1
- package/dist/esm/common/install-quiet-logger.d.ts.map +0 -1
- package/dist/esm/common/quiet-logger.d.ts.map +0 -1
- package/dist/esm/generator/common/constants.d.ts.map +0 -1
- package/dist/esm/generator/common/index.d.ts.map +0 -1
- package/dist/esm/generator/common/types.d.ts.map +0 -1
- package/dist/esm/generator/emitter.d.ts.map +0 -1
- package/dist/esm/generator/generator.d.ts.map +0 -1
- package/dist/esm/generator/index.d.ts.map +0 -1
- package/dist/esm/generator/reexport.d.ts.map +0 -1
- package/dist/esm/generator/scanner.d.ts.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/vite/index.d.ts.map +0 -1
- package/dist/esm/vite/plugin.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/build-info/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAyB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,yEAAyE;AACzE,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAG/C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,CAAC,IAAI,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AAC,CAAC,SAAS;gBACjD,OAAO,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aAC3D,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAEzE,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF","sourcesContent":["import { BaseHelper } from '@venizia/ignis-helpers';\nimport { BuildInfoRegistry, type TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport { execFile } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport { BuildInfoEnvironmentKeys } from './common';\n\nconst execFileAsync = promisify(execFile);\n\n/** Length of a short SHA; an env value already shorter is left alone. */\nconst COMMIT_LENGTH = 12;\n\n/**\n * Resolves the stamp: environment first (CI knows the release tag), then `git`, then the\n * manifest. Every miss is logged with its reason and degrades one field to\n * {@link BuildInfoRegistry.UNSPECIFIED} - a Distroless image has no `git` and an exported tarball\n * has no manifest, and a build must not die over a stamp.\n */\nexport class BuildInfoResolver extends BaseHelper {\n private static instance?: BuildInfoResolver;\n\n private constructor() {\n super({ scope: BuildInfoResolver.name });\n }\n\n static getInstance(): BuildInfoResolver {\n return (this.instance ??= new BuildInfoResolver());\n }\n\n async resolve(opts?: { root?: string }): Promise<TBuildInfoRecord> {\n const root = resolve(opts?.root ?? process.cwd());\n const manifest = this.resolveManifest({ root });\n\n // Independent processes; sequencing them would double the latency of the common case for nothing.\n const [gitCommit, gitBranch] = await Promise.all([\n this.resolveGitValue({ args: ['rev-parse', `--short=${COMMIT_LENGTH}`, 'HEAD'], root }),\n this.resolveGitValue({ args: ['rev-parse', '--abbrev-ref', 'HEAD'], root }),\n ]);\n\n const unspecified = BuildInfoRegistry.UNSPECIFIED;\n\n return {\n service: manifest.name ?? unspecified,\n version:\n this.resolveEnvironmentValue({ keys: BuildInfoEnvironmentKeys.VERSION }) ??\n manifest.version ??\n unspecified,\n commit:\n this.resolveEnvironmentValue({ keys: BuildInfoEnvironmentKeys.COMMIT })?.slice(\n 0,\n COMMIT_LENGTH,\n ) ??\n gitCommit ??\n unspecified,\n branch:\n this.resolveEnvironmentValue({ keys: BuildInfoEnvironmentKeys.BRANCH }) ??\n gitBranch ??\n unspecified,\n builtAt:\n this.resolveEnvironmentValue({ keys: BuildInfoEnvironmentKeys.BUILT_AT }) ??\n new Date().toISOString(),\n };\n }\n\n private resolveEnvironmentValue(opts: { keys: readonly string[] }): string | undefined {\n for (const key of opts.keys) {\n const value = process.env[key];\n\n if (value !== undefined && value.trim().length > 0) {\n return value.trim();\n }\n }\n\n return undefined;\n }\n\n /**\n * `execFile` runs `git` without a shell, so no argument is ever parsed by one. A nonzero exit and\n * `git` being absent are both a miss, logged and degraded to one field.\n */\n private async resolveGitValue(opts: {\n args: string[];\n root: string;\n }): Promise<string | undefined> {\n const { args, root } = opts;\n\n try {\n const { stdout } = await execFileAsync('git', args, { cwd: root, windowsHide: true });\n const value = stdout.trim();\n\n return value.length > 0 ? value : undefined;\n } catch (error) {\n // `rev-parse --abbrev-ref HEAD` in a repository with no commit prints the literal `HEAD` on\n // stdout while exiting 128, so the exit code decides and stdout alone never does: a nonzero\n // exit rejects here whatever it printed.\n const { code, stderr } = error as { code?: number | string; stderr?: string };\n\n if (typeof code === 'number') {\n this.logger.debug('git %s | exit: %d | %s', args.join(' '), code, (stderr ?? '').trim());\n } else {\n this.logger.debug('git %s | unavailable: %s', args.join(' '), error);\n }\n\n return undefined;\n }\n }\n\n /** `JSON.parse` promises nothing about the shape, so a manifest holding `{ \"name\": 42 }` must not become a numeric `service`. */\n private resolveManifest(opts: { root: string }): { name?: string; version?: string } {\n const manifest = resolve(opts.root, 'package.json');\n\n if (!existsSync(manifest)) {\n this.logger.debug('No package.json at %s', opts.root);\n\n return {};\n }\n\n try {\n const parsed: unknown = JSON.parse(readFileSync(manifest, 'utf8'));\n\n if (typeof parsed !== 'object' || parsed === null) {\n return {};\n }\n\n const name = 'name' in parsed ? parsed.name : undefined;\n const version = 'version' in parsed ? parsed.version : undefined;\n\n return {\n name: typeof name === 'string' ? name : undefined,\n version: typeof version === 'string' ? version : undefined,\n };\n } catch (error) {\n this.logger.debug('Unreadable package.json at %s | %s', manifest, error);\n\n return {};\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stamp.js","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAM/C;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACzB,+EAA+E;aAC/D,gBAAW,GAAG,kBAAkB,CAAC;IAEjD,yHAAyH;IACzH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAwB;QAC1C,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"stamp.js","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAM/C;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACzB,+EAA+E;aAC/D,gBAAW,GAAG,kBAAkB,CAAC;IAEjD,yHAAyH;IACzH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAwB;QAC1C,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAElE,OAAO,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ;QACnB,IAAI,KAAuB,CAAC;QAE5B,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE,CAAC;YAC5C,KAAK,GAAG,gBAAgB,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC;YACjE,KAAK,GAAG,QAAQ,CAAC;QACnB,CAAC;QAED,iBAAiB,CAAC,GAAG,CAAC;YACpB,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;SAClF,CAAC,CAAC;IACL,CAAC","sourcesContent":["import { BuildInfoRegistry, type TBuildInfoRecord } from '@venizia/ignis-helpers/core';\nimport { BuildInfoResolver } from './resolver';\n\n// A compile bakes the stamp in under this name (`define`); a run from source has no such name.\n// The identifier below must spell the same as `BuildInfoStamp.GLOBAL_NAME`.\ndeclare const IGNIS_BUILD_INFO: TBuildInfoRecord | undefined;\n\n/**\n * The build stamp, decided where it is cheap: a compile bakes it into the binary, a run from\n * source resolves it from git when the application starts.\n *\n * `define()` is for the compile script, `register()` for the entrypoint. A binary that carries the\n * stamp never runs git; the resolver is the only code here, and it needs no TypeScript scanner.\n */\nexport class BuildInfoStamp {\n /** The identifier `define()` replaces in the bundle and `register()` reads. */\n static readonly GLOBAL_NAME = 'IGNIS_BUILD_INFO';\n\n /** The `define` record for a compile: resolves the stamp now and returns it under {@link BuildInfoStamp.GLOBAL_NAME}. */\n static async define(opts?: { root?: string }): Promise<Record<string, string>> {\n const stamp = await BuildInfoResolver.getInstance().resolve(opts);\n\n return { [BuildInfoStamp.GLOBAL_NAME]: JSON.stringify(stamp) };\n }\n\n /**\n * Registers the stamp in {@link BuildInfoRegistry}: the baked value when the compile defined it,\n * else the resolver's. Only `commit`, `branch` and `builtAt` are set - `service` and `version`\n * stay with the application's `getAppInfo()`, which the health reporter reads when they are absent.\n */\n static async register(): Promise<void> {\n let stamp: TBuildInfoRecord;\n\n if (typeof IGNIS_BUILD_INFO !== 'undefined') {\n stamp = IGNIS_BUILD_INFO;\n } else {\n const resolved = await BuildInfoResolver.getInstance().resolve();\n stamp = resolved;\n }\n\n BuildInfoRegistry.set({\n buildInfo: { commit: stamp.commit, branch: stamp.branch, builtAt: stamp.builtAt },\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-group.js","sourceRoot":"","sources":["../../../src/bun/auto-group.ts"],"names":[],"mappings":"AAAA,2HAA2H;AAC3H,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,+RAA+R;AAC/R,MAAM,OAAO,iBAAiB;IAO5B,YAAY,IAGX;QATQ,oBAAe,GAAG,IAAa,CAAC;QAChC,WAAM,GAAG,SAAS,CAAC;QACnB,SAAI,GAAG,SAAS,CAAC;QAQxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-group.js","sourceRoot":"","sources":["../../../src/bun/auto-group.ts"],"names":[],"mappings":"AAAA,2HAA2H;AAC3H,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,+RAA+R;AAC/R,MAAM,OAAO,iBAAiB;IAO5B,YAAY,IAGX;QATQ,oBAAe,GAAG,IAAa,CAAC;QAChC,WAAM,GAAG,SAAS,CAAC;QACnB,SAAI,GAAG,SAAS,CAAC;QAQxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,8EAA8E;aACxF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,UAAU;QACvB,MAAM,QAAQ,CAAC;YACb,OAAO,EACL,sOAAsO;SACzO,CAAC,CAAC;IACL,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,YAAY;QACd,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;CACF","sourcesContent":["// The inversion package, not the helpers barrel: a browser bundle reaches this module, and the barrel loads node builtins.\nimport { getError } from '@venizia/ignis-inversion';\nimport type { TGeneratedArtifactIndex } from '../generator';\n\n/** The application's own artifacts as the kernel's group protocol (`isArtifactGroup`), built without depending on the kernel: inlined `content` in a binary, `resolve()` from source. Reading a kind throws, so a function that walks `configs.artifacts` cannot drop it as an empty index. */\nexport class AutoArtifactGroup {\n readonly isArtifactGroup = true as const;\n readonly folder = undefined;\n readonly site = undefined;\n readonly content: TGeneratedArtifactIndex | undefined;\n private readonly resolver: (() => Promise<TGeneratedArtifactIndex>) | undefined;\n\n constructor(opts: {\n content?: TGeneratedArtifactIndex;\n resolve?: () => Promise<TGeneratedArtifactIndex>;\n }) {\n this.content = opts.content;\n this.resolver = opts.resolve;\n }\n\n async resolve(): Promise<TGeneratedArtifactIndex> {\n if (this.content) {\n return this.content;\n }\n\n if (!this.resolver) {\n throw getError({\n message: '[@venizia/ignis-boot/auto] The auto group has neither content nor a resolver',\n });\n }\n\n return this.resolver();\n }\n\n private static unreadKind(): never {\n throw getError({\n message:\n '[@venizia/ignis-boot/auto] The application artifacts are resolved when artifacts are registered | A function that walks configs.artifacts must pass a group through untouched (check `isArtifactGroup`) instead of reading its kinds',\n });\n }\n\n get configurations(): never {\n return AutoArtifactGroup.unreadKind();\n }\n\n get dataSources(): never {\n return AutoArtifactGroup.unreadKind();\n }\n\n get components(): never {\n return AutoArtifactGroup.unreadKind();\n }\n\n get repositories(): never {\n return AutoArtifactGroup.unreadKind();\n }\n\n get services(): never {\n return AutoArtifactGroup.unreadKind();\n }\n\n get controllers(): never {\n return AutoArtifactGroup.unreadKind();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-loader.js","sourceRoot":"","sources":["../../../src/bun/auto-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,0MAA0M;AAC1M,MAAM,OAAO,mBAAmB;IAC9B,MAAM,CAAC,aAAa,CAAC,IAAyB;QAC5C,IAAI,CAAC,IAAI,CAAC,MAAM,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IAAI,GAAG,EAAqC,CAAC;QAE5D,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,KAAK,GAA2C,EAAE,CAAC;QAEzD,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,mBAAmB,CAAC,UAAU,EAAE,CAAC;YAC7D,MAAM,OAAO,GAAG,OAAO;iBACpB,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC;iBAC5C,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;iBACpE,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAErD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvB,KAAK,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["import { getError } from '@venizia/ignis-helpers';\nimport type { AnyType, TClass } from '@venizia/ignis-helpers';\nimport { dirname } from 'node:path';\nimport {\n ArtifactStereotypes,\n ArtifactTypes,\n type IScannedArtifact,\n type TGeneratedArtifactIndex,\n} from '../generator/common';\nimport { ArtifactSources } from './sources';\n\n/** Loads the application's index for `@venizia/ignis-boot/auto` from source: registers the run-time plugin, then imports the virtual module. A binary never runs this - the build replaces the module. */\nexport class AutoArtifactsLoader {\n static assertRuntime(opts: { hasBun: boolean }): void {\n if (!opts.hasBun) {\n throw getError({\n message:\n '[@venizia/ignis-boot/auto] Auto artifacts need Bun (a Bun plugin builds the index) | On Node, generate the index with `ignis-artifacts generate --root src --out src/_artifacts.ts` and pass it to configs.artifacts',\n });\n }\n }\n\n static async load(): Promise<TGeneratedArtifactIndex> {\n AutoArtifactsLoader.assertRuntime({ hasBun: typeof Bun !== 'undefined' });\n\n // A warm scan cache needs neither the plugin nor TypeScript: import the listed classes directly.\n const entry = ArtifactSources.entry();\n const packageSource = ArtifactSources.packageSource({\n from: entry ? dirname(entry) : process.cwd(),\n });\n\n if (ArtifactSources.isCached({ packageSource })) {\n const artifacts = ArtifactSources.scan({ packageSource });\n\n return AutoArtifactsLoader.importIndex({\n artifacts: entry ? ArtifactSources.runningArtifacts({ artifacts, from: entry }) : artifacts,\n });\n }\n\n // A non-static specifier: a bundler must not pull the scanner (and TypeScript) into a binary.\n const pluginModule = './plugin';\n const { IgnisArtifactsPlugin } = await import(pluginModule);\n await IgnisArtifactsPlugin.registerRuntime();\n\n // A static specifier on purpose: a build without IgnisArtifactsPlugin then fails to resolve it, instead of shipping a binary with no classes.\n const { GeneratedArtifacts } = await import('ignis:artifacts');\n\n return GeneratedArtifacts;\n }\n\n /** The index the emitter would render for `artifacts`: modules imported in path order, each field sorted by class name. */\n static async importIndex(opts: {\n artifacts: IScannedArtifact[];\n }): Promise<TGeneratedArtifactIndex> {\n const emitted = opts.artifacts\n .filter((artifact) => artifact.type !== ArtifactTypes.MODEL)\n .sort(\n (left, right) =>\n left.filePath.localeCompare(right.filePath) ||\n left.className.localeCompare(right.className),\n );\n\n const loaded = new Map<IScannedArtifact, TClass<AnyType>>();\n\n for (const artifact of emitted) {\n const module = await import(artifact.filePath);\n loaded.set(artifact, module[artifact.className]);\n }\n\n const index: Record<string, Array<TClass<AnyType>>> = {};\n\n for (const { type, field } of ArtifactStereotypes.EMIT_ORDER) {\n const classes = emitted\n .filter((artifact) => artifact.type === type)\n .sort((left, right) => left.className.localeCompare(right.className))\n .flatMap((artifact) => loaded.get(artifact) ?? []);\n\n if (classes.length > 0) {\n index[field] = classes;\n }\n }\n\n return index;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-resolver.js","sourceRoot":"","sources":["../../../src/bun/group-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAgC,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,2OAA2O;AAC3O,MAAM,OAAO,sBAAsB;IACjC,uGAAuG;aACvF,eAAU,GAAG,MAAM,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAEzF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAMpB;QACC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"group-resolver.js","sourceRoot":"","sources":["../../../src/bun/group-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAgC,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,2OAA2O;AAC3O,MAAM,OAAO,sBAAsB;IACjC,uGAAuG;aACvF,eAAU,GAAG,MAAM,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAEzF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAMpB;QACC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE5C,IAAI,CAAC,IAAI,EA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;QACpE,MAAM,CAAC,OAAO,GAAG,CAAC,WAMjB,EAAE,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-helpers';\nimport type { AnyType, TClass } from '@venizia/ignis-helpers';\nimport { ArtifactStereotypes, type TGeneratedArtifactIndex } from '../generator/common';\nimport { dirname } from 'node:path';\nimport { ArtifactSources } from './sources';\n\n/** Fills an `ArtifactGroup` defined without content, from source: the defining package is the nearest `package.json` above the group's call site, and the group is every decorated class under a directory named `folder` in its `src`. */\nexport class GroupArtifactsResolver {\n /** The kernel's `SingletonRealm` slot for the group resolver (`ArtifactGroup.SINGLETON_REALM_KEY`). */\n static readonly REALM_SLOT = Symbol.for('@venizia/ignis-kernel:artifact-group-resolver');\n\n static async resolve(opts: {\n group: {\n folder: string | undefined;\n site: string | undefined;\n ignore?: ReadonlyArray<string>;\n };\n }): Promise<TGeneratedArtifactIndex> {\n const { folder, site, ignore } = opts.group;\n\n if (!site) {\n throw getError({\n message: `[ArtifactGroup] '${folder ?? '<application>'}' has no call site to resolve from | Define it with ArtifactGroup.define in the shared package's own source`,\n });\n }\n\n if (\n !ArtifactSources.isCached({\n packageSource: ArtifactSources.packageSource({ from: dirname(site) }),\n })\n ) {\n await ArtifactSources.loadScanner();\n }\n\n const index: Record<string, Array<TClass<AnyType>>> = {};\n\n for (const artifact of ArtifactSources.folderArtifacts({ folder, site, ignore })) {\n const field = ArtifactStereotypes.EMIT_ORDER.find(\n (entry) => entry.type === artifact.type,\n )?.field;\n\n if (!field) {\n continue;\n }\n\n const loaded = await import(artifact.filePath);\n index[field] = [...(index[field] ?? []), loaded[artifact.className]];\n }\n\n return index;\n }\n\n /** Fills the kernel's realm slot; the holder may already exist (the kernel created it empty), so it is mutated, never replaced. */\n static install(): void {\n const existing: unknown = Reflect.get(globalThis, GroupArtifactsResolver.REALM_SLOT);\n const holder: { resolve?: unknown } =\n typeof existing === 'object' && existing !== null ? existing : {};\n holder.resolve = (resolveOpts: {\n group: {\n folder: string | undefined;\n site: string | undefined;\n ignore?: ReadonlyArray<string>;\n };\n }) => GroupArtifactsResolver.resolve(resolveOpts);\n Reflect.set(globalThis, GroupArtifactsResolver.REALM_SLOT, holder);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/bun/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,6QAA6Q;AAC7Q,MAAM,OAAO,oBAAoB;aACf,SAAI,GAAG,iBAAiB,CAAC;aACzB,YAAO,GAAG,iBAAiB,CAAC;aAC5B,gBAAW,GAAG,oBAAoB,CAAC;IAEnD,uIAAuI;aACvH,gBAAW,GACzB,0GAA0G,CAAC;IAE7G,oHAAoH;aACpG,gBAAW,GAAG,kDAAkD,CAAC;aAEzD,gBAAW,GAAG,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAEjG;QACE,eAAe,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,8GAA8G;IAC9G,MAAM,CAAC,WAAW,CAAC,OA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AS,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC;gBACnE,MAAM,UAAU,GAAG,MAAM;oBACvB,CAAC,CAAC,iIAAiI,oBAAoB,CAAC,OAAO,OAAO,oBAAoB,CAAC,WAAW,QAAQ;oBAC9M,CAAC,CAAC,YAAY,oBAAoB,CAAC,WAAW,YAAY,oBAAoB,CAAC,OAAO,0GAA0G,oBAAoB,CAAC,WAAW,QAAQ,CAAC;gBAC3O,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;oBAChE,QAAQ,EAAE,UAAU;oBACpB,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC,CAAC;YACN,CAAC;SACF,CAAC;IACJ,CAAC;IAED,gFAAgF;IAChF,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,OAA0B,EAAE;QACvD,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;YACvE,OAAO;QACT,CAAC;QACD,MAAM,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import type { BunPlugin } from 'bun';\nimport { getError } from '@venizia/ignis-helpers';\nimport { existsSync, globSync, readdirSync, readFileSync, realpathSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\nimport ts from 'typescript';\nimport { ArtifactIndexEmitter, ArtifactScanner, ArtifactStereotypes } from '../generator';\nimport { ArtifactSources } from './sources';\n\n/** Serves `ignis:artifacts` - the application's generated index, rendered in memory from the scanner. At run time it is a virtual module (`build.module`); in `Bun.build` it is resolved and loaded (`onResolve`/`onLoad`), so a binary carries the list and never scans. */\nexport class IgnisArtifactsPlugin {\n static readonly NAME = 'ignis-artifacts';\n static readonly VIRTUAL = 'ignis:artifacts';\n static readonly EXPORT_NAME = 'GeneratedArtifacts';\n\n /** `@venizia/ignis-boot/auto`, from source or from `dist/esm` - replaced at build time by a static re-export of the virtual module. */\n static readonly AUTO_MODULE =\n /[\\\\/](?:@venizia[\\\\/]ignis-boot|packages[\\\\/]boot)[\\\\/](?:dist[\\\\/]esm|src)[\\\\/]bun[\\\\/]auto\\.(?:ts|js)$/;\n\n /** A text test for a file worth parsing: `ArtifactGroup.define(`, with any spacing or line break around the dot. */\n static readonly DEFINE_CALL = /ArtifactGroup\\s*\\.\\s*(?:define|application)\\s*\\(/;\n\n private static readonly RUNTIME_KEY = Symbol.for('@venizia/ignis-boot:artifacts-runtime-plugin');\n\n static {\n ArtifactSources.useScanner({ scanner: ArtifactScanner.getInstance() });\n }\n\n /** The `src` beside the nearest `package.json` at or above `from` (default: the entry module's directory). */\n static defaultRoot(opts: { from?: string } = {}): string {\n return ArtifactSources.packageSource({\n from: opts.from ?? IgnisArtifactsPlugin.entryDirectory(),\n });\n }\n\n /** The entry module's directory (`Bun.main`), so the root never depends on where the process was started; the working directory only when there is no entry file (`bun -e`, a REPL). */\n static entryDirectory(): string {\n const entry = ArtifactSources.entry();\n return entry ? dirname(entry) : process.cwd();\n }\n\n /** The index as module source: every import absolute, since a virtual module has no directory to resolve from. With `entry` in a compiled tree, each class is imported from that tree (`ArtifactSources.runningArtifacts`). */\n static render(opts: { root: string; entry?: string }): string {\n const root = resolve(opts.root);\n if (!existsSync(root)) {\n throw getError({\n message: `[IgnisArtifactsPlugin] ${dirname(root)} has no src directory (${root}) | Auto artifacts scan the src beside the package.json of the entry module; pass IgnisArtifactsPlugin.create({ root }), or use ArtifactGroup.application() in the application's own source`,\n });\n }\n const outFile = join(root, '__ignis_artifacts__.ts');\n const artifacts = ArtifactSources.scan({ packageSource: root });\n return ArtifactIndexEmitter.render({\n artifacts: opts.entry\n ? ArtifactSources.runningArtifacts({ artifacts, from: opts.entry })\n : artifacts,\n outFile,\n exportName: IgnisArtifactsPlugin.EXPORT_NAME,\n command: { root, out: outFile },\n absoluteImports: true,\n });\n }\n\n /** Rewrites every `ArtifactGroup.define({ folder: '<literal>' })` and `ArtifactGroup.application()` in a source file to carry its classes as `content`, imported by absolute path - a binary then holds each group's list and never scans. A group with no decorated class, or a call the plugin cannot read (an aliased `ArtifactGroup`, a folder that is not a string literal), fails the build. */\n static rewriteGroups(opts: { filePath: string; source: string }): string {\n const { filePath, source } = opts;\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n const aliases = new Set<string>();\n for (const statement of sourceFile.statements) {\n const bindings = ts.isImportDeclaration(statement)\n ? statement.importClause?.namedBindings\n : undefined;\n for (const element of bindings && ts.isNamedImports(bindings) ? bindings.elements : []) {\n if (\n (element.propertyName ?? element.name).text === 'ArtifactGroup' &&\n element.name.text !== 'ArtifactGroup'\n ) {\n aliases.add(element.name.text);\n }\n }\n }\n\n const edits: Array<{ at: number; text: string }> = [];\n const imports: string[] = [];\n let counter = 0;\n\n const refuse = (node: ts.Node, reason: string): never => {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n throw getError({\n message: `[IgnisArtifactsPlugin] An ArtifactGroup call at ${filePath}:${line + 1} cannot be rewritten | ${reason} - write ArtifactGroup.define({ folder: '<name>' }) or ArtifactGroup.application() with the class imported under its own name`,\n });\n };\n\n const isCompiled = !ArtifactStereotypes.SOURCE_EXTENSION.test(filePath);\n const contentLiteral = (folder: string | undefined, ignore?: string[]): string => {\n const artifacts = ArtifactSources.folderArtifacts({ folder, site: filePath, ignore });\n if (artifacts.length === 0) {\n throw getError({\n message: `[IgnisArtifactsPlugin] ArtifactGroup '${folder ?? '<application>'}' resolved to no class | ${filePath} - check the folder name and that its classes carry a stereotype decorator`,\n });\n }\n\n const fields: string[] = [];\n for (const { type, field } of ArtifactStereotypes.EMIT_ORDER) {\n const locals = artifacts\n .filter((artifact) => artifact.type === type)\n .map((artifact) => {\n if (isCompiled) {\n return `require(${JSON.stringify(artifact.filePath)}).${artifact.className}`;\n }\n counter += 1;\n const local = `__ignis_group_${counter}`;\n const path = artifact.filePath\n .split(sep)\n .join('/')\n .replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n imports.push(`import { ${artifact.className} as ${local} } from '${path}';`);\n return local;\n });\n if (locals.length > 0) {\n fields.push(`${field}: [${locals.join(', ')}]`);\n }\n }\n return `{ ${fields.join(', ')} }`;\n };\n\n const visit = (node: ts.Node): void => {\n const isGroupCall =\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n (ts.isIdentifier(node.expression.expression) ||\n ts.isPropertyAccessExpression(node.expression.expression)) &&\n (node.expression.name.text === 'define' || node.expression.name.text === 'application');\n if (!isGroupCall) {\n ts.forEachChild(node, visit);\n return;\n }\n\n const call = node as ts.CallExpression;\n const access = call.expression as ts.PropertyAccessExpression;\n const target = access.expression;\n const callee = ts.isIdentifier(target)\n ? target.text\n : (target as ts.PropertyAccessExpression).name.text;\n const isApplication = access.name.text === 'application';\n if (ts.isIdentifier(target) && aliases.has(callee)) {\n refuse(call, `ArtifactGroup is imported as ${callee}`);\n }\n if (callee !== 'ArtifactGroup') {\n ts.forEachChild(node, visit);\n return;\n }\n\n const [argument] = call.arguments;\n if (isApplication && !argument) {\n edits.push({ at: call.arguments.pos, text: `{ content: ${contentLiteral(undefined)} }` });\n return;\n }\n if (!argument || !ts.isObjectLiteralExpression(argument)) {\n refuse(call, 'the argument is not an object literal');\n }\n\n const literal = argument as ts.ObjectLiteralExpression;\n const named = (name: string): ts.ObjectLiteralElementLike | undefined =>\n literal.properties.find(\n (entry) =>\n entry.name !== undefined && ts.isIdentifier(entry.name) && entry.name.text === name,\n );\n if (named('content')) {\n return;\n }\n\n const folderProperty = named('folder');\n if (isApplication && folderProperty) {\n refuse(call, 'ArtifactGroup.application() takes no folder');\n }\n const folderLiteral =\n folderProperty &&\n ts.isPropertyAssignment(folderProperty) &&\n ts.isStringLiteral(folderProperty.initializer)\n ? folderProperty.initializer.text\n : undefined;\n if (!isApplication && folderLiteral === undefined) {\n refuse(call, 'folder is not a string literal');\n }\n\n const ignoreProperty = named('ignore');\n const ignoreList =\n ignoreProperty &&\n ts.isPropertyAssignment(ignoreProperty) &&\n ts.isArrayLiteralExpression(ignoreProperty.initializer) &&\n ignoreProperty.initializer.elements.every((element) => ts.isStringLiteral(element))\n ? ignoreProperty.initializer.elements.map((element) => (element as ts.StringLiteral).text)\n : undefined;\n if (ignoreProperty && ignoreList === undefined) {\n refuse(call, 'ignore is not an array of string literals');\n }\n\n const last = literal.properties[literal.properties.length - 1];\n edits.push({\n at: last ? last.getEnd() : literal.getStart() + 1,\n text: `${last ? ', ' : ''}content: ${contentLiteral(folderLiteral, ignoreList)}`,\n });\n };\n visit(sourceFile);\n\n let rewritten = source;\n for (const edit of [...edits].sort((left, right) => right.at - left.at)) {\n rewritten = rewritten.slice(0, edit.at) + edit.text + rewritten.slice(edit.at);\n }\n return imports.length > 0 ? `${imports.join('\\n')}\\n${rewritten}` : rewritten;\n }\n\n /** A text test for a file worth parsing for decorated classes: an IGNIS stereotype decorator call. */\n static readonly DECORATED =\n /@(?:configuration|component|controller|service|repository|datasource|model|injectable)\\s*\\(/;\n\n /** The classes of a source file that carry an IGNIS stereotype decorator (`@service()`, `@repository(...)`, `@injectable(...)`...). */\n static decoratedClasses(opts: { filePath: string; source: string }): string[] {\n const names = new Set([\n ...Object.keys(ArtifactStereotypes.BY_DECORATOR),\n ArtifactStereotypes.ROOT_DECORATOR,\n ]);\n const sourceFile = ts.createSourceFile(\n opts.filePath,\n opts.source,\n ts.ScriptTarget.Latest,\n true,\n );\n const found: string[] = [];\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name) {\n const isDecorated = (ts.getDecorators(node) ?? []).some((decorator) => {\n const expression = ts.isCallExpression(decorator.expression)\n ? decorator.expression.expression\n : decorator.expression;\n return ts.isIdentifier(expression) && names.has(expression.text);\n });\n if (isDecorated) {\n found.push(node.name.text);\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n return found;\n }\n\n /** Opens each named class with `static { Object.defineProperty(this, 'name', ...) }`. Binding keys are built from `Class.name`, and a bundler renames classes - a minifier, or Bun's scope hoisting when a registered class shadows a same-name class it extends (`StockService` becomes `StockService2`). A string literal survives both, and a static block runs before the class's decorators. Only these classes are touched; the rest of the bundle is left alone. */\n static pinClassNames(opts: {\n filePath: string;\n source: string;\n classNames: ReadonlySet<string>;\n }): string {\n const sourceFile = ts.createSourceFile(\n opts.filePath,\n opts.source,\n ts.ScriptTarget.Latest,\n true,\n );\n const positions: Array<{ at: number; name: string }> = [];\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name && opts.classNames.has(node.name.text)) {\n positions.push({ at: node.members.pos, name: node.name.text });\n }\n ts.forEachChild(node, visit);\n };\n visit(sourceFile);\n\n let pinned = opts.source;\n for (const { at, name } of positions.sort((left, right) => right.at - left.at)) {\n const block = ` static { Object.defineProperty(this, 'name', { value: ${JSON.stringify(name)} }); }`;\n pinned = pinned.slice(0, at) + block + pinned.slice(at);\n }\n return pinned;\n }\n\n /** The classes whose names a build must pin, by the file the build loads: the app's own (from the tree `entry` runs, see `runningArtifacts`) and those of every package that defines a group the app can borrow (from the tree the group file sits in). */\n static pinnedClasses(opts: {\n root: string;\n groupFiles?: ReadonlyArray<string>;\n entry?: string;\n }): Map<string, Set<string>> {\n const byFile = new Map<string, Set<string>>();\n const add = (artifacts: ReadonlyArray<{ filePath: string; className: string }>): void => {\n for (const { filePath, className } of artifacts) {\n byFile.set(filePath, (byFile.get(filePath) ?? new Set()).add(className));\n }\n };\n const own = ArtifactSources.scan({ packageSource: opts.root });\n add(opts.entry ? ArtifactSources.runningArtifacts({ artifacts: own, from: opts.entry }) : own);\n // Every class carrying an IGNIS decorator in the workspace sources: a class nothing scans (a library that defines no group) is still an injection target, and still renamed by a bundler when its name collides.\n for (const file of IgnisArtifactsPlugin.workspaceSourceFiles({ root: opts.root })) {\n if (!ArtifactStereotypes.SOURCE_EXTENSION.test(file)) {\n continue;\n }\n const source = readFileSync(file, 'utf8');\n if (!IgnisArtifactsPlugin.DECORATED.test(source)) {\n continue;\n }\n add(\n IgnisArtifactsPlugin.decoratedClasses({ filePath: file, source }).map((className) => ({\n filePath: file,\n className,\n })),\n );\n }\n for (const groupFile of opts.groupFiles ?? []) {\n const packageSource = ArtifactSources.packageSource({ from: dirname(groupFile) });\n if (packageSource === opts.root || !existsSync(packageSource)) {\n continue;\n }\n add(\n ArtifactSources.runningArtifacts({\n artifacts: ArtifactSources.scan({ packageSource }),\n from: groupFile,\n }),\n );\n }\n return byFile;\n }\n\n /** The source files that define groups: the application's own `src` and the `src` of each workspace dependency (a dependency whose real path is outside every `node_modules`), found by walking up the `node_modules` chain as Node resolution does. */\n static groupDefinitionFiles(opts: { root: string }): string[] {\n return IgnisArtifactsPlugin.workspaceSourceFiles(opts).filter((file) =>\n IgnisArtifactsPlugin.DEFINE_CALL.test(readFileSync(file, 'utf8')),\n );\n }\n\n /** The source files of the application and of each workspace dependency (a dependency whose real path is outside every `node_modules`), found by walking up the `node_modules` chain as Node resolution does - plus the compiled trees beside each `src`, for a package that runs from `dist`. Tests excluded. */\n static workspaceSourceFiles(opts: { root: string }): string[] {\n const root = resolve(opts.root);\n const packageDirectory = dirname(root);\n const manifestPath = join(packageDirectory, 'package.json');\n const manifest = existsSync(manifestPath) ? JSON.parse(readFileSync(manifestPath, 'utf8')) : {};\n const names = Object.keys({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n });\n\n const sources = new Set<string>([root]);\n for (const name of names) {\n let directory = packageDirectory;\n while (true) {\n const linked = join(directory, 'node_modules', name);\n if (existsSync(linked)) {\n const real = realpathSync(linked);\n if (!real.split(sep).includes('node_modules') && existsSync(join(real, 'src'))) {\n sources.add(join(real, 'src'));\n }\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) {\n break;\n }\n directory = parent;\n }\n }\n\n // A package that runs from its compiled tree (`main` in dist) defines its groups there too.\n const trees: Array<{ directory: string; pattern: string }> = [];\n for (const source of sources) {\n if (!existsSync(source)) {\n continue;\n }\n trees.push({ directory: source, pattern: ArtifactStereotypes.SOURCE_GLOB });\n for (const entry of readdirSync(dirname(source), { withFileTypes: true })) {\n if (\n entry.isDirectory() &&\n !['src', 'node_modules'].includes(entry.name) &&\n !entry.name.startsWith('.')\n ) {\n trees.push({ directory: join(dirname(source), entry.name), pattern: '**/*.js' });\n }\n }\n }\n\n const files: string[] = [];\n for (const { directory, pattern } of trees) {\n for (const relativePath of globSync(pattern, { cwd: directory })) {\n if (!relativePath.includes('__tests__')) {\n files.push(join(directory, relativePath));\n }\n }\n }\n return files;\n }\n\n /** For `Bun.build({ plugins: [IgnisArtifactsPlugin.create()] })`; `isRuntime` is set by `registerRuntime`, which serves a virtual module instead. `entry` (default: the build's first entrypoint, or `Bun.main` at run time) decides which tree the classes are imported from. */\n static create(\n opts: { root?: string; entry?: string; isRuntime?: boolean; lazyIndex?: boolean } = {},\n ): BunPlugin {\n const isRuntime = opts.isRuntime ?? false;\n\n return {\n name: IgnisArtifactsPlugin.NAME,\n setup(build) {\n const [entrypoint] = isRuntime ? [] : build.config.entrypoints;\n const entry = opts.entry ?? (entrypoint ? resolve(entrypoint) : ArtifactSources.entry());\n const root =\n opts.root ??\n ArtifactSources.packageSource({ from: entry ? dirname(entry) : process.cwd() });\n const contents = (): string => IgnisArtifactsPlugin.render({ root, entry });\n\n if (isRuntime) {\n build.module(IgnisArtifactsPlugin.VIRTUAL, () => ({\n contents: contents(),\n loader: 'ts',\n }));\n return;\n }\n\n const virtualPath = join(resolve(root), '__ignis_artifacts__.ts');\n build.onResolve({ filter: /^ignis:artifacts$/ }, () => ({ path: virtualPath }));\n build.onLoad({ filter: /__ignis_artifacts__\\.ts$/ }, () => ({\n contents: contents(),\n loader: 'ts',\n }));\n const groupFiles = IgnisArtifactsPlugin.groupDefinitionFiles({ root });\n const groupFileSet = new Set(groupFiles);\n const pinned = IgnisArtifactsPlugin.pinnedClasses({ root, groupFiles, entry });\n const loaded = [...new Set([...groupFiles, ...pinned.keys()])];\n if (loaded.length > 0) {\n const escaped = loaded.map((file) => file.replace(/[.*+?^${}()|[\\]\\\\/]/g, '\\\\$&'));\n build.onLoad({ filter: new RegExp(`^(?:${escaped.join('|')})$`) }, (args) => {\n const source = readFileSync(args.path, 'utf8');\n const grouped = groupFileSet.has(args.path)\n ? IgnisArtifactsPlugin.rewriteGroups({ filePath: args.path, source })\n : source;\n const classNames = pinned.get(args.path);\n return {\n contents: classNames\n ? IgnisArtifactsPlugin.pinClassNames({\n filePath: args.path,\n source: grouped,\n classNames,\n })\n : grouped,\n loader: args.path.endsWith('.tsx') ? 'tsx' : args.path.endsWith('.ts') ? 'ts' : 'js',\n };\n });\n }\n // Lazy (a dynamic import on the first resolve) for a server: a library importing this module must not evaluate the app's classes inside its own half-loaded graph. Eager for a browser bundle: a lazily evaluated graph is not tree-shaken, which doubled a measured frontend bundle.\n const isLazy = opts.lazyIndex ?? build.config.target !== 'browser';\n const autoModule = isLazy\n ? `import { AutoArtifactGroup } from './auto-group';\\nexport default new AutoArtifactGroup({ resolve: async () => (await import('${IgnisArtifactsPlugin.VIRTUAL}')).${IgnisArtifactsPlugin.EXPORT_NAME} });\\n`\n : `import { ${IgnisArtifactsPlugin.EXPORT_NAME} } from '${IgnisArtifactsPlugin.VIRTUAL}';\\nimport { AutoArtifactGroup } from './auto-group';\\nexport default new AutoArtifactGroup({ content: ${IgnisArtifactsPlugin.EXPORT_NAME} });\\n`;\n build.onLoad({ filter: IgnisArtifactsPlugin.AUTO_MODULE }, () => ({\n contents: autoModule,\n loader: 'ts',\n }));\n },\n };\n }\n\n /** Registers the run-time plugin once per process; a second call is a no-op. */\n static async registerRuntime(opts: { root?: string } = {}): Promise<void> {\n if (Reflect.get(globalThis, IgnisArtifactsPlugin.RUNTIME_KEY) === true) {\n return;\n }\n await Bun.plugin(IgnisArtifactsPlugin.create({ ...opts, isRuntime: true }));\n Reflect.set(globalThis, IgnisArtifactsPlugin.RUNTIME_KEY, true);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/bun/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,6QAA6Q;AAC7Q,MAAM,OAAO,oBAAoB;aACf,SAAI,GAAG,iBAAiB,CAAC;aACzB,YAAO,GAAG,iBAAiB,CAAC;aAC5B,gBAAW,GAAG,oBAAoB,CAAC;IAEnD,uIAAuI;aACvH,gBAAW,GACzB,0GAA0G,CAAC;IAE7G,oHAAoH;aACpG,gBAAW,GAAG,kDAAkD,CAAC;aAEzD,gBAAW,GAAG,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAEjG;QACE,eAAe,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,8GAA8G;IAC9G,MAAM,CAAC,WAAW,CAAC,OAA0B,EAAE;QAC7C,OAAO,eAAe,CAAC,aAAa,CAAC;YACnC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,oBAAoB,CAAC,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GAAG,MAAM;oBACvB,CAAC,CAAC,iIAAiI,oBAAoB,CAAC,OAAO,OAAO,oBAAoB,CAAC,WAAW,QAAQ;oBAC9M,CAAC,CAAC,YAAY,oBAAoB,CAAC,WAAW,YAAY,oBAAoB,CAAC,OAAO,0GAA0G,oBAAoB,CAAC,WAAW,QAAQ,CAAC;gBAC3O,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;oBAChE,QAAQ,EAAE,UAAU;oBACpB,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC,CAAC;YACN,CAAC;SACF,CAAC;IACJ,CAAC;IAED,gFAAgF;IAChF,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,OAA0B,EAAE;QACvD,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;YACvE,OAAO;QACT,CAAC;QAED,MAAM,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import type { BunPlugin } from 'bun';\nimport { getError } from '@venizia/ignis-helpers';\nimport { existsSync, globSync, readdirSync, readFileSync, realpathSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\nimport ts from 'typescript';\nimport { ArtifactIndexEmitter, ArtifactScanner, ArtifactStereotypes } from '../generator';\nimport { ArtifactSources } from './sources';\n\n/** Serves `ignis:artifacts` - the application's generated index, rendered in memory from the scanner. At run time it is a virtual module (`build.module`); in `Bun.build` it is resolved and loaded (`onResolve`/`onLoad`), so a binary carries the list and never scans. */\nexport class IgnisArtifactsPlugin {\n static readonly NAME = 'ignis-artifacts';\n static readonly VIRTUAL = 'ignis:artifacts';\n static readonly EXPORT_NAME = 'GeneratedArtifacts';\n\n /** `@venizia/ignis-boot/auto`, from source or from `dist/esm` - replaced at build time by a static re-export of the virtual module. */\n static readonly AUTO_MODULE =\n /[\\\\/](?:@venizia[\\\\/]ignis-boot|packages[\\\\/]boot)[\\\\/](?:dist[\\\\/]esm|src)[\\\\/]bun[\\\\/]auto\\.(?:ts|js)$/;\n\n /** A text test for a file worth parsing: `ArtifactGroup.define(`, with any spacing or line break around the dot. */\n static readonly DEFINE_CALL = /ArtifactGroup\\s*\\.\\s*(?:define|application)\\s*\\(/;\n\n private static readonly RUNTIME_KEY = Symbol.for('@venizia/ignis-boot:artifacts-runtime-plugin');\n\n static {\n ArtifactSources.useScanner({ scanner: ArtifactScanner.getInstance() });\n }\n\n /** The `src` beside the nearest `package.json` at or above `from` (default: the entry module's directory). */\n static defaultRoot(opts: { from?: string } = {}): string {\n return ArtifactSources.packageSource({\n from: opts.from ?? IgnisArtifactsPlugin.entryDirectory(),\n });\n }\n\n /** The entry module's directory (`Bun.main`), so the root never depends on where the process was started; the working directory only when there is no entry file (`bun -e`, a REPL). */\n static entryDirectory(): string {\n const entry = ArtifactSources.entry();\n\n return entry ? dirname(entry) : process.cwd();\n }\n\n /** The index as module source: every import absolute, since a virtual module has no directory to resolve from. With `entry` in a compiled tree, each class is imported from that tree (`ArtifactSources.runningArtifacts`). */\n static render(opts: { root: string; entry?: string }): string {\n const root = resolve(opts.root);\n\n if (!existsSync(root)) {\n throw getError({\n message: `[IgnisArtifactsPlugin] ${dirname(root)} has no src directory (${root}) | Auto artifacts scan the src beside the package.json of the entry module; pass IgnisArtifactsPlugin.create({ root }), or use ArtifactGroup.application() in the application's own source`,\n });\n }\n\n const outFile = join(root, '__ignis_artifacts__.ts');\n const artifacts = ArtifactSources.scan({ packageSource: root });\n\n return ArtifactIndexEmitter.render({\n artifacts: opts.entry\n ? ArtifactSources.runningArtifacts({ artifacts, from: opts.entry })\n : artifacts,\n outFile,\n exportName: IgnisArtifactsPlugin.EXPORT_NAME,\n command: { root, out: outFile },\n absoluteImports: true,\n });\n }\n\n /** Rewrites every `ArtifactGroup.define({ folder: '<literal>' })` and `ArtifactGroup.application()` in a source file to carry its classes as `content`, imported by absolute path - a binary then holds each group's list and never scans. A group with no decorated class, or a call the plugin cannot read (an aliased `ArtifactGroup`, a folder that is not a string literal), fails the build. */\n static rewriteGroups(opts: { filePath: string; source: string }): string {\n const { filePath, source } = opts;\n const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true);\n const aliases = new Set<string>();\n\n for (const statement of sourceFile.statements) {\n const bindings = ts.isImportDeclaration(statement)\n ? statement.importClause?.namedBindings\n : undefined;\n\n for (const element of bindings && ts.isNamedImports(bindings) ? bindings.elements : []) {\n if (\n (element.propertyName ?? element.name).text === 'ArtifactGroup' &&\n element.name.text !== 'ArtifactGroup'\n ) {\n aliases.add(element.name.text);\n }\n }\n }\n\n const edits: Array<{ at: number; text: string }> = [];\n const imports: string[] = [];\n let counter = 0;\n\n const refuse = (node: ts.Node, reason: string): never => {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n throw getError({\n message: `[IgnisArtifactsPlugin] An ArtifactGroup call at ${filePath}:${line + 1} cannot be rewritten | ${reason} - write ArtifactGroup.define({ folder: '<name>' }) or ArtifactGroup.application() with the class imported under its own name`,\n });\n };\n\n const isCompiled = !ArtifactStereotypes.SOURCE_EXTENSION.test(filePath);\n\n const contentLiteral = (folder: string | undefined, ignore?: string[]): string => {\n const artifacts = ArtifactSources.folderArtifacts({ folder, site: filePath, ignore });\n\n if (artifacts.length === 0) {\n throw getError({\n message: `[IgnisArtifactsPlugin] ArtifactGroup '${folder ?? '<application>'}' resolved to no class | ${filePath} - check the folder name and that its classes carry a stereotype decorator`,\n });\n }\n\n const fields: string[] = [];\n\n for (const { type, field } of ArtifactStereotypes.EMIT_ORDER) {\n const locals = artifacts\n .filter((artifact) => artifact.type === type)\n .map((artifact) => {\n if (isCompiled) {\n return `require(${JSON.stringify(artifact.filePath)}).${artifact.className}`;\n }\n\n counter += 1;\n const local = `__ignis_group_${counter}`;\n const path = artifact.filePath\n .split(sep)\n .join('/')\n .replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n imports.push(`import { ${artifact.className} as ${local} } from '${path}';`);\n\n return local;\n });\n\n if (locals.length > 0) {\n fields.push(`${field}: [${locals.join(', ')}]`);\n }\n }\n\n return `{ ${fields.join(', ')} }`;\n };\n\n const visit = (node: ts.Node): void => {\n const isGroupCall =\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n (ts.isIdentifier(node.expression.expression) ||\n ts.isPropertyAccessExpression(node.expression.expression)) &&\n (node.expression.name.text === 'define' || node.expression.name.text === 'application');\n\n if (!isGroupCall) {\n ts.forEachChild(node, visit);\n\n return;\n }\n\n const call = node as ts.CallExpression;\n const access = call.expression as ts.PropertyAccessExpression;\n const target = access.expression;\n const callee = ts.isIdentifier(target)\n ? target.text\n : (target as ts.PropertyAccessExpression).name.text;\n const isApplication = access.name.text === 'application';\n\n if (ts.isIdentifier(target) && aliases.has(callee)) {\n refuse(call, `ArtifactGroup is imported as ${callee}`);\n }\n\n if (callee !== 'ArtifactGroup') {\n ts.forEachChild(node, visit);\n\n return;\n }\n\n const [argument] = call.arguments;\n\n if (isApplication && !argument) {\n edits.push({ at: call.arguments.pos, text: `{ content: ${contentLiteral(undefined)} }` });\n\n return;\n }\n\n if (!argument || !ts.isObjectLiteralExpression(argument)) {\n refuse(call, 'the argument is not an object literal');\n }\n\n const literal = argument as ts.ObjectLiteralExpression;\n const named = (name: string): ts.ObjectLiteralElementLike | undefined =>\n literal.properties.find(\n (entry) =>\n entry.name !== undefined && ts.isIdentifier(entry.name) && entry.name.text === name,\n );\n\n if (named('content')) {\n return;\n }\n\n const folderProperty = named('folder');\n\n if (isApplication && folderProperty) {\n refuse(call, 'ArtifactGroup.application() takes no folder');\n }\n\n const folderLiteral =\n folderProperty &&\n ts.isPropertyAssignment(folderProperty) &&\n ts.isStringLiteral(folderProperty.initializer)\n ? folderProperty.initializer.text\n : undefined;\n\n if (!isApplication && folderLiteral === undefined) {\n refuse(call, 'folder is not a string literal');\n }\n\n const ignoreProperty = named('ignore');\n const ignoreList =\n ignoreProperty &&\n ts.isPropertyAssignment(ignoreProperty) &&\n ts.isArrayLiteralExpression(ignoreProperty.initializer) &&\n ignoreProperty.initializer.elements.every((element) => ts.isStringLiteral(element))\n ? ignoreProperty.initializer.elements.map((element) => (element as ts.StringLiteral).text)\n : undefined;\n\n if (ignoreProperty && ignoreList === undefined) {\n refuse(call, 'ignore is not an array of string literals');\n }\n\n const last = literal.properties[literal.properties.length - 1];\n edits.push({\n at: last ? last.getEnd() : literal.getStart() + 1,\n text: `${last ? ', ' : ''}content: ${contentLiteral(folderLiteral, ignoreList)}`,\n });\n };\n\n visit(sourceFile);\n\n let rewritten = source;\n\n for (const edit of [...edits].sort((left, right) => right.at - left.at)) {\n rewritten = rewritten.slice(0, edit.at) + edit.text + rewritten.slice(edit.at);\n }\n\n return imports.length > 0 ? `${imports.join('\\n')}\\n${rewritten}` : rewritten;\n }\n\n /** A text test for a file worth parsing for decorated classes: an IGNIS stereotype decorator call. */\n static readonly DECORATED =\n /@(?:configuration|component|controller|service|repository|datasource|model|injectable)\\s*\\(/;\n\n /** The classes of a source file that carry an IGNIS stereotype decorator (`@service()`, `@repository(...)`, `@injectable(...)`...). */\n static decoratedClasses(opts: { filePath: string; source: string }): string[] {\n const names = new Set([\n ...Object.keys(ArtifactStereotypes.BY_DECORATOR),\n ArtifactStereotypes.ROOT_DECORATOR,\n ]);\n const sourceFile = ts.createSourceFile(\n opts.filePath,\n opts.source,\n ts.ScriptTarget.Latest,\n true,\n );\n const found: string[] = [];\n\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name) {\n const isDecorated = (ts.getDecorators(node) ?? []).some((decorator) => {\n const expression = ts.isCallExpression(decorator.expression)\n ? decorator.expression.expression\n : decorator.expression;\n\n return ts.isIdentifier(expression) && names.has(expression.text);\n });\n\n if (isDecorated) {\n found.push(node.name.text);\n }\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n return found;\n }\n\n /** Opens each named class with `static { Object.defineProperty(this, 'name', ...) }`. Binding keys are built from `Class.name`, and a bundler renames classes - a minifier, or Bun's scope hoisting when a registered class shadows a same-name class it extends (`StockService` becomes `StockService2`). A string literal survives both, and a static block runs before the class's decorators. Only these classes are touched; the rest of the bundle is left alone. */\n static pinClassNames(opts: {\n filePath: string;\n source: string;\n classNames: ReadonlySet<string>;\n }): string {\n const sourceFile = ts.createSourceFile(\n opts.filePath,\n opts.source,\n ts.ScriptTarget.Latest,\n true,\n );\n const positions: Array<{ at: number; name: string }> = [];\n\n const visit = (node: ts.Node): void => {\n if (ts.isClassDeclaration(node) && node.name && opts.classNames.has(node.name.text)) {\n positions.push({ at: node.members.pos, name: node.name.text });\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n let pinned = opts.source;\n\n for (const { at, name } of positions.sort((left, right) => right.at - left.at)) {\n const block = ` static { Object.defineProperty(this, 'name', { value: ${JSON.stringify(name)} }); }`;\n pinned = pinned.slice(0, at) + block + pinned.slice(at);\n }\n\n return pinned;\n }\n\n /** The classes whose names a build must pin, by the file the build loads: the app's own (from the tree `entry` runs, see `runningArtifacts`) and those of every package that defines a group the app can borrow (from the tree the group file sits in). */\n static pinnedClasses(opts: {\n root: string;\n groupFiles?: ReadonlyArray<string>;\n entry?: string;\n }): Map<string, Set<string>> {\n const byFile = new Map<string, Set<string>>();\n\n const add = (artifacts: ReadonlyArray<{ filePath: string; className: string }>): void => {\n for (const { filePath, className } of artifacts) {\n byFile.set(filePath, (byFile.get(filePath) ?? new Set()).add(className));\n }\n };\n\n const own = ArtifactSources.scan({ packageSource: opts.root });\n add(opts.entry ? ArtifactSources.runningArtifacts({ artifacts: own, from: opts.entry }) : own);\n\n // Every class carrying an IGNIS decorator in the workspace sources: a class nothing scans (a library that defines no group) is still an injection target, and still renamed by a bundler when its name collides.\n for (const file of IgnisArtifactsPlugin.workspaceSourceFiles({ root: opts.root })) {\n if (!ArtifactStereotypes.SOURCE_EXTENSION.test(file)) {\n continue;\n }\n\n const source = readFileSync(file, 'utf8');\n\n if (!IgnisArtifactsPlugin.DECORATED.test(source)) {\n continue;\n }\n\n add(\n IgnisArtifactsPlugin.decoratedClasses({ filePath: file, source }).map((className) => ({\n filePath: file,\n className,\n })),\n );\n }\n\n for (const groupFile of opts.groupFiles ?? []) {\n const packageSource = ArtifactSources.packageSource({ from: dirname(groupFile) });\n\n if (packageSource === opts.root || !existsSync(packageSource)) {\n continue;\n }\n\n add(\n ArtifactSources.runningArtifacts({\n artifacts: ArtifactSources.scan({ packageSource }),\n from: groupFile,\n }),\n );\n }\n\n return byFile;\n }\n\n /** The source files that define groups: the application's own `src` and the `src` of each workspace dependency (a dependency whose real path is outside every `node_modules`), found by walking up the `node_modules` chain as Node resolution does. */\n static groupDefinitionFiles(opts: { root: string }): string[] {\n return IgnisArtifactsPlugin.workspaceSourceFiles(opts).filter((file) =>\n IgnisArtifactsPlugin.DEFINE_CALL.test(readFileSync(file, 'utf8')),\n );\n }\n\n /** The source files of the application and of each workspace dependency (a dependency whose real path is outside every `node_modules`), found by walking up the `node_modules` chain as Node resolution does - plus the compiled trees beside each `src`, for a package that runs from `dist`. Tests excluded. */\n static workspaceSourceFiles(opts: { root: string }): string[] {\n const root = resolve(opts.root);\n const packageDirectory = dirname(root);\n const manifestPath = join(packageDirectory, 'package.json');\n const manifest = existsSync(manifestPath) ? JSON.parse(readFileSync(manifestPath, 'utf8')) : {};\n const names = Object.keys({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n });\n\n const sources = new Set<string>([root]);\n\n for (const name of names) {\n let directory = packageDirectory;\n\n while (true) {\n const linked = join(directory, 'node_modules', name);\n\n if (existsSync(linked)) {\n const real = realpathSync(linked);\n\n if (!real.split(sep).includes('node_modules') && existsSync(join(real, 'src'))) {\n sources.add(join(real, 'src'));\n }\n\n break;\n }\n\n const parent = dirname(directory);\n\n if (parent === directory) {\n break;\n }\n\n directory = parent;\n }\n }\n\n // A package that runs from its compiled tree (`main` in dist) defines its groups there too.\n const trees: Array<{ directory: string; pattern: string }> = [];\n\n for (const source of sources) {\n if (!existsSync(source)) {\n continue;\n }\n\n trees.push({ directory: source, pattern: ArtifactStereotypes.SOURCE_GLOB });\n\n for (const entry of readdirSync(dirname(source), { withFileTypes: true })) {\n if (\n entry.isDirectory() &&\n !['src', 'node_modules'].includes(entry.name) &&\n !entry.name.startsWith('.')\n ) {\n trees.push({ directory: join(dirname(source), entry.name), pattern: '**/*.js' });\n }\n }\n }\n\n const files: string[] = [];\n\n for (const { directory, pattern } of trees) {\n for (const relativePath of globSync(pattern, { cwd: directory })) {\n if (!relativePath.includes('__tests__')) {\n files.push(join(directory, relativePath));\n }\n }\n }\n\n return files;\n }\n\n /** For `Bun.build({ plugins: [IgnisArtifactsPlugin.create()] })`; `isRuntime` is set by `registerRuntime`, which serves a virtual module instead. `entry` (default: the build's first entrypoint, or `Bun.main` at run time) decides which tree the classes are imported from. */\n static create(\n opts: { root?: string; entry?: string; isRuntime?: boolean; lazyIndex?: boolean } = {},\n ): BunPlugin {\n const isRuntime = opts.isRuntime ?? false;\n\n return {\n name: IgnisArtifactsPlugin.NAME,\n setup(build) {\n const [entrypoint] = isRuntime ? [] : build.config.entrypoints;\n const entry = opts.entry ?? (entrypoint ? resolve(entrypoint) : ArtifactSources.entry());\n const root =\n opts.root ??\n ArtifactSources.packageSource({ from: entry ? dirname(entry) : process.cwd() });\n const contents = (): string => IgnisArtifactsPlugin.render({ root, entry });\n\n if (isRuntime) {\n build.module(IgnisArtifactsPlugin.VIRTUAL, () => ({\n contents: contents(),\n loader: 'ts',\n }));\n\n return;\n }\n\n const virtualPath = join(resolve(root), '__ignis_artifacts__.ts');\n build.onResolve({ filter: /^ignis:artifacts$/ }, () => ({ path: virtualPath }));\n build.onLoad({ filter: /__ignis_artifacts__\\.ts$/ }, () => ({\n contents: contents(),\n loader: 'ts',\n }));\n const groupFiles = IgnisArtifactsPlugin.groupDefinitionFiles({ root });\n const groupFileSet = new Set(groupFiles);\n const pinned = IgnisArtifactsPlugin.pinnedClasses({ root, groupFiles, entry });\n const loaded = [...new Set([...groupFiles, ...pinned.keys()])];\n\n if (loaded.length > 0) {\n const escaped = loaded.map((file) => file.replace(/[.*+?^${}()|[\\]\\\\/]/g, '\\\\$&'));\n build.onLoad({ filter: new RegExp(`^(?:${escaped.join('|')})$`) }, (args) => {\n const source = readFileSync(args.path, 'utf8');\n const grouped = groupFileSet.has(args.path)\n ? IgnisArtifactsPlugin.rewriteGroups({ filePath: args.path, source })\n : source;\n const classNames = pinned.get(args.path);\n\n return {\n contents: classNames\n ? IgnisArtifactsPlugin.pinClassNames({\n filePath: args.path,\n source: grouped,\n classNames,\n })\n : grouped,\n loader: args.path.endsWith('.tsx') ? 'tsx' : args.path.endsWith('.ts') ? 'ts' : 'js',\n };\n });\n }\n\n // Lazy (a dynamic import on the first resolve) for a server: a library importing this module must not evaluate the app's classes inside its own half-loaded graph. Eager for a browser bundle: a lazily evaluated graph is not tree-shaken, which doubled a measured frontend bundle.\n const isLazy = opts.lazyIndex ?? build.config.target !== 'browser';\n const autoModule = isLazy\n ? `import { AutoArtifactGroup } from './auto-group';\\nexport default new AutoArtifactGroup({ resolve: async () => (await import('${IgnisArtifactsPlugin.VIRTUAL}')).${IgnisArtifactsPlugin.EXPORT_NAME} });\\n`\n : `import { ${IgnisArtifactsPlugin.EXPORT_NAME} } from '${IgnisArtifactsPlugin.VIRTUAL}';\\nimport { AutoArtifactGroup } from './auto-group';\\nexport default new AutoArtifactGroup({ content: ${IgnisArtifactsPlugin.EXPORT_NAME} });\\n`;\n build.onLoad({ filter: IgnisArtifactsPlugin.AUTO_MODULE }, () => ({\n contents: autoModule,\n loader: 'ts',\n }));\n },\n };\n }\n\n /** Registers the run-time plugin once per process; a second call is a no-op. */\n static async registerRuntime(opts: { root?: string } = {}): Promise<void> {\n if (Reflect.get(globalThis, IgnisArtifactsPlugin.RUNTIME_KEY) === true) {\n return;\n }\n\n await Bun.plugin(IgnisArtifactsPlugin.create({ ...opts, isRuntime: true }));\n Reflect.set(globalThis, IgnisArtifactsPlugin.RUNTIME_KEY, true);\n }\n}\n"]}
|
|
@@ -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,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,qBAAqB,CAAC;AAEjF,oNAAoN;AACpN,MAAM,OAAO,iBAAiB;aACZ,YAAO,GAAG,CAAC,CAAC;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,IAAsB;QAClC,IAAI,EAAE,GAAG,UAAU,CAAC;QACpB,IAAI,EAAE,GAAG,UAAU,CAAC;QACpB,IAAI,EAAE,GAAG,UAAU,CAAC;QACpB,IAAI,EAAE,GAAG,UAAU,CAAC;QAEpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACtD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACzC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,CAAC,CAAC;YAC1C,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,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G,IAAI,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;QAE/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;YAE5B,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 /**\n * A 128-bit hash of `text` as 32 hex characters (cyrb128: four 32-bit lanes, public domain). It names a cache file and\n * tells a changed tree from an unchanged one; nothing here is a secret, so it needs no cryptographic strength. It is\n * plain arithmetic on purpose: this file runs under Vite, which runs under Node, where `Bun` and `node:crypto`\n * (removed from the sources) are not available, and under Bun alike. The same text gives the same string on both.\n */\n static digest(opts: { text: string }): string {\n let h1 = 1779033703;\n let h2 = 3144134277;\n let h3 = 1013904242;\n let h4 = 2773480762;\n\n for (let index = 0; index < opts.text.length; index++) {\n const code = opts.text.charCodeAt(index);\n h1 = h2 ^ Math.imul(h1 ^ code, 597399067);\n h2 = h3 ^ Math.imul(h2 ^ code, 2869860233);\n h3 = h4 ^ Math.imul(h3 ^ code, 951274213);\n h4 = h1 ^ Math.imul(h4 ^ code, 2716044179);\n }\n\n h1 = Math.imul(h3 ^ (h1 >>> 18), 597399067);\n h2 = Math.imul(h4 ^ (h2 >>> 22), 2869860233);\n h3 = Math.imul(h1 ^ (h3 >>> 17), 951274213);\n h4 = Math.imul(h2 ^ (h4 >>> 19), 2716044179);\n h1 ^= h2 ^ h3 ^ h4;\n h2 ^= h1;\n h3 ^= h1;\n h4 ^= h1;\n\n return [h1, h2, h3, h4].map((lane) => (lane >>> 0).toString(16).padStart(8, '0')).join('');\n }\n\n static location(opts: { root: string }): string {\n const root = resolve(opts.root);\n const key = ArtifactScanCache.digest({ text: root }).slice(0, 16);\n\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\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\n entries.sort();\n\n const extras = [join(dirname(root), 'package.json')];\n let directory = dirname(root);\n\n while (true) {\n const lockfile = ['bun.lock', 'bun.lockb', 'package-lock.json']\n .map((name) => join(directory, name))\n .find(existsSync);\n\n if (lockfile) {\n extras.push(lockfile);\n break;\n }\n\n const parent = dirname(directory);\n\n if (parent === directory) {\n break;\n }\n\n directory = parent;\n }\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 ArtifactScanCache.digest({\n text: `${ArtifactScanCache.VERSION}\\n${entries.join('\\n')}`,\n });\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\n if (!existsSync(file)) {\n return undefined;\n }\n\n let stored: { fingerprint?: unknown; artifacts?: unknown };\n\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\n if (\n stored.fingerprint !== ArtifactScanCache.fingerprint(opts) ||\n !Array.isArray(stored.artifacts)\n ) {\n return undefined;\n }\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\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\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/bun/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAyB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD,mSAAmS;AACnS,MAAM,OAAO,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CAAC;YACD,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yFAAyF;IACzF,MAAM,CAAC,KAAK;QACV,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-helpers';\nimport { existsSync } from 'node:fs';\nimport { dirname, join, matchesGlob, relative, resolve, sep } from 'node:path';\nimport { ArtifactStereotypes, type IScannedArtifact } from '../generator/common';\nimport { ArtifactScanCache } from './scan-cache';\n\ninterface IArtifactScanner {\n scanWithReport(opts: { root: string; followReexports: boolean }): {\n artifacts: IScannedArtifact[];\n };\n}\n\n/** Where a package's artifacts live: the `src` beside its nearest `package.json`, and the classes under one of its directories. One scan per package per process, served from `ArtifactScanCache` when no source file changed - so this module never loads the scanner (and TypeScript) itself. */\nexport class ArtifactSources {\n private static readonly scans = new Map<string, IScannedArtifact[]>();\n private static scanner: IArtifactScanner | undefined;\n\n /** Called by the modules that already hold the scanner (the build plugin). */\n static useScanner(opts: { scanner: IArtifactScanner }): void {\n ArtifactSources.scanner = opts.scanner;\n }\n\n /** Loads the scanner - only on a cache miss. A non-static specifier, so a bundle never pulls TypeScript in. */\n static async loadScanner(): Promise<void> {\n if (ArtifactSources.scanner) {\n return;\n }\n const generatorModule = '../generator';\n const { ArtifactScanner } = await import(generatorModule);\n ArtifactSources.scanner = ArtifactScanner.getInstance();\n }\n\n /** Whether `packageSource` can be listed without the scanner: scanned in this process, or a valid disk cache. */\n static isCached(opts: { packageSource: string }): boolean {\n if (ArtifactSources.scans.has(opts.packageSource)) {\n return true;\n }\n const cached = ArtifactScanCache.read({ root: opts.packageSource });\n if (cached) {\n ArtifactSources.scans.set(opts.packageSource, cached);\n }\n return cached !== undefined;\n }\n\n /** Every decorated class under `packageSource`: this process's scan, else the disk cache, else the scanner (which must be loaded), written back to the cache. */\n static scan(opts: { packageSource: string }): IScannedArtifact[] {\n const { packageSource } = opts;\n if (ArtifactSources.isCached({ packageSource })) {\n return ArtifactSources.scans.get(packageSource) ?? [];\n }\n if (!ArtifactSources.scanner) {\n throw getError({\n message: `[ArtifactSources] ${packageSource} is not cached and the scanner is not loaded | Call ArtifactSources.loadScanner() first`,\n });\n }\n const { artifacts } = ArtifactSources.scanner.scanWithReport({\n root: packageSource,\n followReexports: true,\n });\n ArtifactSources.scans.set(packageSource, artifacts);\n ArtifactScanCache.write({ root: packageSource, artifacts });\n return artifacts;\n }\n\n /** The entry module (`Bun.main`), or `undefined` when there is no entry file (`bun -e`, a REPL). */\n static entry(): string | undefined {\n return typeof Bun !== 'undefined' && existsSync(Bun.main) ? Bun.main : undefined;\n }\n\n /** The `src` beside the nearest `package.json` at or above `from` (default: the working directory). */\n static packageSource(opts: { from?: string } = {}): string {\n const start = resolve(opts.from ?? process.cwd());\n let directory = start;\n while (!existsSync(join(directory, 'package.json'))) {\n const parent = dirname(directory);\n if (parent === directory) {\n return join(start, 'src');\n }\n directory = parent;\n }\n return join(directory, 'src');\n }\n\n /** The decorated classes under a directory named `folder` in the package whose source holds `site`, less those under an `ignore` glob (relative to `src`), each pointing at the copy that runs beside `site` (see `runningArtifacts`). */\n static folderArtifacts(opts: {\n folder: string | undefined;\n site: string;\n ignore?: ReadonlyArray<string>;\n }): IScannedArtifact[] {\n const packageSource = ArtifactSources.packageSource({ from: dirname(opts.site) });\n\n const artifacts = ArtifactSources.scan({ packageSource });\n\n const { folder } = opts;\n const ignored = opts.ignore ?? [];\n const picked = artifacts.filter((artifact) => {\n const path = relative(packageSource, artifact.filePath);\n return (\n (folder === undefined || path.split(sep).slice(0, -1).includes(folder)) &&\n !ignored.some((pattern) => matchesGlob(path, pattern))\n );\n });\n return ArtifactSources.runningArtifacts({ artifacts: picked, from: opts.site });\n }\n\n /** The scanned classes as the code at `from` runs them: unchanged when `from` is in `src`; otherwise each `src/<path>.ts` becomes `<tree>/<path>.js` in the compiled tree `from` sits in (`dist`, `dist/esm`), so an application registers the very class its code uses, never a second copy loaded from `src`. */\n static runningArtifacts(opts: {\n artifacts: IScannedArtifact[];\n from: string;\n }): IScannedArtifact[] {\n const from = resolve(opts.from);\n const packageSource = ArtifactSources.packageSource({ from: dirname(from) });\n const [probe] = opts.artifacts;\n if (!probe || from.startsWith(`${packageSource}${sep}`)) {\n return opts.artifacts;\n }\n\n const packageRoot = dirname(packageSource);\n const compiledPath = (target: { tree: string; artifact: IScannedArtifact }): string =>\n join(\n target.tree,\n relative(packageSource, target.artifact.filePath).replace(\n ArtifactStereotypes.SOURCE_EXTENSION,\n '.js',\n ),\n );\n const segments = relative(packageRoot, dirname(from)).split(sep);\n const tree = segments\n .map((_segment, index) => join(packageRoot, ...segments.slice(0, index + 1)))\n .find((candidate) => existsSync(compiledPath({ tree: candidate, artifact: probe })));\n\n return opts.artifacts.map((artifact) => {\n const compiled = tree ? compiledPath({ tree, artifact }) : undefined;\n if (!compiled || !existsSync(compiled)) {\n throw getError({\n message: `[ArtifactSources] ${artifact.filePath} has no compiled copy beside ${from} | The package runs from a compiled tree that is older than its src - rebuild it (or run it from src)`,\n });\n }\n return { ...artifact, filePath: compiled };\n });\n }\n\n /** Forgets every cached scan - for a long-lived process that rebuilds (a watch mode). */\n static clear(): void {\n ArtifactSources.scans.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/bun/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAyB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD,mSAA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iBAC3L,CAAC,CAAC;YACL,CAAC;YAED,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yFAAyF;IACzF,MAAM,CAAC,KAAK;QACV,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-helpers';\nimport { existsSync } from 'node:fs';\nimport { dirname, join, matchesGlob, relative, resolve, sep } from 'node:path';\nimport { ArtifactStereotypes, type IScannedArtifact } from '../generator/common';\nimport { ArtifactScanCache } from './scan-cache';\n\ninterface IArtifactScanner {\n scanWithReport(opts: { root: string; followReexports: boolean }): {\n artifacts: IScannedArtifact[];\n };\n}\n\n/** Where a package's artifacts live: the `src` beside its nearest `package.json`, and the classes under one of its directories. One scan per package per process, served from `ArtifactScanCache` when no source file changed - so this module never loads the scanner (and TypeScript) itself. */\nexport class ArtifactSources {\n private static readonly scans = new Map<string, IScannedArtifact[]>();\n private static scanner: IArtifactScanner | undefined;\n\n /** Called by the modules that already hold the scanner (the build plugin). */\n static useScanner(opts: { scanner: IArtifactScanner }): void {\n ArtifactSources.scanner = opts.scanner;\n }\n\n /** Loads the scanner - only on a cache miss. A non-static specifier, so a bundle never pulls TypeScript in. */\n static async loadScanner(): Promise<void> {\n if (ArtifactSources.scanner) {\n return;\n }\n\n const generatorModule = '../generator';\n const { ArtifactScanner } = await import(generatorModule);\n ArtifactSources.scanner = ArtifactScanner.getInstance();\n }\n\n /** Whether `packageSource` can be listed without the scanner: scanned in this process, or a valid disk cache. */\n static isCached(opts: { packageSource: string }): boolean {\n if (ArtifactSources.scans.has(opts.packageSource)) {\n return true;\n }\n\n const cached = ArtifactScanCache.read({ root: opts.packageSource });\n\n if (cached) {\n ArtifactSources.scans.set(opts.packageSource, cached);\n }\n\n return cached !== undefined;\n }\n\n /** Every decorated class under `packageSource`: this process's scan, else the disk cache, else the scanner (which must be loaded), written back to the cache. */\n static scan(opts: { packageSource: string }): IScannedArtifact[] {\n const { packageSource } = opts;\n\n if (ArtifactSources.isCached({ packageSource })) {\n return ArtifactSources.scans.get(packageSource) ?? [];\n }\n\n if (!ArtifactSources.scanner) {\n throw getError({\n message: `[ArtifactSources] ${packageSource} is not cached and the scanner is not loaded | Call ArtifactSources.loadScanner() first`,\n });\n }\n\n const { artifacts } = ArtifactSources.scanner.scanWithReport({\n root: packageSource,\n followReexports: true,\n });\n ArtifactSources.scans.set(packageSource, artifacts);\n ArtifactScanCache.write({ root: packageSource, artifacts });\n\n return artifacts;\n }\n\n /** The entry module (`Bun.main`), or `undefined` when there is no entry file (`bun -e`, a REPL). */\n static entry(): string | undefined {\n return typeof Bun !== 'undefined' && existsSync(Bun.main) ? Bun.main : undefined;\n }\n\n /** The `src` beside the nearest `package.json` at or above `from` (default: the working directory). */\n static packageSource(opts: { from?: string } = {}): string {\n const start = resolve(opts.from ?? process.cwd());\n let directory = start;\n\n while (!existsSync(join(directory, 'package.json'))) {\n const parent = dirname(directory);\n\n if (parent === directory) {\n return join(start, 'src');\n }\n\n directory = parent;\n }\n\n return join(directory, 'src');\n }\n\n /** The decorated classes under a directory named `folder` in the package whose source holds `site`, less those under an `ignore` glob (relative to `src`), each pointing at the copy that runs beside `site` (see `runningArtifacts`). */\n static folderArtifacts(opts: {\n folder: string | undefined;\n site: string;\n ignore?: ReadonlyArray<string>;\n }): IScannedArtifact[] {\n const packageSource = ArtifactSources.packageSource({ from: dirname(opts.site) });\n\n const artifacts = ArtifactSources.scan({ packageSource });\n\n const { folder } = opts;\n const ignored = opts.ignore ?? [];\n const picked = artifacts.filter((artifact) => {\n const path = relative(packageSource, artifact.filePath);\n\n return (\n (folder === undefined || path.split(sep).slice(0, -1).includes(folder)) &&\n !ignored.some((pattern) => matchesGlob(path, pattern))\n );\n });\n\n return ArtifactSources.runningArtifacts({ artifacts: picked, from: opts.site });\n }\n\n /** The scanned classes as the code at `from` runs them: unchanged when `from` is in `src`; otherwise each `src/<path>.ts` becomes `<tree>/<path>.js` in the compiled tree `from` sits in (`dist`, `dist/esm`), so an application registers the very class its code uses, never a second copy loaded from `src`. */\n static runningArtifacts(opts: {\n artifacts: IScannedArtifact[];\n from: string;\n }): IScannedArtifact[] {\n const from = resolve(opts.from);\n const packageSource = ArtifactSources.packageSource({ from: dirname(from) });\n const [probe] = opts.artifacts;\n\n if (!probe || from.startsWith(`${packageSource}${sep}`)) {\n return opts.artifacts;\n }\n\n const packageRoot = dirname(packageSource);\n const compiledPath = (target: { tree: string; artifact: IScannedArtifact }): string =>\n join(\n target.tree,\n relative(packageSource, target.artifact.filePath).replace(\n ArtifactStereotypes.SOURCE_EXTENSION,\n '.js',\n ),\n );\n const segments = relative(packageRoot, dirname(from)).split(sep);\n const tree = segments\n .map((_segment, index) => join(packageRoot, ...segments.slice(0, index + 1)))\n .find((candidate) => existsSync(compiledPath({ tree: candidate, artifact: probe })));\n\n return opts.artifacts.map((artifact) => {\n const compiled = tree ? compiledPath({ tree, artifact }) : undefined;\n\n if (!compiled || !existsSync(compiled)) {\n throw getError({\n message: `[ArtifactSources] ${artifact.filePath} has no compiled copy beside ${from} | The package runs from a compiled tree that is older than its src - rebuild it (or run it from src)`,\n });\n }\n\n return { ...artifact, filePath: compiled };\n });\n }\n\n /** Forgets every cached scan - for a long-lived process that rebuilds (a watch mode). */\n static clear(): void {\n ArtifactSources.scans.clear();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/clis/artifacts.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAG5E,MAAM,KAAK,GACT,gKAAgK,CAAC;AAEnK,M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AAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAE7D,OAAO,CAAC,CAAC;QACX,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrD,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAE7D,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,CAAC,GAAG,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;gBAEpC,OAAO,CAAC,CAAC;YACX,CAAC;YAED,OAAO,CAAC,KAAK,CAAC,SAAS,OAAO,CAAC,GAAG,WAAW,oBAAoB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAE5F,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAErB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["#!/usr/bin/env bun\nimport '../common/install-quiet-logger';\nimport { relative } from 'node:path';\nimport { parseArgs } from 'node:util';\nimport { ArtifactIndexEmitter, ArtifactIndexGenerator } from '../generator';\nimport type { IScannedArtifact } from '../generator';\n\nconst USAGE =\n 'ignis-artifacts <generate|check> [--root src] [--out src/generated/artifacts.ts] [--ignore a,b] [--export GeneratedArtifacts] [--source-module <specifier>]...';\n\nconst { positionals, values } = parseArgs({\n args: process.argv.slice(2),\n allowPositionals: true,\n options: {\n root: { type: 'string', default: 'src' },\n out: { type: 'string', default: 'src/generated/artifacts.ts' },\n ignore: { type: 'string' },\n export: { type: 'string', default: 'GeneratedArtifacts' },\n 'source-module': { type: 'string', multiple: true },\n },\n});\n\nconst options = {\n root: values.root,\n out: values.out,\n ignore: values.ignore\n ?.split(',')\n .map((pattern) => pattern.trim())\n .filter(Boolean),\n exportName: values.export,\n sourceModules: values['source-module'],\n};\n\n/** One stderr line per decorated class a user `--ignore` pattern hid; silence when nothing is hidden. */\nconst warnIgnored = (opts: { ignored: IScannedArtifact[]; root: string }): void => {\n for (const artifact of opts.ignored) {\n console.error(\n `warning: ${artifact.className} (${artifact.type}) in ${relative(opts.root, artifact.filePath)} matches --ignore and is left out of the index`,\n );\n }\n};\n\n/** Exit code of the command, so the process exits in exactly one place. */\nconst run = (): number => {\n switch (positionals[0]) {\n case 'generate': {\n const result = ArtifactIndexGenerator.generate(options);\n console.log(\n `${result.written ? 'wrote' : 'up to date'} ${options.out} | ${result.artifacts.length} artifact(s)`,\n );\n warnIgnored({ ignored: result.ignored, root: options.root });\n\n return 0;\n }\n case 'check': {\n const result = ArtifactIndexGenerator.check(options);\n warnIgnored({ ignored: result.ignored, root: options.root });\n\n if (result.isFresh) {\n console.log(`fresh ${options.out}`);\n\n return 0;\n }\n\n console.error(`stale ${options.out} - run: ${ArtifactIndexEmitter.renderCommand(options)}`);\n\n return 1;\n }\n default: {\n console.error(USAGE);\n\n return 2;\n }\n }\n};\n\nprocess.exit(run());\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quiet-logger.js","sourceRoot":"","sources":["../../../src/common/quiet-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,mMAAmM;AACnM,MAAM,OAAO,WAAW;aACE,UAAK,GAAG,IAAI,GAAG,EAAuB,CAAC;IAG/D,YAAqC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAChD,IAAI,CAAC,MAAM,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;IACl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AAG,IAAe;QACvC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,KAAgB,EAAE,OAAe,EAAE,GAAG,IAAe;QACvD,IAAI,KAAK,KAAK,SAAS,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YAC1D,OAAO;QACT,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,UAAkB;QACpB,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC;IACzF,CAAC","sourcesContent":["import type { ILogger, TLogLevel } from '@venizia/ignis-helpers/core';\nimport { LogLevels } from '@venizia/ignis-helpers/core';\n\n/** The generator's own output goes through `console.log`; framework diagnostics below `warn` are dropped and the rest land on stderr, so a codegen run prints nothing but its result on stdout. */\nexport class QuietLogger implements ILogger {\n private static readonly cache = new Map<string, QuietLogger>();\n private readonly prefix: string;\n\n private constructor(private readonly scope: string) {\n this.prefix = scope === '' ? '' : `[${scope}] `;\n }\n\n static get(scope: string): ILogger {\n const cached = this.cache.get(scope);\n\n if (cached) {\n return cached;\n }\n\n const created = new QuietLogger(scope);\n this.cache.set(scope, created);\n\n return created;\n }\n\n private write(opts: { message: string; args: unknown[] }): void {\n console.error(`${this.prefix}${opts.message}`, ...opts.args);\n }\n\n debug(): void {}\n\n info(): void {}\n\n warn(message: string, ...args: unknown[]): void {\n this.write({ message, args });\n }\n\n error(message: string, ...args: unknown[]): void {\n this.write({ message, args });\n }\n\n emerg(message: string, ...args: unknown[]): void {\n this.write({ message, args });\n }\n\n log(level: TLogLevel, message: string, ...args: unknown[]): void {\n if (level === LogLevels.DEBUG || level === LogLevels.INFO) {\n return;\n }\n\n this.write({ message, args });\n }\n\n for(methodName: string): ILogger {\n return QuietLogger.get(this.scope === '' ? methodName : `${this.scope}-${methodName}`);\n }\n}\n"]}
|
|
@@ -11,6 +11,7 @@ export declare class ArtifactTypes {
|
|
|
11
11
|
static readonly SCHEME_SET: Set<string>;
|
|
12
12
|
static isValid(value: string): boolean;
|
|
13
13
|
}
|
|
14
|
+
/** One of the `ArtifactTypes` values. */
|
|
14
15
|
export type TArtifactType = TConstValue<typeof ArtifactTypes>;
|
|
15
16
|
/** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */
|
|
16
17
|
export declare class ArtifactIndexFields {
|
|
@@ -23,7 +24,9 @@ export declare class ArtifactIndexFields {
|
|
|
23
24
|
static readonly SCHEME_SET: Set<string>;
|
|
24
25
|
static isValid(value: string): boolean;
|
|
25
26
|
}
|
|
27
|
+
/** One of the `ArtifactIndexFields` values. */
|
|
26
28
|
export type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;
|
|
29
|
+
/** How the scanner recognises a decorated class: the source glob, decorator-to-type map, default ignore patterns and the emit order. */
|
|
27
30
|
export declare class ArtifactStereotypes {
|
|
28
31
|
/** The source files the scanner reads: TypeScript, with or without JSX. */
|
|
29
32
|
static readonly SOURCE_GLOB = "**/*.{ts,tsx}";
|
|
@@ -55,5 +58,6 @@ export declare class ScanSkipReasons {
|
|
|
55
58
|
static readonly SCHEME_SET: Set<string>;
|
|
56
59
|
static isValid(value: string): boolean;
|
|
57
60
|
}
|
|
61
|
+
/** One of the `ScanSkipReasons` values. */
|
|
58
62
|
export type TScanSkipReason = TConstValue<typeof ScanSkipReasons>;
|
|
59
63
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -40,6 +40,7 @@ export class ArtifactIndexFields {
|
|
|
40
40
|
return this.SCHEME_SET.has(value);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
/** How the scanner recognises a decorated class: the source glob, decorator-to-type map, default ignore patterns and the emit order. */
|
|
43
44
|
export class ArtifactStereotypes {
|
|
44
45
|
/** The source files the scanner reads: TypeScript, with or without JSX. */
|
|
45
46
|
static { this.SOURCE_GLOB = '**/*.{ts,tsx}'; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/generator/common/constants.ts"],"names":[],"mappings":"AAEA,iIAAiI;AACjI,MAAM,OAAO,aAAa;aACR,kBAAa,GAAG,eAAe,CAAC;aAChC,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,KAAK;KACX,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/generator/common/constants.ts"],"names":[],"mappings":"AAEA,iIAAiI;AACjI,MAAM,OAAO,aAAa;aACR,kBAAa,GAAG,eAAe,CAAC;aAChC,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,eAAU,GAAG,YAA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,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE/F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers';\n\n/** Mirrors the kernel's `ArtifactTypes` values; boot must not depend on kernel (`{boot, kernel} -> core` in the build chain). */\nexport class ArtifactTypes {\n static readonly CONFIGURATION = 'configuration';\n static readonly COMPONENT = 'component';\n static readonly CONTROLLER = 'controller';\n static readonly SERVICE = 'service';\n static readonly REPOSITORY = 'repository';\n static readonly DATASOURCE = 'datasource';\n static readonly MODEL = 'model';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATION,\n this.COMPONENT,\n this.CONTROLLER,\n this.SERVICE,\n this.REPOSITORY,\n this.DATASOURCE,\n this.MODEL,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `ArtifactTypes` values. */\nexport type TArtifactType = TConstValue<typeof ArtifactTypes>;\n\n/** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */\nexport class ArtifactIndexFields {\n static readonly CONFIGURATIONS = 'configurations';\n static readonly DATA_SOURCES = 'dataSources';\n static readonly COMPONENTS = 'components';\n static readonly REPOSITORIES = 'repositories';\n static readonly SERVICES = 'services';\n static readonly CONTROLLERS = 'controllers';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATIONS,\n this.DATA_SOURCES,\n this.COMPONENTS,\n this.REPOSITORIES,\n this.SERVICES,\n this.CONTROLLERS,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `ArtifactIndexFields` values. */\nexport type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;\n\n/** How the scanner recognises a decorated class: the source glob, decorator-to-type map, default ignore patterns and the emit order. */\nexport class ArtifactStereotypes {\n /** The source files the scanner reads: TypeScript, with or without JSX. */\n static readonly SOURCE_GLOB = '**/*.{ts,tsx}';\n /** The extension of a source file - stripped for an import specifier, replaced by `.js` for its compiled copy. */\n static readonly SOURCE_EXTENSION = /\\.tsx?$/;\n /** Decorator name as imported from `@venizia/ignis` or `@venizia/ignis-kernel` -> artifact type. */\n static readonly BY_DECORATOR: Readonly<Record<string, TArtifactType>> = {\n configuration: ArtifactTypes.CONFIGURATION,\n component: ArtifactTypes.COMPONENT,\n controller: ArtifactTypes.CONTROLLER,\n service: ArtifactTypes.SERVICE,\n repository: ArtifactTypes.REPOSITORY,\n datasource: ArtifactTypes.DATASOURCE,\n model: ArtifactTypes.MODEL,\n };\n\n static readonly ROOT_DECORATOR = 'injectable';\n\n static readonly SCHEME_SET = new Set<string>(Object.values(ArtifactStereotypes.BY_DECORATOR));\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n\n static readonly SOURCE_MODULES = /^@venizia\\/ignis(?:-kernel)?(?:\\/.+)?$/;\n\n static readonly DEFAULT_IGNORE = [\n '**/__tests__/**',\n '**/*.test.{ts,tsx}',\n '**/*.spec.{ts,tsx}',\n '**/generated/**',\n ];\n\n /**\n * The kernel's `registerArtifacts` order; `model` is never emitted. Configurations come first:\n * `registerConfigurations` runs before the datasource and component sweeps, so a `@configuration`\n * can shape what they read. The kernel sorts them among themselves by their `after` declarations\n * at boot, so the order within the field does not matter here.\n */\n static readonly EMIT_ORDER: ReadonlyArray<{ type: TArtifactType; field: TArtifactIndexField }> = [\n { type: ArtifactTypes.CONFIGURATION, field: ArtifactIndexFields.CONFIGURATIONS },\n { type: ArtifactTypes.DATASOURCE, field: ArtifactIndexFields.DATA_SOURCES },\n { type: ArtifactTypes.COMPONENT, field: ArtifactIndexFields.COMPONENTS },\n { type: ArtifactTypes.REPOSITORY, field: ArtifactIndexFields.REPOSITORIES },\n { type: ArtifactTypes.SERVICE, field: ArtifactIndexFields.SERVICES },\n { type: ArtifactTypes.CONTROLLER, field: ArtifactIndexFields.CONTROLLERS },\n ];\n}\n\n/** Why a decorated class was left out of the index - reported, never silent. */\nexport class ScanSkipReasons {\n static readonly ABSTRACT = 'abstract';\n static readonly NOT_EXPORTED = 'not-exported';\n static readonly IGNORED = 'ignored';\n\n static readonly SCHEME_SET = new Set<string>([this.ABSTRACT, this.NOT_EXPORTED, this.IGNORED]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `ScanSkipReasons` values. */\nexport type TScanSkipReason = TConstValue<typeof ScanSkipReasons>;\n"]}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import type { AnyType, TClass } from '@venizia/ignis-helpers';
|
|
2
2
|
import type { TArtifactIndexField, TArtifactType, TScanSkipReason } from './constants.js';
|
|
3
|
+
/** A decorated class the scanner put in the index. */
|
|
3
4
|
export interface IScannedArtifact {
|
|
4
5
|
className: string;
|
|
5
6
|
/** Absolute path of the declaring file. */
|
|
6
7
|
filePath: string;
|
|
7
8
|
type: TArtifactType;
|
|
8
9
|
}
|
|
10
|
+
/** Options for one scan of a source tree. */
|
|
9
11
|
export interface IScanOptions {
|
|
10
12
|
root: string;
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Glob patterns relative to `root`, ignored in addition to `ArtifactStereotypes.DEFAULT_IGNORE`,
|
|
15
|
+
* which always apply.
|
|
16
|
+
*
|
|
17
|
+
* @default []
|
|
18
|
+
*/
|
|
12
19
|
ignore?: string[];
|
|
13
20
|
/** Module specifiers, matched exactly, whose stereotype imports also count - a package that re-exports the decorators. Adds to `ArtifactStereotypes.SOURCE_MODULES`. */
|
|
14
21
|
sourceModules?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType, TClass } from '@venizia/ignis-helpers';\nimport type { TArtifactIndexField, TArtifactType, TScanSkipReason } from './constants';\n\nexport interface IScannedArtifact {\n className: string;\n /** Absolute path of the declaring file. */\n filePath: string;\n type: TArtifactType;\n}\n\nexport interface IScanOptions {\n root: string;\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType, TClass } from '@venizia/ignis-helpers';\nimport type { TArtifactIndexField, TArtifactType, TScanSkipReason } from './constants';\n\n/** A decorated class the scanner put in the index. */\nexport interface IScannedArtifact {\n className: string;\n /** Absolute path of the declaring file. */\n filePath: string;\n type: TArtifactType;\n}\n\n/** Options for one scan of a source tree. */\nexport interface IScanOptions {\n root: string;\n /**\n * Glob patterns relative to `root`, ignored in addition to `ArtifactStereotypes.DEFAULT_IGNORE`,\n * which always apply.\n *\n * @default []\n */\n ignore?: string[];\n /** Module specifiers, matched exactly, whose stereotype imports also count - a package that re-exports the decorators. Adds to `ArtifactStereotypes.SOURCE_MODULES`. */\n sourceModules?: string[];\n /** Recognise a stereotype imported from any module whose exports lead, through `export *` and renaming re-exports, to a source module - a framework that re-exports the kernel's decorators. */\n followReexports?: boolean;\n}\n\n/** A decorated class the index leaves out, and why. */\nexport interface IScanSkipped {\n className: string;\n filePath: string;\n reason: TScanSkipReason;\n}\n\n/** The index content plus what a caller's `ignore` silently left out: decorated classes under a user pattern, never under a default one. */\nexport interface IScanReport {\n artifacts: IScannedArtifact[];\n ignored: IScannedArtifact[];\n /** Every decorated class left out - abstract, not a named export, or under a user ignore pattern. */\n skipped: IScanSkipped[];\n}\n\n/** The object a generated index exports - structurally the kernel's `IArtifactIndex` (boot does not depend on the kernel). */\nexport type TGeneratedArtifactIndex = Partial<\n Record<TArtifactIndexField, ReadonlyArray<TClass<AnyType>>>\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAyB,MAAM,UAAU,CAAC;AAErF,iKAAiK;AACjK,MAAM,OAAO,oBAAoB;IAC/B,kEAAkE;aAClD,gBAAW,GAAG,GAAG,CAAC;aAElB,wBAAmB,GAAG,oBAAoB,CAAC;IAE3D,yHAAyH;IACzH,MAAM,CAAC,aAAa,CAAC,IAMpB;QACC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,UAAU,EAAE,aAAa,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACxE,MAAM,KAAK,GAAG,CAAC,UAAU,IAAI,EAAE,EAAE,SAAS,GAAG,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAyB,MAAM,UAAU,CAAC;AAErF,iKAAiK;AACjK,MAAM,OAAO,oBAAoB;IAC/B,kEAAkE;aAClD,gBAAW,GAAG,GAAG,CAAC;aAElB,wBAAmB,GAAG,oBAAoB,CAAC;IAE3D,yHAAyH;IACzH,MAAM,CAAC,aAAa,CAAC,IAMpB;QACC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,UAAU,EAAE,aAAa,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACxE,MAAM,KAAK,GAAG,CAAC,UAAU,IAAI,EAAE,EAAE,SAAS,GAAG,EAAE,CAAC,CAAC;QAEjD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,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AAC,WAAW,EAAE,CAAC;YAC1D,OAAO,CAAC,UAAU,CAAC,CAAC;QACtB,CAAC;QAED,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,IAAuD;QAC/E,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACxF,CAAC;QAED,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;aAC9C,KAAK,CAAC,GAAG,CAAC;aACV,IAAI,CAAC,GAAG,CAAC;aACT,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAErD,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;IAChD,CAAC","sourcesContent":["import { dirname, relative, sep } from 'node:path';\nimport { ArtifactStereotypes, ArtifactTypes, type IScannedArtifact } from './common';\n\n/** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */\nexport class ArtifactIndexEmitter {\n /** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */\n static readonly PRINT_WIDTH = 100;\n\n static readonly DEFAULT_EXPORT_NAME = 'GeneratedArtifacts';\n\n /** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */\n static renderCommand(opts: {\n root: string;\n out: string;\n ignore?: string[];\n exportName?: string;\n sourceModules?: string[];\n }): string {\n const { root, out, ignore = [], exportName, sourceModules = [] } = opts;\n const flags = [`--root ${root}`, `--out ${out}`];\n\n if (ignore.length > 0) {\n flags.push(`--ignore ${ignore.join(',')}`);\n }\n\n if (exportName && exportName !== ArtifactIndexEmitter.DEFAULT_EXPORT_NAME) {\n flags.push(`--export ${exportName}`);\n }\n\n for (const sourceModule of sourceModules) {\n flags.push(`--source-module ${sourceModule}`);\n }\n\n return `ignis-artifacts generate ${flags.join(' ')}`;\n }\n\n /** The exact command that regenerates the file, so the header never points at another path than the one the build used. */\n static renderHeader(opts: {\n root: string;\n out: string;\n ignore?: string[];\n exportName?: string;\n sourceModules?: string[];\n }): string {\n return `// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ${ArtifactIndexEmitter.renderCommand(opts)}`;\n }\n\n static render(opts: {\n artifacts: IScannedArtifact[];\n outFile: string;\n exportName: string;\n /** Absolute import paths - for a virtual module, which has no directory to resolve a relative one from. */\n absoluteImports?: boolean;\n /** The CLI arguments as given, for the header; `outFile` above is the resolved path used for import specifiers. */\n command: { root: string; out: string; ignore?: string[]; sourceModules?: string[] };\n }): string {\n const { artifacts, outFile, exportName, command } = opts;\n const emitted = artifacts.filter((artifact) => artifact.type !== ArtifactTypes.MODEL);\n\n const imports = emitted\n .map((artifact) => ({\n name: artifact.className,\n path: ArtifactIndexEmitter.importPath({\n from: outFile,\n to: artifact.filePath,\n isAbsolute: opts.absoluteImports ?? false,\n }),\n }))\n .sort((a, b) => a.path.localeCompare(b.path) || a.name.localeCompare(b.name))\n .map((entry) => `import { ${entry.name} } from '${entry.path}';`);\n\n const fields = ArtifactStereotypes.EMIT_ORDER.flatMap(({ type, field }) => {\n const names = emitted\n .filter((artifact) => artifact.type === type)\n .map((artifact) => artifact.className)\n .sort((a, b) => a.localeCompare(b));\n\n return ArtifactIndexEmitter.renderField({ field, names });\n });\n\n return [\n ArtifactIndexEmitter.renderHeader({ ...command, exportName }),\n ...imports,\n '',\n `export const ${exportName} = {`,\n ...fields,\n '};',\n '',\n ].join('\\n');\n }\n\n /** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */\n private static renderField(opts: { field: string; names: string[] }): string[] {\n const { field, names } = opts;\n const singleLine = ` ${field}: [${names.join(', ')}],`;\n\n if (singleLine.length <= ArtifactIndexEmitter.PRINT_WIDTH) {\n return [singleLine];\n }\n\n return [` ${field}: [`, ...names.map((name) => ` ${name},`), ' ],'];\n }\n\n private static importPath(opts: { from: string; to: string; isAbsolute: boolean }): string {\n if (opts.isAbsolute) {\n return opts.to.split(sep).join('/').replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n }\n\n const raw = relative(dirname(opts.from), opts.to)\n .split(sep)\n .join('/')\n .replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n\n return raw.startsWith('.') ? raw : `./${raw}`;\n }\n}\n"]}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { IScanReport, IScannedArtifact } from './common/index.js';
|
|
2
|
+
/** Options for writing or checking the artifact index file. */
|
|
2
3
|
export interface IGenerateOptions {
|
|
3
4
|
root: string;
|
|
4
5
|
out: string;
|
|
5
6
|
ignore?: string[];
|
|
6
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Name of the exported constant.
|
|
9
|
+
*
|
|
10
|
+
* @default 'GeneratedArtifacts'
|
|
11
|
+
*/
|
|
7
12
|
exportName?: string;
|
|
8
13
|
/** Extra module specifiers whose stereotype imports count; see `IScanOptions.sourceModules`. */
|
|
9
14
|
sourceModules?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,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,KAAK,SAAS;YACpB,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEpF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAChD,CAAC;CACF","sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { IScanReport, IScannedArtifact } from './common';\nimport { ArtifactIndexEmitter } from './emitter';\nimport { ArtifactScanner } from './scanner';\n\n/** Options for writing or checking the artifact index file. */\nexport interface IGenerateOptions {\n root: string;\n out: string;\n ignore?: string[];\n /**\n * Name of the exported constant.\n *\n * @default 'GeneratedArtifacts'\n */\n exportName?: string;\n /** Extra module specifiers whose stereotype imports count; see `IScanOptions.sourceModules`. */\n sourceModules?: string[];\n}\n\n/** Writes the artifact index, and checks that the committed one is still current. */\nexport class ArtifactIndexGenerator {\n private static render(opts: IGenerateOptions): { content: string } & IScanReport {\n const { artifacts, ignored, skipped } = ArtifactScanner.getInstance().scanWithReport({\n root: opts.root,\n ignore: opts.ignore,\n sourceModules: opts.sourceModules,\n });\n const content = ArtifactIndexEmitter.render({\n artifacts,\n outFile: resolve(opts.out),\n exportName: opts.exportName ?? ArtifactIndexEmitter.DEFAULT_EXPORT_NAME,\n command: {\n root: opts.root,\n out: opts.out,\n ignore: opts.ignore,\n sourceModules: opts.sourceModules,\n },\n });\n\n return { content, artifacts, ignored, skipped };\n }\n\n /** Everything below the first line: the header only records the command, so a flag change alone must not read as drift. */\n private static bodyOf(content: string): string {\n return content.slice(content.indexOf('\\n') + 1);\n }\n\n /** Writes the index only when its content changed, so an unchanged tree leaves the file's mtime alone. */\n static generate(opts: IGenerateOptions): { content: string; written: boolean } & IScanReport {\n const { content, artifacts, ignored, skipped } = ArtifactIndexGenerator.render(opts);\n const out = resolve(opts.out);\n const current = existsSync(out) ? readFileSync(out, 'utf8') : undefined;\n\n if (current === content) {\n return { content, artifacts, ignored, skipped, written: false };\n }\n\n mkdirSync(dirname(out), { recursive: true });\n writeFileSync(out, content);\n\n return { content, artifacts, ignored, skipped, written: true };\n }\n\n /** Renders in memory and compares the body with the committed file - the staleness gate for lint and CI. */\n static check(opts: IGenerateOptions): {\n isFresh: boolean;\n expected: string;\n actual: string | undefined;\n ignored: IScannedArtifact[];\n } {\n const { content: expected, ignored } = ArtifactIndexGenerator.render(opts);\n const out = resolve(opts.out);\n const actual = existsSync(out) ? readFileSync(out, 'utf8') : undefined;\n const isFresh =\n actual !== undefined &&\n ArtifactIndexGenerator.bodyOf(actual) === ArtifactIndexGenerator.bodyOf(expected);\n\n return { isFresh, expected, actual, ignored };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reexport.js","sourceRoot":"","sources":["../../../src/generator/reexport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,8OAA8O;AAC9O,MAAM,OAAO,0BAA2B,SAAQ,UAAU;aACxC,cAAS,GAAG,EAAE,AAAL,CAAM;IAS/B,YAAY,IAAkD;QAC5D,KAAK,CAAC,EAAE,KAAK,EAAE,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC;QANpD,mHAAmH;QAClG,gBAAW,GAAG,IAAI,GAAG,EAA8B,CAAC;QACpD,YAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;QAC3C,YAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;QAI/D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,0BAA0B,C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Q,EAAE,CAAC;gBACtD,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;oBAC/B,SAAS;gBACX,CAAC;gBACD,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;gBAC7D,IAAI,aAAa,EAAE,CAAC;oBAClB,OAAO,IAAI,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC5D,CAAC;gBACD,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC1C,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC","sourcesContent":["import { BaseHelper } from '@venizia/ignis-helpers';\nimport { readFileSync } from 'node:fs';\nimport { dirname } from 'node:path';\nimport ts from 'typescript';\nimport { ArtifactStereotypes } from './common';\n\n/** Follows a named import through `export *` and renaming re-exports until it reaches a source module, so a framework that re-exports the kernel's decorators is recognised. Reads declarations only; never builds a type-checked program. */\nexport class StereotypeReexportResolver extends BaseHelper {\n static readonly MAX_DEPTH = 10;\n\n private readonly options: ts.CompilerOptions;\n private readonly sourceModules: Set<string>;\n /** One scan reads the same barrels many times: resolutions, parsed files and answers are memoized per resolver. */\n private readonly resolutions = new Map<string, string | undefined>();\n private readonly sources = new Map<string, ts.SourceFile>();\n private readonly origins = new Map<string, string | undefined>();\n\n constructor(opts: { root: string; sourceModules: Set<string> }) {\n super({ scope: StereotypeReexportResolver.name });\n this.sourceModules = opts.sourceModules;\n this.options = StereotypeReexportResolver.compilerOptionsFor({ root: opts.root });\n }\n\n /** The nearest tsconfig's options (for `paths` aliases), with bundler resolution as the fallback. */\n private static compilerOptionsFor(opts: { root: string }): ts.CompilerOptions {\n const configPath = ts.findConfigFile(opts.root, ts.sys.fileExists);\n const fallback: ts.CompilerOptions = {\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n allowJs: true,\n };\n if (!configPath) {\n return fallback;\n }\n\n const parsed = ts.parseJsonConfigFileContent(\n ts.readConfigFile(configPath, ts.sys.readFile).config,\n ts.sys,\n dirname(configPath),\n );\n return { ...fallback, ...parsed.options };\n }\n\n /** The kernel name `name` (exported by `specifier`, as seen from `fromFile`) originates as, or `undefined` when the chain never reaches a source module. */\n originOf(opts: { fromFile: string; specifier: string; name: string }): string | undefined {\n const key = `${dirname(opts.fromFile)}|${opts.specifier}|${opts.name}`;\n if (!this.origins.has(key)) {\n this.origins.set(key, this.follow({ ...opts, depth: 0, seen: new Set<string>() }));\n }\n return this.origins.get(key);\n }\n\n private resolveFile(opts: { fromFile: string; specifier: string }): string | undefined {\n const key = `${dirname(opts.fromFile)}|${opts.specifier}`;\n if (!this.resolutions.has(key)) {\n this.resolutions.set(\n key,\n ts.resolveModuleName(opts.specifier, opts.fromFile, this.options, ts.sys).resolvedModule\n ?.resolvedFileName,\n );\n }\n return this.resolutions.get(key);\n }\n\n private parse(opts: { file: string }): ts.SourceFile {\n let source = this.sources.get(opts.file);\n if (!source) {\n source = ts.createSourceFile(\n opts.file,\n readFileSync(opts.file, 'utf8'),\n ts.ScriptTarget.Latest,\n true,\n );\n this.sources.set(opts.file, source);\n }\n return source;\n }\n\n private isSourceModule(opts: { specifier: string }): boolean {\n return (\n ArtifactStereotypes.SOURCE_MODULES.test(opts.specifier) ||\n this.sourceModules.has(opts.specifier)\n );\n }\n\n private follow(opts: {\n fromFile: string;\n specifier: string;\n name: string;\n depth: number;\n seen: Set<string>;\n }): string | undefined {\n const { fromFile, specifier, name, depth, seen } = opts;\n if (this.isSourceModule({ specifier })) {\n return name;\n }\n if (depth >= StereotypeReexportResolver.MAX_DEPTH) {\n return undefined;\n }\n\n const resolved = this.resolveFile({ fromFile, specifier });\n const visit = `${resolved}#${name}`;\n if (!resolved || seen.has(visit)) {\n return undefined;\n }\n seen.add(visit);\n\n const source = this.parse({ file: resolved });\n const next = (target: { specifier: string; name: string }): string | undefined =>\n this.follow({ fromFile: resolved, ...target, depth: depth + 1, seen });\n\n const importedBy = new Map<string, { specifier: string; name: string }>();\n for (const statement of source.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n const bindings = statement.importClause?.namedBindings;\n if (!bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n for (const element of bindings.elements) {\n importedBy.set(element.name.text, {\n specifier: statement.moduleSpecifier.text,\n name: (element.propertyName ?? element.name).text,\n });\n }\n }\n\n for (const statement of source.statements) {\n if (!ts.isExportDeclaration(statement) || statement.isTypeOnly) {\n continue;\n }\n const fromSpecifier =\n statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : undefined;\n\n if (!statement.exportClause) {\n const origin = fromSpecifier ? next({ specifier: fromSpecifier, name }) : undefined;\n if (origin) {\n return origin;\n }\n continue;\n }\n if (!ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n if (element.name.text !== name) {\n continue;\n }\n const original = (element.propertyName ?? element.name).text;\n if (fromSpecifier) {\n return next({ specifier: fromSpecifier, name: original });\n }\n const imported = importedBy.get(original);\n return imported ? next(imported) : undefined;\n }\n }\n\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reexport.js","sourceRoot":"","sources":["../../../src/generator/reexport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MA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,SAAS,CAAC;YAEhB,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;gBAC5B,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBAEpF,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,SAAS;YACX,CAAC;YAED,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBACtD,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;oBAC/B,SAAS;gBACX,CAAC;gBAED,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;gBAE7D,IAAI,aAAa,EAAE,CAAC;oBAClB,OAAO,IAAI,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC5D,CAAC;gBAED,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAE1C,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC","sourcesContent":["import { BaseHelper } from '@venizia/ignis-helpers';\nimport { readFileSync } from 'node:fs';\nimport { dirname } from 'node:path';\nimport ts from 'typescript';\nimport { ArtifactStereotypes } from './common';\n\n/** Follows a named import through `export *` and renaming re-exports until it reaches a source module, so a framework that re-exports the kernel's decorators is recognised. Reads declarations only; never builds a type-checked program. */\nexport class StereotypeReexportResolver extends BaseHelper {\n static readonly MAX_DEPTH = 10;\n\n private readonly options: ts.CompilerOptions;\n private readonly sourceModules: Set<string>;\n /** One scan reads the same barrels many times: resolutions, parsed files and answers are memoized per resolver. */\n private readonly resolutions = new Map<string, string | undefined>();\n private readonly sources = new Map<string, ts.SourceFile>();\n private readonly origins = new Map<string, string | undefined>();\n\n constructor(opts: { root: string; sourceModules: Set<string> }) {\n super({ scope: StereotypeReexportResolver.name });\n this.sourceModules = opts.sourceModules;\n this.options = StereotypeReexportResolver.compilerOptionsFor({ root: opts.root });\n }\n\n /** The nearest tsconfig's options (for `paths` aliases), with bundler resolution as the fallback. */\n private static compilerOptionsFor(opts: { root: string }): ts.CompilerOptions {\n const configPath = ts.findConfigFile(opts.root, ts.sys.fileExists);\n const fallback: ts.CompilerOptions = {\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n allowJs: true,\n };\n\n if (!configPath) {\n return fallback;\n }\n\n const parsed = ts.parseJsonConfigFileContent(\n ts.readConfigFile(configPath, ts.sys.readFile).config,\n ts.sys,\n dirname(configPath),\n );\n\n return { ...fallback, ...parsed.options };\n }\n\n /** The kernel name `name` (exported by `specifier`, as seen from `fromFile`) originates as, or `undefined` when the chain never reaches a source module. */\n originOf(opts: { fromFile: string; specifier: string; name: string }): string | undefined {\n const key = `${dirname(opts.fromFile)}|${opts.specifier}|${opts.name}`;\n\n if (!this.origins.has(key)) {\n this.origins.set(key, this.follow({ ...opts, depth: 0, seen: new Set<string>() }));\n }\n\n return this.origins.get(key);\n }\n\n private resolveFile(opts: { fromFile: string; specifier: string }): string | undefined {\n const key = `${dirname(opts.fromFile)}|${opts.specifier}`;\n\n if (!this.resolutions.has(key)) {\n this.resolutions.set(\n key,\n ts.resolveModuleName(opts.specifier, opts.fromFile, this.options, ts.sys).resolvedModule\n ?.resolvedFileName,\n );\n }\n\n return this.resolutions.get(key);\n }\n\n private parse(opts: { file: string }): ts.SourceFile {\n let source = this.sources.get(opts.file);\n\n if (!source) {\n source = ts.createSourceFile(\n opts.file,\n readFileSync(opts.file, 'utf8'),\n ts.ScriptTarget.Latest,\n true,\n );\n this.sources.set(opts.file, source);\n }\n\n return source;\n }\n\n private isSourceModule(opts: { specifier: string }): boolean {\n return (\n ArtifactStereotypes.SOURCE_MODULES.test(opts.specifier) ||\n this.sourceModules.has(opts.specifier)\n );\n }\n\n private follow(opts: {\n fromFile: string;\n specifier: string;\n name: string;\n depth: number;\n seen: Set<string>;\n }): string | undefined {\n const { fromFile, specifier, name, depth, seen } = opts;\n\n if (this.isSourceModule({ specifier })) {\n return name;\n }\n\n if (depth >= StereotypeReexportResolver.MAX_DEPTH) {\n return undefined;\n }\n\n const resolved = this.resolveFile({ fromFile, specifier });\n const visit = `${resolved}#${name}`;\n\n if (!resolved || seen.has(visit)) {\n return undefined;\n }\n\n seen.add(visit);\n\n const source = this.parse({ file: resolved });\n const next = (target: { specifier: string; name: string }): string | undefined =>\n this.follow({ fromFile: resolved, ...target, depth: depth + 1, seen });\n\n const importedBy = new Map<string, { specifier: string; name: string }>();\n\n for (const statement of source.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n\n const bindings = statement.importClause?.namedBindings;\n\n if (!bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n importedBy.set(element.name.text, {\n specifier: statement.moduleSpecifier.text,\n name: (element.propertyName ?? element.name).text,\n });\n }\n }\n\n for (const statement of source.statements) {\n if (!ts.isExportDeclaration(statement) || statement.isTypeOnly) {\n continue;\n }\n\n const fromSpecifier =\n statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier)\n ? statement.moduleSpecifier.text\n : undefined;\n\n if (!statement.exportClause) {\n const origin = fromSpecifier ? next({ specifier: fromSpecifier, name }) : undefined;\n\n if (origin) {\n return origin;\n }\n\n continue;\n }\n\n if (!ts.isNamedExports(statement.exportClause)) {\n continue;\n }\n\n for (const element of statement.exportClause.elements) {\n if (element.name.text !== name) {\n continue;\n }\n\n const original = (element.propertyName ?? element.name).text;\n\n if (fromSpecifier) {\n return next({ specifier: fromSpecifier, name: original });\n }\n\n const imported = importedBy.get(original);\n\n return imported ? next(imported) : undefined;\n }\n }\n\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../src/generator/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,eAAe,GAMhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExD,yGAAyG;AACzG,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAG7C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,IAAkB;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;IAC7C,CAAC;IAED,+JAA+J;IAC/J,cAAc,CAAC,IAAkB;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,oBAAoB,CAAC;YACjD,IAAI;YACJ,YA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AO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC;QACnC,IAAI,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,IACE,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC;YACpC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;YACjC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,eAAe,EACzC,CAAC;YACD,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,cAAc,CAAC,IAAqB;QAC1C,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACrB,OAAO,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC7D,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;aAC3B,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { BaseHelper, getError } from '@venizia/ignis-helpers';\nimport { globSync, readFileSync } from 'node:fs';\nimport { join, matchesGlob, resolve } from 'node:path';\nimport ts from 'typescript';\nimport {\n ArtifactStereotypes,\n ArtifactTypes,\n ScanSkipReasons,\n type IScanOptions,\n type IScanReport,\n type IScanSkipped,\n type IScannedArtifact,\n type TArtifactType,\n} from './common';\nimport { StereotypeReexportResolver } from './reexport';\n\n/** Finds exported classes carrying a stereotype decorator by reading the source, never by running it. */\nexport class ArtifactScanner extends BaseHelper {\n private static instance?: ArtifactScanner;\n\n private constructor() {\n super({ scope: ArtifactScanner.name });\n }\n\n static getInstance(): ArtifactScanner {\n return (this.instance ??= new ArtifactScanner());\n }\n\n scan(opts: IScanOptions): IScannedArtifact[] {\n return this.scanWithReport(opts).artifacts;\n }\n\n /** `scan` plus the decorated classes a caller's own `ignore` pattern hid - the generator prints them so a stale pattern cannot drop an artifact in silence. */\n scanWithReport(opts: IScanOptions): IScanReport {\n const root = resolve(opts.root);\n const { kept, hidden } = this.partitionSourceFiles({\n root,\n defaultGlobs: ArtifactStereotypes.DEFAULT_IGNORE,\n userGlobs: opts.ignore ?? [],\n });\n const sourceModules = new Set(opts.sourceModules);\n const resolver = opts.followReexports\n ? new StereotypeReexportResolver({ root, sourceModules })\n : undefined;\n const skipped: IScanSkipped[] = [];\n\n const artifacts = this.sortArtifacts(\n kept.flatMap((filePath) => this.scanFile({ filePath, sourceModules, resolver, skipped })),\n );\n const ignored = this.sortArtifacts(\n hidden.flatMap((filePath) => this.scanHiddenFile({ filePath, sourceModules, resolver })),\n );\n for (const artifact of ignored) {\n skipped.push({\n className: artifact.className,\n filePath: artifact.filePath,\n reason: ScanSkipReasons.IGNORED,\n });\n }\n\n return { artifacts, ignored, skipped };\n }\n\n /** A hidden file is only reported on, never a reason to fail: a scan error becomes one warning and the file contributes nothing. */\n private scanHiddenFile(opts: {\n filePath: string;\n sourceModules: Set<string>;\n resolver?: StereotypeReexportResolver;\n }): IScannedArtifact[] {\n try {\n return this.scanFile({ ...opts, isHidden: true });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n this.logger.for('scanHiddenFile').warn('Skipped hidden file %s | %s', opts.filePath, reason);\n return [];\n }\n }\n\n private sortArtifacts(artifacts: IScannedArtifact[]): IScannedArtifact[] {\n return artifacts.sort(\n (a, b) => a.type.localeCompare(b.type) || a.className.localeCompare(b.className),\n );\n }\n\n /** `kept` feeds the index; `hidden` is what only a user pattern excluded (a default pattern wins, so tests and generated files are never reported). */\n private partitionSourceFiles(opts: {\n root: string;\n defaultGlobs: ReadonlyArray<string>;\n userGlobs: ReadonlyArray<string>;\n }): { kept: string[]; hidden: string[] } {\n const kept: string[] = [];\n const hidden: string[] = [];\n\n const sources = globSync(ArtifactStereotypes.SOURCE_GLOB, { cwd: opts.root });\n for (const relative of sources) {\n if (\n relative.endsWith('.d.ts') ||\n opts.defaultGlobs.some((pattern) => matchesGlob(relative, pattern))\n ) {\n continue;\n }\n const target = opts.userGlobs.some((pattern) => matchesGlob(relative, pattern))\n ? hidden\n : kept;\n target.push(join(opts.root, relative));\n }\n\n return { kept: kept.sort(), hidden: hidden.sort() };\n }\n\n private scanFile(opts: {\n filePath: string;\n sourceModules: Set<string>;\n resolver?: StereotypeReexportResolver;\n skipped?: IScanSkipped[];\n isHidden?: boolean;\n }): IScannedArtifact[] {\n const { filePath, sourceModules, resolver, skipped, isHidden = false } = opts;\n const source = ts.createSourceFile(\n filePath,\n readFileSync(filePath, 'utf8'),\n ts.ScriptTarget.Latest,\n true,\n );\n\n const stereotypeByLocalName = this.collectStereotypeImports({\n source,\n sourceModules,\n resolver,\n });\n if (stereotypeByLocalName.size === 0) {\n return [];\n }\n\n const exportedNames = this.collectExportClauseNames({ source });\n const found: IScannedArtifact[] = [];\n\n ts.forEachChild(source, (node) => {\n if (!ts.isClassDeclaration(node) || !node.name) {\n return;\n }\n\n const className = node.name.text;\n const types = this.artifactTypesOf({\n node,\n stereotypeByLocalName,\n filePath,\n className,\n });\n if (types.length === 0) {\n return;\n }\n if (types.length > 1) {\n throw getError({\n message: `[ArtifactScanner] ${filePath} | class ${className} carries ${types.length} stereotypes (${types.join(', ')}) - one class is one artifact`,\n });\n }\n\n const modifiers = ts.getModifiers(node) ?? [];\n const has = (kind: ts.SyntaxKind): boolean => modifiers.some((m) => m.kind === kind);\n const isNamedExport =\n (has(ts.SyntaxKind.ExportKeyword) && !has(ts.SyntaxKind.DefaultKeyword)) ||\n exportedNames.has(className);\n const isAbstract = has(ts.SyntaxKind.AbstractKeyword);\n\n if (!isNamedExport || isAbstract) {\n if (!isHidden) {\n skipped?.push({\n className,\n filePath,\n reason: isAbstract ? ScanSkipReasons.ABSTRACT : ScanSkipReasons.NOT_EXPORTED,\n });\n this.logger\n .for('scanFile')\n .warn(\n 'Skipped %s in %s | %s',\n className,\n filePath,\n isAbstract ? 'abstract' : 'not a named export',\n );\n }\n return;\n }\n\n found.push({ className, filePath, type: types[0] });\n });\n\n return found;\n }\n\n /** local identifier -> stereotype name, for named imports from an IGNIS module or a caller-named source module (aliases resolved). */\n private collectStereotypeImports(opts: {\n source: ts.SourceFile;\n sourceModules: Set<string>;\n resolver?: StereotypeReexportResolver;\n }): Map<string, string> {\n const result = new Map<string, string>();\n // Only a name a class actually wears as a decorator is worth following through re-exports.\n const decoratorNames = opts.resolver\n ? this.collectClassDecoratorNames({ source: opts.source })\n : new Set<string>();\n\n for (const statement of opts.source.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n const specifier = statement.moduleSpecifier.text;\n const isSourceModule =\n ArtifactStereotypes.SOURCE_MODULES.test(specifier) || opts.sourceModules.has(specifier);\n if (!isSourceModule && !opts.resolver) {\n continue;\n }\n\n const bindings = statement.importClause?.namedBindings;\n if (!bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n const name = (element.propertyName ?? element.name).text;\n if (!isSourceModule && !decoratorNames.has(element.name.text)) {\n continue;\n }\n const imported = isSourceModule\n ? name\n : opts.resolver?.originOf({ fromFile: opts.source.fileName, specifier, name });\n if (!imported) {\n continue;\n }\n const isStereotype =\n imported in ArtifactStereotypes.BY_DECORATOR ||\n imported === ArtifactStereotypes.ROOT_DECORATOR;\n if (isStereotype) {\n result.set(element.name.text, imported);\n }\n }\n }\n\n return result;\n }\n\n /** The identifiers called as decorators on the file's top-level classes (`@service()`, `@kit.service()` is not followed). */\n private collectClassDecoratorNames(opts: { source: ts.SourceFile }): Set<string> {\n const names = new Set<string>();\n for (const statement of opts.source.statements) {\n if (!ts.isClassDeclaration(statement)) {\n continue;\n }\n for (const decorator of ts.getDecorators(statement) ?? []) {\n const expression = decorator.expression;\n if (ts.isCallExpression(expression) && ts.isIdentifier(expression.expression)) {\n names.add(expression.expression.text);\n }\n }\n }\n return names;\n }\n\n private collectExportClauseNames(opts: { source: ts.SourceFile }): Set<string> {\n const names = new Set<string>();\n\n for (const statement of opts.source.statements) {\n if (\n ts.isExportDeclaration(statement) &&\n statement.exportClause &&\n ts.isNamedExports(statement.exportClause)\n ) {\n for (const element of statement.exportClause.elements) {\n names.add((element.propertyName ?? element.name).text);\n }\n }\n }\n\n return names;\n }\n\n private artifactTypesOf(opts: {\n node: ts.ClassDeclaration;\n stereotypeByLocalName: Map<string, string>;\n filePath: string;\n className: string;\n }): TArtifactType[] {\n const { node, stereotypeByLocalName, filePath, className } = opts;\n const types: TArtifactType[] = [];\n\n const decorators = ts.getDecorators(node) ?? [];\n for (const decorator of decorators) {\n const expression = decorator.expression;\n if (!ts.isCallExpression(expression) || !ts.isIdentifier(expression.expression)) {\n continue;\n }\n\n const stereotype = stereotypeByLocalName.get(expression.expression.text);\n if (!stereotype) {\n continue;\n }\n if (stereotype !== ArtifactStereotypes.ROOT_DECORATOR) {\n types.push(ArtifactStereotypes.BY_DECORATOR[stereotype]);\n continue;\n }\n\n const type = this.typeOfInjectableCall({ call: expression });\n if (!type) {\n this.logger\n .for('artifactTypesOf')\n .warn(\n 'Skipped %s in %s | @injectable type is not a literal or ArtifactTypes.<NAME>',\n className,\n filePath,\n );\n continue;\n }\n types.push(type);\n }\n\n return types;\n }\n\n private typeOfInjectableCall(opts: { call: ts.CallExpression }): TArtifactType | undefined {\n const [argument] = opts.call.arguments;\n if (!argument || !ts.isObjectLiteralExpression(argument)) {\n return undefined;\n }\n\n const property = argument.properties.find(\n (entry): entry is ts.PropertyAssignment =>\n ts.isPropertyAssignment(entry) && ts.isIdentifier(entry.name) && entry.name.text === 'type',\n );\n if (!property) {\n return undefined;\n }\n\n const value = property.initializer;\n if (ts.isStringLiteral(value)) {\n return this.asArtifactType({ raw: value.text });\n }\n if (\n ts.isPropertyAccessExpression(value) &&\n ts.isIdentifier(value.expression) &&\n value.expression.text === 'ArtifactTypes'\n ) {\n return this.asArtifactType({ raw: value.name.text.toLowerCase() });\n }\n\n return undefined;\n }\n\n private asArtifactType(opts: { raw: string }): TArtifactType | undefined {\n const { raw } = opts;\n return ArtifactStereotypes.EMIT_ORDER.map((entry) => entry.type)\n .concat(ArtifactTypes.MODEL)\n .find((type) => type === raw);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../src/generator/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,eAAe,GAMhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExD,yGAAyG;AACzG,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAG7C;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,IAAkB;QACrB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;IAC7C,CAAC;IAED,+JAA+J;IAC/J,cAAc,CAAC,IAAkB;QAC/B,MAAM,IAAI,GAAG,OA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CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAC9F,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC;QAEnC,IAAI,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,IACE,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC;YACpC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC;YACjC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,eAAe,EACzC,CAAC;YACD,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,cAAc,CAAC,IAAqB;QAC1C,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAErB,OAAO,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC7D,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;aAC3B,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { BaseHelper, getError } from '@venizia/ignis-helpers';\nimport { globSync, readFileSync } from 'node:fs';\nimport { join, matchesGlob, resolve } from 'node:path';\nimport ts from 'typescript';\nimport {\n ArtifactStereotypes,\n ArtifactTypes,\n ScanSkipReasons,\n type IScanOptions,\n type IScanReport,\n type IScanSkipped,\n type IScannedArtifact,\n type TArtifactType,\n} from './common';\nimport { StereotypeReexportResolver } from './reexport';\n\n/** Finds exported classes carrying a stereotype decorator by reading the source, never by running it. */\nexport class ArtifactScanner extends BaseHelper {\n private static instance?: ArtifactScanner;\n\n private constructor() {\n super({ scope: ArtifactScanner.name });\n }\n\n static getInstance(): ArtifactScanner {\n return (this.instance ??= new ArtifactScanner());\n }\n\n scan(opts: IScanOptions): IScannedArtifact[] {\n return this.scanWithReport(opts).artifacts;\n }\n\n /** `scan` plus the decorated classes a caller's own `ignore` pattern hid - the generator prints them so a stale pattern cannot drop an artifact in silence. */\n scanWithReport(opts: IScanOptions): IScanReport {\n const root = resolve(opts.root);\n const { kept, hidden } = this.partitionSourceFiles({\n root,\n defaultGlobs: ArtifactStereotypes.DEFAULT_IGNORE,\n userGlobs: opts.ignore ?? [],\n });\n const sourceModules = new Set(opts.sourceModules);\n const resolver = opts.followReexports\n ? new StereotypeReexportResolver({ root, sourceModules })\n : undefined;\n const skipped: IScanSkipped[] = [];\n\n const artifacts = this.sortArtifacts(\n kept.flatMap((filePath) => this.scanFile({ filePath, sourceModules, resolver, skipped })),\n );\n const ignored = this.sortArtifacts(\n hidden.flatMap((filePath) => this.scanHiddenFile({ filePath, sourceModules, resolver })),\n );\n\n for (const artifact of ignored) {\n skipped.push({\n className: artifact.className,\n filePath: artifact.filePath,\n reason: ScanSkipReasons.IGNORED,\n });\n }\n\n return { artifacts, ignored, skipped };\n }\n\n /** A hidden file is only reported on, never a reason to fail: a scan error becomes one warning and the file contributes nothing. */\n private scanHiddenFile(opts: {\n filePath: string;\n sourceModules: Set<string>;\n resolver?: StereotypeReexportResolver;\n }): IScannedArtifact[] {\n try {\n return this.scanFile({ ...opts, isHidden: true });\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n this.logger.for('scanHiddenFile').warn('Skipped hidden file %s | %s', opts.filePath, reason);\n\n return [];\n }\n }\n\n private sortArtifacts(artifacts: IScannedArtifact[]): IScannedArtifact[] {\n return artifacts.sort(\n (a, b) => a.type.localeCompare(b.type) || a.className.localeCompare(b.className),\n );\n }\n\n /** `kept` feeds the index; `hidden` is what only a user pattern excluded (a default pattern wins, so tests and generated files are never reported). */\n private partitionSourceFiles(opts: {\n root: string;\n defaultGlobs: ReadonlyArray<string>;\n userGlobs: ReadonlyArray<string>;\n }): { kept: string[]; hidden: string[] } {\n const kept: string[] = [];\n const hidden: string[] = [];\n\n const sources = globSync(ArtifactStereotypes.SOURCE_GLOB, { cwd: opts.root });\n\n for (const relative of sources) {\n if (\n relative.endsWith('.d.ts') ||\n opts.defaultGlobs.some((pattern) => matchesGlob(relative, pattern))\n ) {\n continue;\n }\n\n const target = opts.userGlobs.some((pattern) => matchesGlob(relative, pattern))\n ? hidden\n : kept;\n target.push(join(opts.root, relative));\n }\n\n return { kept: kept.sort(), hidden: hidden.sort() };\n }\n\n private scanFile(opts: {\n filePath: string;\n sourceModules: Set<string>;\n resolver?: StereotypeReexportResolver;\n skipped?: IScanSkipped[];\n isHidden?: boolean;\n }): IScannedArtifact[] {\n const { filePath, sourceModules, resolver, skipped, isHidden = false } = opts;\n const source = ts.createSourceFile(\n filePath,\n readFileSync(filePath, 'utf8'),\n ts.ScriptTarget.Latest,\n true,\n );\n\n const stereotypeByLocalName = this.collectStereotypeImports({\n source,\n sourceModules,\n resolver,\n });\n\n if (stereotypeByLocalName.size === 0) {\n return [];\n }\n\n const exportedNames = this.collectExportClauseNames({ source });\n const found: IScannedArtifact[] = [];\n\n ts.forEachChild(source, (node) => {\n if (!ts.isClassDeclaration(node) || !node.name) {\n return;\n }\n\n const className = node.name.text;\n const types = this.artifactTypesOf({\n node,\n stereotypeByLocalName,\n filePath,\n className,\n });\n\n if (types.length === 0) {\n return;\n }\n\n if (types.length > 1) {\n throw getError({\n message: `[ArtifactScanner] ${filePath} | class ${className} carries ${types.length} stereotypes (${types.join(', ')}) - one class is one artifact`,\n });\n }\n\n const modifiers = ts.getModifiers(node) ?? [];\n const has = (kind: ts.SyntaxKind): boolean => modifiers.some((m) => m.kind === kind);\n const isNamedExport =\n (has(ts.SyntaxKind.ExportKeyword) && !has(ts.SyntaxKind.DefaultKeyword)) ||\n exportedNames.has(className);\n const isAbstract = has(ts.SyntaxKind.AbstractKeyword);\n\n if (!isNamedExport || isAbstract) {\n if (!isHidden) {\n skipped?.push({\n className,\n filePath,\n reason: isAbstract ? ScanSkipReasons.ABSTRACT : ScanSkipReasons.NOT_EXPORTED,\n });\n this.logger\n .for('scanFile')\n .warn(\n 'Skipped %s in %s | %s',\n className,\n filePath,\n isAbstract ? 'abstract' : 'not a named export',\n );\n }\n\n return;\n }\n\n found.push({ className, filePath, type: types[0] });\n });\n\n return found;\n }\n\n /** local identifier -> stereotype name, for named imports from an IGNIS module or a caller-named source module (aliases resolved). */\n private collectStereotypeImports(opts: {\n source: ts.SourceFile;\n sourceModules: Set<string>;\n resolver?: StereotypeReexportResolver;\n }): Map<string, string> {\n const result = new Map<string, string>();\n // Only a name a class actually wears as a decorator is worth following through re-exports.\n const decoratorNames = opts.resolver\n ? this.collectClassDecoratorNames({ source: opts.source })\n : new Set<string>();\n\n for (const statement of opts.source.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n\n const specifier = statement.moduleSpecifier.text;\n const isSourceModule =\n ArtifactStereotypes.SOURCE_MODULES.test(specifier) || opts.sourceModules.has(specifier);\n\n if (!isSourceModule && !opts.resolver) {\n continue;\n }\n\n const bindings = statement.importClause?.namedBindings;\n\n if (!bindings || !ts.isNamedImports(bindings)) {\n continue;\n }\n\n for (const element of bindings.elements) {\n const name = (element.propertyName ?? element.name).text;\n\n if (!isSourceModule && !decoratorNames.has(element.name.text)) {\n continue;\n }\n\n const imported = isSourceModule\n ? name\n : opts.resolver?.originOf({ fromFile: opts.source.fileName, specifier, name });\n\n if (!imported) {\n continue;\n }\n\n const isStereotype =\n imported in ArtifactStereotypes.BY_DECORATOR ||\n imported === ArtifactStereotypes.ROOT_DECORATOR;\n\n if (isStereotype) {\n result.set(element.name.text, imported);\n }\n }\n }\n\n return result;\n }\n\n /** The identifiers called as decorators on the file's top-level classes (`@service()`, `@kit.service()` is not followed). */\n private collectClassDecoratorNames(opts: { source: ts.SourceFile }): Set<string> {\n const names = new Set<string>();\n\n for (const statement of opts.source.statements) {\n if (!ts.isClassDeclaration(statement)) {\n continue;\n }\n\n for (const decorator of ts.getDecorators(statement) ?? []) {\n const expression = decorator.expression;\n\n if (ts.isCallExpression(expression) && ts.isIdentifier(expression.expression)) {\n names.add(expression.expression.text);\n }\n }\n }\n\n return names;\n }\n\n private collectExportClauseNames(opts: { source: ts.SourceFile }): Set<string> {\n const names = new Set<string>();\n\n for (const statement of opts.source.statements) {\n if (\n ts.isExportDeclaration(statement) &&\n statement.exportClause &&\n ts.isNamedExports(statement.exportClause)\n ) {\n for (const element of statement.exportClause.elements) {\n names.add((element.propertyName ?? element.name).text);\n }\n }\n }\n\n return names;\n }\n\n private artifactTypesOf(opts: {\n node: ts.ClassDeclaration;\n stereotypeByLocalName: Map<string, string>;\n filePath: string;\n className: string;\n }): TArtifactType[] {\n const { node, stereotypeByLocalName, filePath, className } = opts;\n const types: TArtifactType[] = [];\n\n const decorators = ts.getDecorators(node) ?? [];\n\n for (const decorator of decorators) {\n const expression = decorator.expression;\n\n if (!ts.isCallExpression(expression) || !ts.isIdentifier(expression.expression)) {\n continue;\n }\n\n const stereotype = stereotypeByLocalName.get(expression.expression.text);\n\n if (!stereotype) {\n continue;\n }\n\n if (stereotype !== ArtifactStereotypes.ROOT_DECORATOR) {\n types.push(ArtifactStereotypes.BY_DECORATOR[stereotype]);\n continue;\n }\n\n const type = this.typeOfInjectableCall({ call: expression });\n\n if (!type) {\n this.logger\n .for('artifactTypesOf')\n .warn(\n 'Skipped %s in %s | @injectable type is not a literal or ArtifactTypes.<NAME>',\n className,\n filePath,\n );\n continue;\n }\n\n types.push(type);\n }\n\n return types;\n }\n\n private typeOfInjectableCall(opts: { call: ts.CallExpression }): TArtifactType | undefined {\n const [argument] = opts.call.arguments;\n\n if (!argument || !ts.isObjectLiteralExpression(argument)) {\n return undefined;\n }\n\n const property = argument.properties.find(\n (entry): entry is ts.PropertyAssignment =>\n ts.isPropertyAssignment(entry) && ts.isIdentifier(entry.name) && entry.name.text === 'type',\n );\n\n if (!property) {\n return undefined;\n }\n\n const value = property.initializer;\n\n if (ts.isStringLiteral(value)) {\n return this.asArtifactType({ raw: value.text });\n }\n\n if (\n ts.isPropertyAccessExpression(value) &&\n ts.isIdentifier(value.expression) &&\n value.expression.text === 'ArtifactTypes'\n ) {\n return this.asArtifactType({ raw: value.name.text.toLowerCase() });\n }\n\n return undefined;\n }\n\n private asArtifactType(opts: { raw: string }): TArtifactType | undefined {\n const { raw } = opts;\n\n return ArtifactStereotypes.EMIT_ORDER.map((entry) => entry.type)\n .concat(ArtifactTypes.MODEL)\n .find((type) => type === raw);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/vite/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAajD,mWAAmW;AACnW,MAAM,OAAO,wBAAwB;aACnB,qBAAgB,GAAG,KAAK,oBAAoB,CAAC,OAAO,EAAE,CAAC;IAEvE;QACE,eAAe,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,6FAA6F;IAC7F,wGAAwG;IACxG,MAAM,CAAC,UAAU,CAAC,IAAoB;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,GAA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,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAEzC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;oBACvC,OAAO,SAAS,CAAC;gBACnB,CAAC;gBAED,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChC,CAAC,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;oBACpE,CAAC,CAAC,IAAI,CAAC;gBAET,OAAO,UAAU;oBACf,CAAC,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;oBACnF,CAAC,CAAC,OAAO,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC","sourcesContent":["import { resolve } from 'node:path';\nimport { ArtifactScanner } from '../generator';\nimport { IgnisArtifactsPlugin } from '../bun/plugin';\nimport { ArtifactSources } from '../bun/sources';\n\n/** The slice of Vite's plugin contract this plugin uses - typed here so `@venizia/ignis-boot` does not depend on `vite`. */\nexport interface IIgnisVitePlugin {\n name: string;\n enforce: 'pre';\n config: () => { optimizeDeps: { exclude: string[] } };\n configResolved: (config: { root: string }) => void;\n resolveId: (id: string) => string | undefined;\n load: (id: string) => string | undefined;\n transform: (code: string, id: string) => string | undefined;\n}\n\n/** `IgnisArtifactsPlugin` for Vite: serves `ignis:artifacts`, replaces `@venizia/ignis-boot/auto` with an eager import of it (a browser bundle is tree-shaken only when eager), inlines every `ArtifactGroup.define` / `application` call, and pins the name of every scanned class - binding keys are built from `Class.name`, and a minifier renames classes. */\nexport class IgnisArtifactsVitePlugin {\n static readonly RESOLVED_VIRTUAL = `\\0${IgnisArtifactsPlugin.VIRTUAL}`;\n\n static {\n ArtifactSources.useScanner({ scanner: ArtifactScanner.getInstance() });\n }\n\n /** `root`: the `src` to scan (default: the one beside the `package.json` of Vite's root). */\n /** The file a module id names: vite dev adds a query (`?v=<hash>`) to the id of a node_modules file. */\n static filePathOf(opts: { id: string }): string {\n const queryAt = opts.id.indexOf('?');\n\n return queryAt === -1 ? opts.id : opts.id.slice(0, queryAt);\n }\n\n static create(opts: { root?: string } = {}): IIgnisVitePlugin {\n let root = opts.root ? resolve(opts.root) : '';\n let groupFiles = new Set<string>();\n let classesByFile = new Map<string, Set<string>>();\n const autoModule = `import { ${IgnisArtifactsPlugin.EXPORT_NAME} } from '${IgnisArtifactsPlugin.VIRTUAL}';\\nimport { AutoArtifactGroup } from './auto-group';\\nexport default new AutoArtifactGroup({ content: ${IgnisArtifactsPlugin.EXPORT_NAME} });\\n`;\n\n return {\n name: IgnisArtifactsPlugin.NAME,\n enforce: 'pre',\n // Pre-bundling would hide `auto` inside a dependency chunk, out of reach of `load`.\n config: () => ({ optimizeDeps: { exclude: ['@venizia/ignis-boot'] } }),\n configResolved: (config) => {\n root ||= ArtifactSources.packageSource({ from: config.root });\n groupFiles = new Set(IgnisArtifactsPlugin.groupDefinitionFiles({ root }));\n classesByFile = IgnisArtifactsPlugin.pinnedClasses({ root, groupFiles: [...groupFiles] });\n },\n resolveId: (id) =>\n id === IgnisArtifactsPlugin.VIRTUAL ? IgnisArtifactsVitePlugin.RESOLVED_VIRTUAL : undefined,\n load: (id) => {\n if (id === IgnisArtifactsVitePlugin.RESOLVED_VIRTUAL) {\n return IgnisArtifactsPlugin.render({ root });\n }\n\n return IgnisArtifactsPlugin.AUTO_MODULE.test(IgnisArtifactsVitePlugin.filePathOf({ id }))\n ? autoModule\n : undefined;\n },\n transform: (code, moduleId) => {\n const id = IgnisArtifactsVitePlugin.filePathOf({ id: moduleId });\n const classNames = classesByFile.get(id);\n\n if (!groupFiles.has(id) && !classNames) {\n return undefined;\n }\n\n const grouped = groupFiles.has(id)\n ? IgnisArtifactsPlugin.rewriteGroups({ filePath: id, source: code })\n : code;\n\n return classNames\n ? IgnisArtifactsPlugin.pinClassNames({ filePath: id, source: grouped, classNames })\n : grouped;\n },\n };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-boot",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8-1",
|
|
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",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"LICENSE.md",
|
|
38
38
|
"dist",
|
|
39
39
|
"!**/__tests__",
|
|
40
|
+
"!**/*.d.ts.map",
|
|
40
41
|
"!**/*.tsbuildinfo"
|
|
41
42
|
],
|
|
42
43
|
"sideEffects": [
|
|
@@ -79,12 +80,12 @@
|
|
|
79
80
|
"test": "bun test ./src"
|
|
80
81
|
},
|
|
81
82
|
"dependencies": {
|
|
82
|
-
"@venizia/ignis-helpers": "0.4.
|
|
83
|
-
"@venizia/ignis-inversion": "0.4.
|
|
83
|
+
"@venizia/ignis-helpers": "0.4.8-1",
|
|
84
|
+
"@venizia/ignis-inversion": "0.4.7-1"
|
|
84
85
|
},
|
|
85
86
|
"devDependencies": {
|
|
86
87
|
"@types/bun": "^1.4.3",
|
|
87
|
-
"@venizia/dev-configs": "0.4.
|
|
88
|
+
"@venizia/dev-configs": "0.4.8-1",
|
|
88
89
|
"eslint": "^10.13.0",
|
|
89
90
|
"oxlint": "1.89.0",
|
|
90
91
|
"oxlint-tsgolint": "7.0.2004",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,wBAAwB;IACnC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAKxC;IAEF,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAMvC;IAEF,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAKvC;IAEF,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAA4C;CACxF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-info/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-info/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/build-info/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAYvF;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAoB;IAE5C,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,iBAAiB;IAIjC,OAAO,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkClE,OAAO,CAAC,uBAAuB;IAW/B;;;OAGG;YACW,eAAe;IA0B7B,iIAAiI;IACjI,OAAO,CAAC,eAAe;CAyBxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stamp.d.ts","sourceRoot":"","sources":["../../../src/build-info/stamp.ts"],"names":[],"mappings":"AAOA;;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oot":"","sources":["../../../src/bun/auto-loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAG7B,0MAA0M;AAC1M,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;WASxC,IAAI,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAyBrD,2HAA2H;WAC9G,WAAW,CAAC,IAAI,EAAE;QAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,uBAAuB,CAAC;CA2BrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../../../src/bun/auto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOjD,6RAA6R;AAC7R,QAAA,MAAM,aAAa,mBAAuE,CAAC;AAE3F,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group-resolver.d.ts","sourceRoot":"","sources":["../../../src/bun/group-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,2OAA2O;AAC3O,qBAAa,sBAAsB;IACjC,uGAAuG;IACvG,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAA+D;WAE5E,OAAO,CAAC,IAAI,EAAE;QACzB,KAAK,EAAE;YACL,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;YAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;YACzB,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;SAChC,CAAC;KACH,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA8BpC,mIAAmI;IACnI,MAAM,CAAC,OAAO,IAAI,IAAI;CAavB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bun/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/bun/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAQrC,6QAA6Q;AAC7Q,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,QAAQ,CAAC,IAAI,qBAAqB;IACzC,MAAM,CAAC,QAAQ,CAAC,OAAO,qBAAqB;IAC5C,MAAM,CAAC,QAAQ,CAAC,WAAW,wBAAwB;IAEnD,uIAAuI;IACvI,MAAM,CAAC,QAAQ,CAAC,WAAW,SACkF;IAE7G,oHAAoH;IACpH,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAsD;IAEjF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAA8D;IAMjG,8GAA8G;IAC9G,MAAM,CAAC,WAAW,CAAC,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,MAAM;IAMxD,wLAAwL;IACxL,MAAM,CAAC,cAAc,IAAI,MAAM;IAK/B,+NAA+N;IAC/N,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAoB7D,sYAAsY;IACtY,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAA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,0 @@
|
|
|
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;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IA0B7C,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/bun/sources.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGjF,UAAU,gBAAgB;IACxB,cAAc,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,OAAO,CAAA;KAAE,GAAG;QAChE,SAAS,EAAE,gBAAgB,EAAE,CAAC;KAC/B,CAAC;CACH;AAED,mSAAmS;AACnS,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM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|
|
|
1
|
-
{"version":3,"file":"install-quiet-logger.d.ts","sourceRoot":"","sources":["../../../src/common/install-quiet-logger.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quiet-logger.d.ts","sourceRoot":"","sources":["../../../src/common/quiet-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGtE,mMAAmM;AACnM,qBAAa,WAAY,YAAW,OAAO;IAIrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAH1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO;IAIP,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAWlC,OAAO,CAAC,KAAK;IAIb,KAAK,IAAI,IAAI;IAEb,IAAI,IAAI,IAAI;IAEZ,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAQhE,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAGjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,iIAAiI;AACjI,qBAAa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MAAM,EAAE,aAAa,CAAC,CAAC,CAQnE;IAEF,MAAM,CAAC,QAAQ,CAAC,cAAc,gBAAgB;IAE9C,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAoE;IAE9F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAItC,MAAM,CAAC,QAAQ,CAAC,cAAc,SAA4C;IAE1E,MAAM,CAAC,QAAQ,CAAC,cAAc,WAK5B;IAEF;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAO5F;CACH;AAED,gFAAgF;AAChF,qBAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,YAAY,kBAAkB;IAC9C,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IAEpC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAqE;IAE/F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvF,MAAM,WAAW,gBAAgB;IA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AM,CAAC;IACpB,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,qFAAqF;AACrF,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAC,MAAM;IAqBrB,2HAA2H;IAC3H,OAAO,CAAC,MAAM,CAAC,MAAM;IAIrB,0GAA0G;IAC1G,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,WAAW;IAe5F,4GAA4G;IAC5G,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG;QACpC,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAC;KAC7B;CAUF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reexport.d.ts","sourceRoot":"","sources":["../../../src/generator/reexport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMpD,8OAA8O;AAC9O,qBAAa,0BAA2B,SAAQ,UAAU;IACxD,MAAM,CAAC,QAAQ,CAAC,SAAS,MAAM;IAE/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAc;IAC5C,mHAAmH;IACnH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;IACrE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAo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AA0B;IAgBlC,OAAO,CAAC,wBAAwB;IAkBhC,OAAO,CAAC,eAAe;IA0CvB,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,cAAc;CAMvB"}
|
package/dist/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugin.ts"],"names":[],"mappings":"AAKA,4HAA4H;AAC5H,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM;QAAE,YAAY,EAAE;YAAE,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,CAAC;IACtD,cAAc,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACnD,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC9C,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACzC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC7D;AAED,mWAAmW;AACnW,qBAAa,wBAAwB;IACnC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,SAAuC;IAMvE,6FAA6F;IAC7F,wGAAwG;IACxG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAK/C,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,gBAAgB;CAyC9D"}
|