@agimon-ai/doompi 0.0.1-alpha.85 → 0.0.1-alpha.86
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/src/builders/web/webPluginVite.cjs +1 -0
- package/dist/src/builders/web/webPluginVite.cjs.map +1 -1
- package/dist/src/builders/web/webPluginVite.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginVite.mjs +1 -0
- package/dist/src/builders/web/webPluginVite.mjs.map +1 -1
- package/package.json +14 -14
|
@@ -70,6 +70,7 @@ function webPluginOverridePlugin(clientRoot, generated) {
|
|
|
70
70
|
name: "doompi-web-plugin-overrides",
|
|
71
71
|
enforce: "pre",
|
|
72
72
|
async resolveId(source, importer, options) {
|
|
73
|
+
if (!source.includes("webPlugins.generated") && !source.includes("webPluginSources.generated.css")) return null;
|
|
73
74
|
const resolved = await this.resolve(source, importer, {
|
|
74
75
|
...options,
|
|
75
76
|
skipSelf: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPluginVite.cjs","names":["createRequire","path","PLUGIN_ROOTS_ENV","devPluginRoots","readSyncRegistration","PLUGIN_ROOTS_FILE","fs"],"sources":["../../../../src/builders/web/webPluginVite.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { readSyncRegistration } from '@agimon-ai/doompi-core/syncRegistration';\nimport type { Alias, Plugin } from 'vite';\n\nimport { devPluginRoots, PLUGIN_ROOTS_ENV, PLUGIN_ROOTS_FILE } from './webDevRoots';\nimport type { SyncGeneratedModules } from './webPluginGenerate';\n\nconst DOOMPI_ROOT_ENV = 'DOOMPI_ROOT';\n\n/**\n * The modules the cockpit supplies page-wide, rather than each plugin\n * carrying its own copy.\n *\n * Build-time metadata, and it stays here rather than in a browser-facing\n * barrel on purpose: exporting it from doompi-core/web put the literal list\n * into the shipped cockpit bundle, where a plugin's own specifier strings\n * would then appear as data.\n */\nexport const WEB_PLUGIN_RUNTIME_SPECIFIERS = [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n 'react-dom/client',\n '@tanstack/store',\n '@tanstack/react-store',\n '@agimon-ai/doompi-core/web',\n '@agimon-ai/doompi-web-components',\n '@agimon-ai/doompi-web-security/browser',\n '@codemirror/state',\n '@codemirror/view',\n] as const;\n\nconst WEB_PLUGIN_RUNTIME_PROPERTIES: Record<(typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number], string> = {\n react: 'react',\n 'react/jsx-runtime': 'reactJsxRuntime',\n 'react/jsx-dev-runtime': 'reactJsxDevRuntime',\n 'react-dom': 'reactDom',\n 'react-dom/client': 'reactDomClient',\n '@tanstack/store': 'tanstackStore',\n '@tanstack/react-store': 'tanstackReactStore',\n '@agimon-ai/doompi-core/web': 'webContracts',\n '@agimon-ai/doompi-web-components': 'webComponents',\n '@agimon-ai/doompi-web-security/browser': 'webSecurityBrowser',\n '@codemirror/state': 'codemirrorState',\n '@codemirror/view': 'codemirrorView',\n};\n\n/** Rollup expression for a shared module supplied by the session shell. */\nexport function webPluginRuntimeGlobal(specifier: (typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number]): string {\n return `globalThis.DoomPiWebPluginRuntime.${WEB_PLUGIN_RUNTIME_PROPERTIES[specifier]}`;\n}\n\n/** Resolves generated JSX imports from the host instead of a plugin's optional React peer tree. */\nexport function webPluginRuntimeAliases(clientRoot: string): Alias[] {\n const runtimeRequire = createRequire(path.join(clientRoot, 'index.html'));\n return WEB_PLUGIN_RUNTIME_SPECIFIERS.filter((specifier) => specifier.startsWith('react/jsx-')).map((specifier) => ({\n find: new RegExp(`^${specifier.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`, 'u'),\n replacement: runtimeRequire.resolve(specifier),\n }));\n}\n\n/**\n * Swaps the committed builtin registry modules for generated ones. A\n * resolveId hook rather than resolve.alias because aliases match raw import\n * specifiers while these two are known by their resolved paths. Both the\n * sync-time build and the dev server use it, so a plugin edit in dev is the\n * same module the bundle would carry.\n */\nexport function webPluginOverridePlugin(clientRoot: string, generated: SyncGeneratedModules): Plugin {\n const overrides = new Map([\n [path.join(clientRoot, 'app', 'webPlugins.generated.ts'), generated.clientModulePath],\n [path.join(clientRoot, 'styles', 'webPluginSources.generated.css'), generated.cssModulePath],\n ]);\n return {\n name: 'doompi-web-plugin-overrides',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n if (!resolved) return null;\n return overrides.get(resolved.id) ?? null;\n },\n };\n}\n\n/**\n * The CSS sources module cannot ride the resolveId hook: Vite and Tailwind\n * resolve CSS @import through Vite's own id resolver, which consults aliases\n * but no plugin hooks. Without this the builtin (empty) @source list ships\n * and every plugin-only utility class is missing.\n */\nexport function webPluginCssAlias(generated: SyncGeneratedModules): Alias {\n return { find: /^\\.\\/webPluginSources\\.generated\\.css$/, replacement: generated.cssModulePath };\n}\n\n/** The plugin package roots the dev server should serve, from an explicit override or DOOMPI_ROOT. */\nexport function readDevPluginRoots(environment: NodeJS.ProcessEnv, homeDirectory: string): string[] {\n const explicit = environment[PLUGIN_ROOTS_ENV];\n if (explicit !== undefined && explicit !== '') {\n return devPluginRoots({ envValue: explicit, rootsFileText: undefined, delimiter: path.delimiter });\n }\n const repoRoot = environment[DOOMPI_ROOT_ENV];\n if (repoRoot === undefined || repoRoot === '') return [];\n try {\n const webDirectory = readSyncRegistration(repoRoot, homeDirectory)?.webDirectory;\n const rootsFile =\n webDirectory === null || webDirectory === undefined\n ? undefined\n : path.join(path.dirname(webDirectory), PLUGIN_ROOTS_FILE);\n return devPluginRoots({\n envValue: undefined,\n rootsFileText:\n rootsFile !== undefined && fs.existsSync(rootsFile) ? fs.readFileSync(rootsFile, 'utf8') : undefined,\n delimiter: path.delimiter,\n });\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,kBAAkB;;;;;;;;;;AAWxB,MAAa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,SAAgB,mBAAmB,aAAgC,eAAiC;CAClG,MAAM,WAAW,YAAYC,oBAAAA;CAC7B,IAAI,aAAa,KAAA,KAAa,aAAa,IACzC,OAAOC,oBAAAA,eAAe;EAAE,UAAU;EAAU,eAAe,KAAA;EAAW,WAAWF,UAAAA,QAAK;CAAU,CAAC;CAEnG,MAAM,WAAW,YAAY;CAC7B,IAAI,aAAa,KAAA,KAAa,aAAa,IAAI,OAAO,CAAC;CACvD,IAAI;EACF,MAAM,gBAAA,GAAeG,wCAAAA,qBAAAA,CAAqB,UAAU,aAAa,CAAC,EAAE;EACpE,MAAM,YACJ,iBAAiB,QAAQ,iBAAiB,KAAA,IACtC,KAAA,IACAH,UAAAA,QAAK,KAAKA,UAAAA,QAAK,QAAQ,YAAY,GAAGI,oBAAAA,iBAAiB;EAC7D,OAAOF,oBAAAA,eAAe;GACpB,UAAU,KAAA;GACV,eACE,cAAc,KAAA,KAAaG,QAAAA,QAAG,WAAW,SAAS,IAAIA,QAAAA,QAAG,aAAa,WAAW,MAAM,IAAI,KAAA;GAC7F,WAAWL,UAAAA,QAAK;EAClB,CAAC;CACH,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
|
|
1
|
+
{"version":3,"file":"webPluginVite.cjs","names":["createRequire","path","PLUGIN_ROOTS_ENV","devPluginRoots","readSyncRegistration","PLUGIN_ROOTS_FILE","fs"],"sources":["../../../../src/builders/web/webPluginVite.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { readSyncRegistration } from '@agimon-ai/doompi-core/syncRegistration';\nimport type { Alias, Plugin } from 'vite';\n\nimport { devPluginRoots, PLUGIN_ROOTS_ENV, PLUGIN_ROOTS_FILE } from './webDevRoots';\nimport type { SyncGeneratedModules } from './webPluginGenerate';\n\nconst DOOMPI_ROOT_ENV = 'DOOMPI_ROOT';\n\n/**\n * The modules the cockpit supplies page-wide, rather than each plugin\n * carrying its own copy.\n *\n * Build-time metadata, and it stays here rather than in a browser-facing\n * barrel on purpose: exporting it from doompi-core/web put the literal list\n * into the shipped cockpit bundle, where a plugin's own specifier strings\n * would then appear as data.\n */\nexport const WEB_PLUGIN_RUNTIME_SPECIFIERS = [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n 'react-dom/client',\n '@tanstack/store',\n '@tanstack/react-store',\n '@agimon-ai/doompi-core/web',\n '@agimon-ai/doompi-web-components',\n '@agimon-ai/doompi-web-security/browser',\n '@codemirror/state',\n '@codemirror/view',\n] as const;\n\nconst WEB_PLUGIN_RUNTIME_PROPERTIES: Record<(typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number], string> = {\n react: 'react',\n 'react/jsx-runtime': 'reactJsxRuntime',\n 'react/jsx-dev-runtime': 'reactJsxDevRuntime',\n 'react-dom': 'reactDom',\n 'react-dom/client': 'reactDomClient',\n '@tanstack/store': 'tanstackStore',\n '@tanstack/react-store': 'tanstackReactStore',\n '@agimon-ai/doompi-core/web': 'webContracts',\n '@agimon-ai/doompi-web-components': 'webComponents',\n '@agimon-ai/doompi-web-security/browser': 'webSecurityBrowser',\n '@codemirror/state': 'codemirrorState',\n '@codemirror/view': 'codemirrorView',\n};\n\n/** Rollup expression for a shared module supplied by the session shell. */\nexport function webPluginRuntimeGlobal(specifier: (typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number]): string {\n return `globalThis.DoomPiWebPluginRuntime.${WEB_PLUGIN_RUNTIME_PROPERTIES[specifier]}`;\n}\n\n/** Resolves generated JSX imports from the host instead of a plugin's optional React peer tree. */\nexport function webPluginRuntimeAliases(clientRoot: string): Alias[] {\n const runtimeRequire = createRequire(path.join(clientRoot, 'index.html'));\n return WEB_PLUGIN_RUNTIME_SPECIFIERS.filter((specifier) => specifier.startsWith('react/jsx-')).map((specifier) => ({\n find: new RegExp(`^${specifier.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`, 'u'),\n replacement: runtimeRequire.resolve(specifier),\n }));\n}\n\n/**\n * Swaps the committed builtin registry modules for generated ones. A\n * resolveId hook rather than resolve.alias because aliases match raw import\n * specifiers while these two are known by their resolved paths. Both the\n * sync-time build and the dev server use it, so a plugin edit in dev is the\n * same module the bundle would carry.\n */\nexport function webPluginOverridePlugin(clientRoot: string, generated: SyncGeneratedModules): Plugin {\n const overrides = new Map([\n [path.join(clientRoot, 'app', 'webPlugins.generated.ts'), generated.clientModulePath],\n [path.join(clientRoot, 'styles', 'webPluginSources.generated.css'), generated.cssModulePath],\n ]);\n return {\n name: 'doompi-web-plugin-overrides',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n if (!source.includes('webPlugins.generated') && !source.includes('webPluginSources.generated.css')) return null;\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n if (!resolved) return null;\n return overrides.get(resolved.id) ?? null;\n },\n };\n}\n\n/**\n * The CSS sources module cannot ride the resolveId hook: Vite and Tailwind\n * resolve CSS @import through Vite's own id resolver, which consults aliases\n * but no plugin hooks. Without this the builtin (empty) @source list ships\n * and every plugin-only utility class is missing.\n */\nexport function webPluginCssAlias(generated: SyncGeneratedModules): Alias {\n return { find: /^\\.\\/webPluginSources\\.generated\\.css$/, replacement: generated.cssModulePath };\n}\n\n/** The plugin package roots the dev server should serve, from an explicit override or DOOMPI_ROOT. */\nexport function readDevPluginRoots(environment: NodeJS.ProcessEnv, homeDirectory: string): string[] {\n const explicit = environment[PLUGIN_ROOTS_ENV];\n if (explicit !== undefined && explicit !== '') {\n return devPluginRoots({ envValue: explicit, rootsFileText: undefined, delimiter: path.delimiter });\n }\n const repoRoot = environment[DOOMPI_ROOT_ENV];\n if (repoRoot === undefined || repoRoot === '') return [];\n try {\n const webDirectory = readSyncRegistration(repoRoot, homeDirectory)?.webDirectory;\n const rootsFile =\n webDirectory === null || webDirectory === undefined\n ? undefined\n : path.join(path.dirname(webDirectory), PLUGIN_ROOTS_FILE);\n return devPluginRoots({\n envValue: undefined,\n rootsFileText:\n rootsFile !== undefined && fs.existsSync(rootsFile) ? fs.readFileSync(rootsFile, 'utf8') : undefined,\n delimiter: path.delimiter,\n });\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,kBAAkB;;;;;;;;;;AAWxB,MAAa,gCAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,gCAAgG;CACpG,OAAO;CACP,qBAAqB;CACrB,yBAAyB;CACzB,aAAa;CACb,oBAAoB;CACpB,mBAAmB;CACnB,yBAAyB;CACzB,8BAA8B;CAC9B,oCAAoC;CACpC,0CAA0C;CAC1C,qBAAqB;CACrB,oBAAoB;AACtB;;AAGA,SAAgB,uBAAuB,WAAmE;CACxG,OAAO,qCAAqC,8BAA8B;AAC5E;;AAGA,SAAgB,wBAAwB,YAA6B;CACnE,MAAM,kBAAA,GAAiBA,YAAAA,cAAAA,CAAcC,UAAAA,QAAK,KAAK,YAAY,YAAY,CAAC;CACxE,OAAO,8BAA8B,QAAQ,cAAc,UAAU,WAAW,YAAY,CAAC,CAAC,CAAC,KAAK,eAAe;EACjH,MAAM,IAAI,OAAO,IAAI,UAAU,QAAQ,uBAAuB,MAAM,EAAE,IAAI,GAAG;EAC7E,aAAa,eAAe,QAAQ,SAAS;CAC/C,EAAE;AACJ;;;;;;;;AASA,SAAgB,wBAAwB,YAAoB,WAAyC;CACnG,MAAM,4BAAY,IAAI,IAAI,CACxB,CAACA,UAAAA,QAAK,KAAK,YAAY,OAAO,yBAAyB,GAAG,UAAU,gBAAgB,GACpF,CAACA,UAAAA,QAAK,KAAK,YAAY,UAAU,gCAAgC,GAAG,UAAU,aAAa,CAC7F,CAAC;CACD,OAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,QAAQ,UAAU,SAAS;GACzC,IAAI,CAAC,OAAO,SAAS,sBAAsB,KAAK,CAAC,OAAO,SAAS,gCAAgC,GAAG,OAAO;GAC3G,MAAM,WAAW,MAAM,K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":3,"file":"webPluginVite.d.mts","names":[],"sources":["../../../../src/builders/web/webPluginVite.ts"],"mappings":";;;;;;;;;;;;qBAqBa;;wBA+BG,uBAAuB,mBAAmB;;wBAK1C,wBAAwB,qBAAqB;;;;;;;;wBAe7C,wBAAwB,oBAAoB,WAAW,uBAAuB;;;;;;;wBAuB9E,kBAAkB,WAAW,uBAAuB;;wBAKpD,mBAAmB,aAAa,OAAO,YAAY"}
|
|
@@ -67,6 +67,7 @@ function webPluginOverridePlugin(clientRoot, generated) {
|
|
|
67
67
|
name: "doompi-web-plugin-overrides",
|
|
68
68
|
enforce: "pre",
|
|
69
69
|
async resolveId(source, importer, options) {
|
|
70
|
+
if (!source.includes("webPlugins.generated") && !source.includes("webPluginSources.generated.css")) return null;
|
|
70
71
|
const resolved = await this.resolve(source, importer, {
|
|
71
72
|
...options,
|
|
72
73
|
skipSelf: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webPluginVite.mjs","names":[],"sources":["../../../../src/builders/web/webPluginVite.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { readSyncRegistration } from '@agimon-ai/doompi-core/syncRegistration';\nimport type { Alias, Plugin } from 'vite';\n\nimport { devPluginRoots, PLUGIN_ROOTS_ENV, PLUGIN_ROOTS_FILE } from './webDevRoots';\nimport type { SyncGeneratedModules } from './webPluginGenerate';\n\nconst DOOMPI_ROOT_ENV = 'DOOMPI_ROOT';\n\n/**\n * The modules the cockpit supplies page-wide, rather than each plugin\n * carrying its own copy.\n *\n * Build-time metadata, and it stays here rather than in a browser-facing\n * barrel on purpose: exporting it from doompi-core/web put the literal list\n * into the shipped cockpit bundle, where a plugin's own specifier strings\n * would then appear as data.\n */\nexport const WEB_PLUGIN_RUNTIME_SPECIFIERS = [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n 'react-dom/client',\n '@tanstack/store',\n '@tanstack/react-store',\n '@agimon-ai/doompi-core/web',\n '@agimon-ai/doompi-web-components',\n '@agimon-ai/doompi-web-security/browser',\n '@codemirror/state',\n '@codemirror/view',\n] as const;\n\nconst WEB_PLUGIN_RUNTIME_PROPERTIES: Record<(typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number], string> = {\n react: 'react',\n 'react/jsx-runtime': 'reactJsxRuntime',\n 'react/jsx-dev-runtime': 'reactJsxDevRuntime',\n 'react-dom': 'reactDom',\n 'react-dom/client': 'reactDomClient',\n '@tanstack/store': 'tanstackStore',\n '@tanstack/react-store': 'tanstackReactStore',\n '@agimon-ai/doompi-core/web': 'webContracts',\n '@agimon-ai/doompi-web-components': 'webComponents',\n '@agimon-ai/doompi-web-security/browser': 'webSecurityBrowser',\n '@codemirror/state': 'codemirrorState',\n '@codemirror/view': 'codemirrorView',\n};\n\n/** Rollup expression for a shared module supplied by the session shell. */\nexport function webPluginRuntimeGlobal(specifier: (typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number]): string {\n return `globalThis.DoomPiWebPluginRuntime.${WEB_PLUGIN_RUNTIME_PROPERTIES[specifier]}`;\n}\n\n/** Resolves generated JSX imports from the host instead of a plugin's optional React peer tree. */\nexport function webPluginRuntimeAliases(clientRoot: string): Alias[] {\n const runtimeRequire = createRequire(path.join(clientRoot, 'index.html'));\n return WEB_PLUGIN_RUNTIME_SPECIFIERS.filter((specifier) => specifier.startsWith('react/jsx-')).map((specifier) => ({\n find: new RegExp(`^${specifier.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`, 'u'),\n replacement: runtimeRequire.resolve(specifier),\n }));\n}\n\n/**\n * Swaps the committed builtin registry modules for generated ones. A\n * resolveId hook rather than resolve.alias because aliases match raw import\n * specifiers while these two are known by their resolved paths. Both the\n * sync-time build and the dev server use it, so a plugin edit in dev is the\n * same module the bundle would carry.\n */\nexport function webPluginOverridePlugin(clientRoot: string, generated: SyncGeneratedModules): Plugin {\n const overrides = new Map([\n [path.join(clientRoot, 'app', 'webPlugins.generated.ts'), generated.clientModulePath],\n [path.join(clientRoot, 'styles', 'webPluginSources.generated.css'), generated.cssModulePath],\n ]);\n return {\n name: 'doompi-web-plugin-overrides',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n if (!resolved) return null;\n return overrides.get(resolved.id) ?? null;\n },\n };\n}\n\n/**\n * The CSS sources module cannot ride the resolveId hook: Vite and Tailwind\n * resolve CSS @import through Vite's own id resolver, which consults aliases\n * but no plugin hooks. Without this the builtin (empty) @source list ships\n * and every plugin-only utility class is missing.\n */\nexport function webPluginCssAlias(generated: SyncGeneratedModules): Alias {\n return { find: /^\\.\\/webPluginSources\\.generated\\.css$/, replacement: generated.cssModulePath };\n}\n\n/** The plugin package roots the dev server should serve, from an explicit override or DOOMPI_ROOT. */\nexport function readDevPluginRoots(environment: NodeJS.ProcessEnv, homeDirectory: string): string[] {\n const explicit = environment[PLUGIN_ROOTS_ENV];\n if (explicit !== undefined && explicit !== '') {\n return devPluginRoots({ envValue: explicit, rootsFileText: undefined, delimiter: path.delimiter });\n }\n const repoRoot = environment[DOOMPI_ROOT_ENV];\n if (repoRoot === undefined || repoRoot === '') return [];\n try {\n const webDirectory = readSyncRegistration(repoRoot, homeDirectory)?.webDirectory;\n const rootsFile =\n webDirectory === null || webDirectory === undefined\n ? undefined\n : path.join(path.dirname(webDirectory), PLUGIN_ROOTS_FILE);\n return devPluginRoots({\n envValue: undefined,\n rootsFileText:\n rootsFile !== undefined && fs.existsSync(rootsFile) ? fs.readFileSync(rootsFile, 'utf8') : undefined,\n delimiter: path.delimiter,\n });\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;AAUA,MAAM,kBAAkB;;;;;;;;;;AAWxB,MAAa,gCAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,gCAAgG;CACpG,OAAO;CACP,qBAAqB;CACrB,yBAAy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,MAAM,WAAW,YAAY;CAC7B,IAAI,aAAa,KAAA,KAAa,aAAa,IAAI,OAAO,CAAC;CACvD,IAAI;EACF,MAAM,eAAe,qBAAqB,UAAU,aAAa,CAAC,EAAE;EACpE,MAAM,YACJ,iBAAiB,QAAQ,iBAAiB,KAAA,IACtC,KAAA,IACA,KAAK,KAAK,KAAK,QAAQ,YAAY,GAAG,iBAAiB;EAC7D,OAAO,eAAe;GACpB,UAAU,KAAA;GACV,eACE,cAAc,KAAA,KAAa,GAAG,WAAW,SAAS,IAAI,GAAG,aAAa,WAAW,MAAM,IAAI,KAAA;GAC7F,WAAW,KAAK;EAClB,CAAC;CACH,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
|
|
1
|
+
{"version":3,"file":"webPluginVite.mjs","names":[],"sources":["../../../../src/builders/web/webPluginVite.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { readSyncRegistration } from '@agimon-ai/doompi-core/syncRegistration';\nimport type { Alias, Plugin } from 'vite';\n\nimport { devPluginRoots, PLUGIN_ROOTS_ENV, PLUGIN_ROOTS_FILE } from './webDevRoots';\nimport type { SyncGeneratedModules } from './webPluginGenerate';\n\nconst DOOMPI_ROOT_ENV = 'DOOMPI_ROOT';\n\n/**\n * The modules the cockpit supplies page-wide, rather than each plugin\n * carrying its own copy.\n *\n * Build-time metadata, and it stays here rather than in a browser-facing\n * barrel on purpose: exporting it from doompi-core/web put the literal list\n * into the shipped cockpit bundle, where a plugin's own specifier strings\n * would then appear as data.\n */\nexport const WEB_PLUGIN_RUNTIME_SPECIFIERS = [\n 'react',\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n 'react-dom',\n 'react-dom/client',\n '@tanstack/store',\n '@tanstack/react-store',\n '@agimon-ai/doompi-core/web',\n '@agimon-ai/doompi-web-components',\n '@agimon-ai/doompi-web-security/browser',\n '@codemirror/state',\n '@codemirror/view',\n] as const;\n\nconst WEB_PLUGIN_RUNTIME_PROPERTIES: Record<(typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number], string> = {\n react: 'react',\n 'react/jsx-runtime': 'reactJsxRuntime',\n 'react/jsx-dev-runtime': 'reactJsxDevRuntime',\n 'react-dom': 'reactDom',\n 'react-dom/client': 'reactDomClient',\n '@tanstack/store': 'tanstackStore',\n '@tanstack/react-store': 'tanstackReactStore',\n '@agimon-ai/doompi-core/web': 'webContracts',\n '@agimon-ai/doompi-web-components': 'webComponents',\n '@agimon-ai/doompi-web-security/browser': 'webSecurityBrowser',\n '@codemirror/state': 'codemirrorState',\n '@codemirror/view': 'codemirrorView',\n};\n\n/** Rollup expression for a shared module supplied by the session shell. */\nexport function webPluginRuntimeGlobal(specifier: (typeof WEB_PLUGIN_RUNTIME_SPECIFIERS)[number]): string {\n return `globalThis.DoomPiWebPluginRuntime.${WEB_PLUGIN_RUNTIME_PROPERTIES[specifier]}`;\n}\n\n/** Resolves generated JSX imports from the host instead of a plugin's optional React peer tree. */\nexport function webPluginRuntimeAliases(clientRoot: string): Alias[] {\n const runtimeRequire = createRequire(path.join(clientRoot, 'index.html'));\n return WEB_PLUGIN_RUNTIME_SPECIFIERS.filter((specifier) => specifier.startsWith('react/jsx-')).map((specifier) => ({\n find: new RegExp(`^${specifier.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}$`, 'u'),\n replacement: runtimeRequire.resolve(specifier),\n }));\n}\n\n/**\n * Swaps the committed builtin registry modules for generated ones. A\n * resolveId hook rather than resolve.alias because aliases match raw import\n * specifiers while these two are known by their resolved paths. Both the\n * sync-time build and the dev server use it, so a plugin edit in dev is the\n * same module the bundle would carry.\n */\nexport function webPluginOverridePlugin(clientRoot: string, generated: SyncGeneratedModules): Plugin {\n const overrides = new Map([\n [path.join(clientRoot, 'app', 'webPlugins.generated.ts'), generated.clientModulePath],\n [path.join(clientRoot, 'styles', 'webPluginSources.generated.css'), generated.cssModulePath],\n ]);\n return {\n name: 'doompi-web-plugin-overrides',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n if (!source.includes('webPlugins.generated') && !source.includes('webPluginSources.generated.css')) return null;\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n if (!resolved) return null;\n return overrides.get(resolved.id) ?? null;\n },\n };\n}\n\n/**\n * The CSS sources module cannot ride the resolveId hook: Vite and Tailwind\n * resolve CSS @import through Vite's own id resolver, which consults aliases\n * but no plugin hooks. Without this the builtin (empty) @source list ships\n * and every plugin-only utility class is missing.\n */\nexport function webPluginCssAlias(generated: SyncGeneratedModules): Alias {\n return { find: /^\\.\\/webPluginSources\\.generated\\.css$/, replacement: generated.cssModulePath };\n}\n\n/** The plugin package roots the dev server should serve, from an explicit override or DOOMPI_ROOT. */\nexport function readDevPluginRoots(environment: NodeJS.ProcessEnv, homeDirectory: string): string[] {\n const explicit = environment[PLUGIN_ROOTS_ENV];\n if (explicit !== undefined && explicit !== '') {\n return devPluginRoots({ envValue: explicit, rootsFileText: undefined, delimiter: path.delimiter });\n }\n const repoRoot = environment[DOOMPI_ROOT_ENV];\n if (repoRoot === undefined || repoRoot === '') return [];\n try {\n const webDirectory = readSyncRegistration(repoRoot, homeDirectory)?.webDirectory;\n const rootsFile =\n webDirectory === null || webDirectory === undefined\n ? undefined\n : path.join(path.dirname(webDirectory), PLUGIN_ROOTS_FILE);\n return devPluginRoots({\n envValue: undefined,\n rootsFileText:\n rootsFile !== undefined && fs.existsSync(rootsFile) ? fs.readFileSync(rootsFile, 'utf8') : undefined,\n delimiter: path.delimiter,\n });\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;AAUA,MAAM,kBAAkB;;;;;;;;;;AAWxB,MAAa,gCAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,gCAAgG;CACpG,OAAO;CACP,qBAAqB;CACrB,yBAAyB;CACzB,aAAa;CACb,oBAAoB;CACpB,mBAAmB;CACnB,yBAAyB;CACzB,8BAA8B;C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CAAC;CAEnG,MAAM,WAAW,YAAY;CAC7B,IAAI,aAAa,KAAA,KAAa,aAAa,IAAI,OAAO,CAAC;CACvD,IAAI;EACF,MAAM,eAAe,qBAAqB,UAAU,aAAa,CAAC,EAAE;EACpE,MAAM,YACJ,iBAAiB,QAAQ,iBAAiB,KAAA,IACtC,KAAA,IACA,KAAK,KAAK,KAAK,QAAQ,YAAY,GAAG,iBAAiB;EAC7D,OAAO,eAAe;GACpB,UAAU,KAAA;GACV,eACE,cAAc,KAAA,KAAa,GAAG,WAAW,SAAS,IAAI,GAAG,aAAa,WAAW,MAAM,IAAI,KAAA;GAC7F,WAAW,KAAK;EAClB,CAAC;CACH,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/doompi",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.86",
|
|
4
4
|
"description": "Opinionated, composable Pi distribution for scoped agent tools, skills, MCP servers, and developer workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -277,19 +277,19 @@
|
|
|
277
277
|
"registry": "https://registry.npmjs.org/"
|
|
278
278
|
},
|
|
279
279
|
"dependencies": {
|
|
280
|
-
"@agimon-ai/doompi-autostop": "0.0.1-alpha.
|
|
281
|
-
"@agimon-ai/doompi-cache": "0.0.1-alpha.
|
|
282
|
-
"@agimon-ai/doompi-config": "0.0.1-alpha.
|
|
283
|
-
"@agimon-ai/doompi-core": "0.0.1-alpha.
|
|
284
|
-
"@agimon-ai/doompi-domain": "0.0.1-alpha.
|
|
285
|
-
"@agimon-ai/doompi-major-mode": "0.0.1-alpha.
|
|
286
|
-
"@agimon-ai/doompi-minor-mode": "0.0.1-alpha.
|
|
287
|
-
"@agimon-ai/doompi-notification": "0.0.1-alpha.
|
|
288
|
-
"@agimon-ai/doompi-profile": "0.0.1-alpha.
|
|
289
|
-
"@agimon-ai/doompi-session": "0.0.1-alpha.
|
|
290
|
-
"@agimon-ai/doompi-skill": "0.0.1-alpha.
|
|
280
|
+
"@agimon-ai/doompi-autostop": "0.0.1-alpha.60",
|
|
281
|
+
"@agimon-ai/doompi-cache": "0.0.1-alpha.49",
|
|
282
|
+
"@agimon-ai/doompi-config": "0.0.1-alpha.82",
|
|
283
|
+
"@agimon-ai/doompi-core": "0.0.1-alpha.83",
|
|
284
|
+
"@agimon-ai/doompi-domain": "0.0.1-alpha.61",
|
|
285
|
+
"@agimon-ai/doompi-major-mode": "0.0.1-alpha.61",
|
|
286
|
+
"@agimon-ai/doompi-minor-mode": "0.0.1-alpha.83",
|
|
287
|
+
"@agimon-ai/doompi-notification": "0.0.1-alpha.60",
|
|
288
|
+
"@agimon-ai/doompi-profile": "0.0.1-alpha.61",
|
|
289
|
+
"@agimon-ai/doompi-session": "0.0.1-alpha.7",
|
|
290
|
+
"@agimon-ai/doompi-skill": "0.0.1-alpha.61",
|
|
291
291
|
"@agimon-ai/doompi-telemetry": "0.0.1-alpha.79",
|
|
292
|
-
"@agimon-ai/doompi-ui": "0.0.1-alpha.
|
|
292
|
+
"@agimon-ai/doompi-ui": "0.0.1-alpha.83",
|
|
293
293
|
"@agimon-ai/doompi-web-security": "0.0.1-alpha.42",
|
|
294
294
|
"@deepseek-ai/cordis": "4.0.2",
|
|
295
295
|
"@earendil-works/chord": "0.87.1",
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
"yaml": "2.9.1"
|
|
316
316
|
},
|
|
317
317
|
"devDependencies": {
|
|
318
|
-
"@agimon-ai/doompi-runner": "0.0.1-alpha.
|
|
318
|
+
"@agimon-ai/doompi-runner": "0.0.1-alpha.83",
|
|
319
319
|
"@agimon-ai/vibe-lint-plugin-doom-cli": "0.0.1-alpha.14",
|
|
320
320
|
"@earendil-works/pi-ai": "0.87.1",
|
|
321
321
|
"@earendil-works/pi-client": "0.87.1",
|