every-plugin 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/rspack/plugin.cjs +3 -2
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +3 -2
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/shared-deps.cjs +16 -0
- package/dist/build/shared-deps.cjs.map +1 -1
- package/dist/build/shared-deps.d.cts +28 -0
- package/dist/build/shared-deps.d.cts.map +1 -1
- package/dist/build/shared-deps.d.mts +28 -0
- package/dist/build/shared-deps.d.mts.map +1 -1
- package/dist/build/shared-deps.mjs +16 -0
- package/dist/build/shared-deps.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +17 -1
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts +36 -0
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts +36 -0
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +17 -1
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +19 -11
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +1 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +1 -1
- package/dist/runtime/services/module-federation.service.mjs +19 -11
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/package.json +7 -3
- package/skills/plugin-development/SKILL.md +208 -0
- package/skills/plugin-testing/SKILL.md +152 -0
- package/src/build/rspack/plugin.ts +2 -1
- package/src/build/shared-deps.ts +16 -0
- package/src/runtime/mf-config.ts +16 -0
- package/src/runtime/services/module-federation.service.ts +37 -24
|
@@ -132,7 +132,7 @@ var EveryPluginDevServer = class {
|
|
|
132
132
|
compiler.options.output.library = { type: "commonjs-module" };
|
|
133
133
|
if (!compiler.options.target) compiler.options.target = "async-node";
|
|
134
134
|
if (!compiler.options.mode) compiler.options.mode = process.env.NODE_ENV === "development" ? "development" : "production";
|
|
135
|
-
if (
|
|
135
|
+
if (compiler.options.devtool === void 0) compiler.options.devtool = "source-map";
|
|
136
136
|
if (!compiler.options.infrastructureLogging) compiler.options.infrastructureLogging = { level: "warn" };
|
|
137
137
|
this.ensureTypeScriptLoader(compiler);
|
|
138
138
|
if (!compiler.options.resolve) compiler.options.resolve = {};
|
|
@@ -156,7 +156,8 @@ var EveryPluginDevServer = class {
|
|
|
156
156
|
compiler.options.resolve.fallback = {
|
|
157
157
|
...compiler.options.resolve.fallback,
|
|
158
158
|
bufferutil: false,
|
|
159
|
-
"utf-8-validate": false
|
|
159
|
+
"utf-8-validate": false,
|
|
160
|
+
"@opentelemetry/api": false
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
ensureTypeScriptLoader(compiler) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["getPluginInfo","path","fs","crypto","loadDevConfig","ModuleFederationPlugin","buildSharedDependencies"],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (!compiler.options.devtool) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n };\n\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,EAAE;EAA5C;;CAEpB,MAAM,UAAoB;AACxB,WAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;AAEtE,eAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;IAAO,EAAE,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;IACzD,MAAM,aA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a,UAAU,GAAG"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":["getPluginInfo","path","fs","crypto","loadDevConfig","ModuleFederationPlugin","buildSharedDependencies"],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n \"@opentelemetry/api\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n };\n\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,EAAE;EAA5C;;CAEpB,MAAM,UAAoB;AACxB,WAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;AAEtE,eAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;IAAO,EAAE,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;IACzD,MAAM,aAAaA,4BAAc,QAAQ;IACzC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qBAAqBC,kBAAK,KAAK,SAAS,SAAS,iBAAiB;IAExE,IAAI;IAEJ,MAAM,cAAc,OAAO,aAA6C;AACtE,SAAI,CAACC,gBAAG,WAAW,SAAS,CAC1B,QAAO;AAGT,SAAI,CADUA,gBAAG,SAAS,SAAS,CACxB,QAAQ,CACjB,QAAO;AAET,SAAI;AACF,aAAO,MAAMA,gBAAG,SAAS,SAAS,UAAU,OAAO;aAC7C;AACN,aAAO;;;AAIX,oBAAiB,MAAM,YAAY,mBAAmB,IAAK;AAE3D,QAAI,CAAC,eAAe;KAClB,MAAM,aAAa,QAAQ,MAAM,IAAI,CAAC,KAAK;KAC3C,MAAM,aAAaD,kBAAK,KAAK,SAAS,SAAS,cAAc,IAAI,OAAO,iBAAiB;AAEzF,qBAAi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AAA;EAAA,
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;;UASiB,kBAAA;EACf,aAAA;EACA,IAAA;EACA,QAAA;EACA,GAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,WAAA;AAAA;AAAA,UAGe,4BAAA;EACf,gBAAA;EACA,gBAAA;EACA,iBAAA,GAAoB,gBAAA;AAAA;AAAA,cAGT,kBAAA,YAA8B,oBAAA;EAAA,QAGrB,OAAA;EAFpB,IAAA;cAEoB,OAAA,GAAS,4BAAA;EAE7B,KAAA,CAAM,QAAA,EAAU,QAAA;AAAA;AAAA,cAiHL,oBAAA,YAAgC,oBAAA;EAAA,QAGvB,OAAA;EAFpB,IAAA;cAEoB,OAAA,GAAS,kBAAA;EAE7B,KAAA,CAAM,QAAA,EAAU,QAAA;EAAA,QAqCR,iBAAA;EAAA,QA8DA,sBAAA;EAAA,QA2BA,kBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;;UASiB,kBAAA;EACf,aAAA;EACA,IAAA;EACA,QAAA;EACA,GAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,WAAA;AAAA;AAAA,UAGe,4BAAA;EACf,gBAAA;EACA,gBAAA;EACA,iBAAA,GAAoB,gBAAA;AAAA;AAAA,cAGT,kBAAA,YAA8B,oBAAA;EAAA,QAGrB,OAAA;EAFpB,IAAA;cAEoB,OAAA,GAAS,4BAAA;EAE7B,KAAA,CAAM,QAAA,EAAU,QAAA;AAAA;AAAA,cAiHL,oBAAA,YAAgC,oBAAA;EAAA,QAGvB,OAAA;EAFpB,IAAA;cAEoB,OAAA,GAAS,kBAAA;EAE7B,KAAA,CAAM,QAAA,EAAU,QAAA;EAAA,QAqCR,iBAAA;EAAA,
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;;UASiB,kBAAA;EACf,aAAA;EACA,IAAA;EACA,QAAA;EACA,GAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,WAAA;AAAA;AAAA,UAGe,4BAAA;EACf,gBAAA;EACA,gBAAA;EACA,iBAAA,GAAoB,gBAAA;AAAA;AAAA,cAGT,kBAAA,YAA8B,oBAAA;EAAA,QAGrB,OAAA;EAFpB,IAAA;cAEoB,OAAA,GAAS,4BAAA;EAE7B,KAAA,CAAM,QAAA,EAAU,QAAA;AAAA;AAAA,cAiHL,oBAAA,YAAgC,oBAAA;EAAA,QAGvB,OAAA;EAFpB,IAAA;cAEoB,OAAA,GAAS,kBAAA;EAE7B,KAAA,CAAM,QAAA,EAAU,QAAA;EAAA,QAqCR,iBAAA;EAAA,QA8DA,sBAAA;EAAA,QA2BA,kBAAA;AAAA"}
|
|
@@ -129,7 +129,7 @@ var EveryPluginDevServer = class {
|
|
|
129
129
|
compiler.options.output.library = { type: "commonjs-module" };
|
|
130
130
|
if (!compiler.options.target) compiler.options.target = "async-node";
|
|
131
131
|
if (!compiler.options.mode) compiler.options.mode = process.env.NODE_ENV === "development" ? "development" : "production";
|
|
132
|
-
if (
|
|
132
|
+
if (compiler.options.devtool === void 0) compiler.options.devtool = "source-map";
|
|
133
133
|
if (!compiler.options.infrastructureLogging) compiler.options.infrastructureLogging = { level: "warn" };
|
|
134
134
|
this.ensureTypeScriptLoader(compiler);
|
|
135
135
|
if (!compiler.options.resolve) compiler.options.resolve = {};
|
|
@@ -153,7 +153,8 @@ var EveryPluginDevServer = class {
|
|
|
153
153
|
compiler.options.resolve.fallback = {
|
|
154
154
|
...compiler.options.resolve.fallback,
|
|
155
155
|
bufferutil: false,
|
|
156
|
-
"utf-8-validate": false
|
|
156
|
+
"utf-8-validate": false,
|
|
157
|
+
"@opentelemetry/api": false
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
ensureTypeScriptLoader(compiler) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (!compiler.options.devtool) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n };\n\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,EAAE;EAA5C;;CAEpB,MAAM,UAAoB;AACxB,WAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;AAEtE,eAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;IAAO,EAAE,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;IACzD,MAAM,aAAa,cAAc,QAAQ;IACzC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qBAAqB,KAAK,KAAK,SAAS,SAAS,iBAAiB;IAExE,IAAI;IAEJ,MAAM,cAAc,OAAO,aAA6C;AACtE,SAAI,CAAC,GAAG,WAAW,SAAS,CAC1B,QAAO;AAGT,SAAI,CADU,GAAG,SAAS,SAAS,CACxB,QAAQ,CACjB,QAAO;AAET,SAAI;AACF,aAAO,MAAM,GAAG,SAAS,SAAS,UAAU,OAAO;aAC7C;AACN,aAAO;;;AAIX,oBAAiB,MAAM,YAAY,mBAAmB,IAAK;AAE3D,QAAI,CAAC,eAAe;KAClB,MAAM,aAAa,QAAQ,MAAM,IAAI,CAAC,KAAK;KAC3C,MAAM,aAAa,KAAK,KAAK,SAAS,SAAS,cAAc,IAAI,OAAO,iBAAiB;AAEzF,qBAAiB,MAAM,YAAY,WAAW,IAAK;AAEnD,SAAI,CAAC,eAAe;AAClB,cAAQ,KACN,mDAAmD,mBAAmB,MA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QAAQ,WAAW,QAAQ,KAAK;EACzD,MAAM,gBAAgB,SAAS,QAAQ,UAAU;AAEjD,WAAS,QAAQ,UAAU,OAAO;AAClC,WAAS,QAAQ,UAAU,SAAS,KAAK,KAAK,SAAS,OAAO;AAC9D,WAAS,QAAQ,UAAU,MAAM;AACjC,WAAS,QAAQ,UAAU,gBAAgB,EAAE,aAAa,MAAM;AAChE,WAAS,QAAQ,UAAU,UAAU;GACnC,+BAA+B;GAC/B,gCAAgC;GAChC,gCAAgC;GACjC;AAED,WAAS,QAAQ,UAAU,SAAS;GAClC,SAAS;GACT,SAAS;IACP,UAAU;IACV,QAAQ;IACT;GACF;AAED,WAAS,QAAQ,UAAU,oBAAoB,aAAa,cAAc;AACxE,yBAAsB,WAAW,YAAY,WAAW,KAAK;AAC7D,UAAO,gBAAgB,cAAc,aAAa,UAAU,GAAG"}
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n \"@opentelemetry/api\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n };\n\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,YAAY,AAAQ,UAAwC,EAAE,EAAE;EAA5C;;CAEpB,MAAM,UAAoB;AACxB,WAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;AAEtE,eAAY,MAAM,cAAc,WAAW;IAAE,MAAM,KAAK;IAAM;IAAO,EAAE,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,KAAK;IACzD,MAAM,aAAa,cAAc,QAAQ;IACzC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qBAAqB,KAAK,KAAK,SAAS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G
|
|
46
|
+
},
|
|
47
|
+
"better-auth": {
|
|
48
|
+
version: getInstalledPackageVersion("better-auth", "^1.6.9"),
|
|
49
|
+
...DEFAULT_SHARE_CONFIG
|
|
50
|
+
},
|
|
51
|
+
"drizzle-orm": {
|
|
52
|
+
version: getInstalledPackageVersion("drizzle-orm", "^0.45.1"),
|
|
53
|
+
...DEFAULT_SHARE_CONFIG
|
|
54
|
+
},
|
|
55
|
+
"@orpc/contract": {
|
|
56
|
+
version: getInstalledPackageVersion("@orpc/contract", pkg.peerDependencies["@orpc/contract"]),
|
|
57
|
+
...DEFAULT_SHARE_CONFIG
|
|
58
|
+
},
|
|
59
|
+
"@orpc/server": {
|
|
60
|
+
version: getInstalledPackageVersion("@orpc/server", pkg.peerDependencies["@orpc/server"]),
|
|
61
|
+
...DEFAULT_SHARE_CONFIG
|
|
46
62
|
}
|
|
47
63
|
};
|
|
48
64
|
function getPluginSharedDependencies() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.cjs","names":["__dirname","require"],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.replace(/^[\\^~>=<]+/, \"\");\n const match = clean.match(/^(\\d+)\\.(\\d+)/);\n if (!match) return \"^0.0.0\";\n return `^${match[1]}.${match[2]}.0`;\n}\n"],"mappings":";;;;;;;;AAKA,MAAMA,+GAAkD,CAAC;AACzD,MAAMC,yFAAwC;AAE9C,IAAI;AAEJ,IAAI;AACF,OAAM,KAAK,oDAAwBD,aAAW,qBAAqB,EAAE,QAAQ,CAAC;QACxE;AACN,OAAMC,UAAQ,4BAA4B;;AAa5C,MAAM,uBAAgE;CACpE,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,OAAO;CACR;AAED,SAAS,oBAAoB,OAAuB;CAClD,MAAM,QAAQ,MAAM,MAAM,oCAAoC;AAC9D,QAAO,QAAQ,MAAM,KAAK,MAAM,QAAQ,gBAAgB,GAAG;;AAG7D,SAAS,2BAA2B,aAAqB,iBAAiC;AACxF,KAAI;AACF,SAAOA,UAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;AACN,SAAO,oBAAoB,gBAAgB;;;AAI/C,MAAa,2BAA2B;CACtC,gBAAgB;EAAE,SAAS,IAAI;EAAS,GAAG;EAAsB;CACjE,QAAQ;EACN,SAAS,2BAA2B,UAAU,IAAI,iBAAiB,OAAO;EAC1E,GAAG;EACJ;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,IAAI,iBAAiB,IAAI;EACpE,GAAG;EACJ;CACF;AAID,SAAgB,8BAAkD;AAChE,QAAO;;AAGT,SAAgB,0CAAkE;AAChF,QAAO,OAAO,YACZ,OAAO,QAAQ,6BAA6B,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CACpE,MACA,qBAAqB,OAAO,QAAQ,CACrC,CAAC,CACH;;AAGH,SAAgB,qBAAqB,SAAyB;CAE5D,MAAM,QADQ,QAAQ,QAAQ,cAAc,GAAG,CAC3B,MAAM,gBAAgB;AAC1C,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG"}
|
|
1
|
+
{"version":3,"file":"shared-deps.cjs","names":["__dirname","require"],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"better-auth\": {\n version: getInstalledPackageVersion(\"better-auth\", \"^1.6.9\"),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"drizzle-orm\": {\n version: getInstalledPackageVersion(\"drizzle-orm\", \"^0.45.1\"),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/contract\": {\n version: getInstalledPackageVersion(\"@orpc/contract\", pkg.peerDependencies[\"@orpc/contract\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/server\": {\n version: getInstalledPackageVersion(\"@orpc/server\", pkg.peerDependencies[\"@orpc/server\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.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,OAAO,QAAQ,6BAA6B,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CACpE,MACA,qBAAqB,OAAO,QAAQ,CACrC,CAAC,CACH;;AAGH,SAAgB,qBAAqB,SAAyB;CAE5D,MAAM,QADQ,QAAQ,QAAQ,cAAc,GAAG,CAC3B,MAAM,gBAAgB;AAC1C,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG"}
|
|
@@ -29,6 +29,34 @@ declare const pluginSharedDependencies: {
|
|
|
29
29
|
eager: boolean;
|
|
30
30
|
version: string;
|
|
31
31
|
};
|
|
32
|
+
"better-auth": {
|
|
33
|
+
requiredVersion: string | false;
|
|
34
|
+
singleton: boolean;
|
|
35
|
+
strictVersion: boolean;
|
|
36
|
+
eager: boolean;
|
|
37
|
+
version: string;
|
|
38
|
+
};
|
|
39
|
+
"drizzle-orm": {
|
|
40
|
+
requiredVersion: string | false;
|
|
41
|
+
singleton: boolean;
|
|
42
|
+
strictVersion: boolean;
|
|
43
|
+
eager: boolean;
|
|
44
|
+
version: string;
|
|
45
|
+
};
|
|
46
|
+
"@orpc/contract": {
|
|
47
|
+
requiredVersion: string | false;
|
|
48
|
+
singleton: boolean;
|
|
49
|
+
strictVersion: boolean;
|
|
50
|
+
eager: boolean;
|
|
51
|
+
version: string;
|
|
52
|
+
};
|
|
53
|
+
"@orpc/server": {
|
|
54
|
+
requiredVersion: string | false;
|
|
55
|
+
singleton: boolean;
|
|
56
|
+
strictVersion: boolean;
|
|
57
|
+
eager: boolean;
|
|
58
|
+
version: string;
|
|
59
|
+
};
|
|
32
60
|
};
|
|
33
61
|
type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;
|
|
34
62
|
declare function getPluginSharedDependencies(): SharedDependencies;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA
|
|
1
|
+
{"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
|
|
@@ -29,6 +29,34 @@ declare const pluginSharedDependencies: {
|
|
|
29
29
|
eager: boolean;
|
|
30
30
|
version: string;
|
|
31
31
|
};
|
|
32
|
+
"better-auth": {
|
|
33
|
+
requiredVersion: string | false;
|
|
34
|
+
singleton: boolean;
|
|
35
|
+
strictVersion: boolean;
|
|
36
|
+
eager: boolean;
|
|
37
|
+
version: string;
|
|
38
|
+
};
|
|
39
|
+
"drizzle-orm": {
|
|
40
|
+
requiredVersion: string | false;
|
|
41
|
+
singleton: boolean;
|
|
42
|
+
strictVersion: boolean;
|
|
43
|
+
eager: boolean;
|
|
44
|
+
version: string;
|
|
45
|
+
};
|
|
46
|
+
"@orpc/contract": {
|
|
47
|
+
requiredVersion: string | false;
|
|
48
|
+
singleton: boolean;
|
|
49
|
+
strictVersion: boolean;
|
|
50
|
+
eager: boolean;
|
|
51
|
+
version: string;
|
|
52
|
+
};
|
|
53
|
+
"@orpc/server": {
|
|
54
|
+
requiredVersion: string | false;
|
|
55
|
+
singleton: boolean;
|
|
56
|
+
strictVersion: boolean;
|
|
57
|
+
eager: boolean;
|
|
58
|
+
version: string;
|
|
59
|
+
};
|
|
32
60
|
};
|
|
33
61
|
type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;
|
|
34
62
|
declare function getPluginSharedDependencies(): SharedDependencies;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA
|
|
1
|
+
{"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
|
|
@@ -41,6 +41,22 @@ const pluginSharedDependencies = {
|
|
|
41
41
|
zod: {
|
|
42
42
|
version: getInstalledPackageVersion("zod", pkg.peerDependencies.zod),
|
|
43
43
|
...DEFAULT_SHARE_CONFIG
|
|
44
|
+
},
|
|
45
|
+
"better-auth": {
|
|
46
|
+
version: getInstalledPackageVersion("better-auth", "^1.6.9"),
|
|
47
|
+
...DEFAULT_SHARE_CONFIG
|
|
48
|
+
},
|
|
49
|
+
"drizzle-orm": {
|
|
50
|
+
version: getInstalledPackageVersion("drizzle-orm", "^0.45.1"),
|
|
51
|
+
...DEFAULT_SHARE_CONFIG
|
|
52
|
+
},
|
|
53
|
+
"@orpc/contract": {
|
|
54
|
+
version: getInstalledPackageVersion("@orpc/contract", pkg.peerDependencies["@orpc/contract"]),
|
|
55
|
+
...DEFAULT_SHARE_CONFIG
|
|
56
|
+
},
|
|
57
|
+
"@orpc/server": {
|
|
58
|
+
version: getInstalledPackageVersion("@orpc/server", pkg.peerDependencies["@orpc/server"]),
|
|
59
|
+
...DEFAULT_SHARE_CONFIG
|
|
44
60
|
}
|
|
45
61
|
};
|
|
46
62
|
function getPluginSharedDependencies() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.mjs","names":[],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.replace(/^[\\^~>=<]+/, \"\");\n const match = clean.match(/^(\\d+)\\.(\\d+)/);\n if (!match) return \"^0.0.0\";\n return `^${match[1]}.${match[2]}.0`;\n}\n"],"mappings":";;;;;;AAKA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AACzD,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAI;AAEJ,IAAI;AACF,OAAM,KAAK,MAAM,aAAa,KAAK,WAAW,qBAAqB,EAAE,QAAQ,CAAC;QACxE;AACN,OAAM,QAAQ,4BAA4B;;AAa5C,MAAM,uBAAgE;CACpE,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,OAAO;CACR;AAED,SAAS,oBAAoB,OAAuB;CAClD,MAAM,QAAQ,MAAM,MAAM,oCAAoC;AAC9D,QAAO,QAAQ,MAAM,KAAK,MAAM,QAAQ,gBAAgB,GAAG;;AAG7D,SAAS,2BAA2B,aAAqB,iBAAiC;AACxF,KAAI;AACF,SAAO,QAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;AACN,SAAO,oBAAoB,gBAAgB;;;AAI/C,MAAa,2BAA2B;CACtC,gBAAgB;EAAE,SAAS,IAAI;EAAS,GAAG;EAAsB;CACjE,QAAQ;EACN,SAAS,2BAA2B,UAAU,IAAI,iBAAiB,OAAO;EAC1E,GAAG;EACJ;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,IAAI,iBAAiB,IAAI;EACpE,GAAG;EACJ;CACF;AAID,SAAgB,8BAAkD;AAChE,QAAO;;AAGT,SAAgB,0CAAkE;AAChF,QAAO,OAAO,YACZ,OAAO,QAAQ,6BAA6B,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CACpE,MACA,qBAAqB,OAAO,QAAQ,CACrC,CAAC,CACH;;AAGH,SAAgB,qBAAqB,SAAyB;CAE5D,MAAM,QADQ,QAAQ,QAAQ,cAAc,GAAG,CAC3B,MAAM,gBAAgB;AAC1C,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG"}
|
|
1
|
+
{"version":3,"file":"shared-deps.mjs","names":[],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"better-auth\": {\n version: getInstalledPackageVersion(\"better-auth\", \"^1.6.9\"),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"drizzle-orm\": {\n version: getInstalledPackageVersion(\"drizzle-orm\", \"^0.45.1\"),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/contract\": {\n version: getInstalledPackageVersion(\"@orpc/contract\", pkg.peerDependencies[\"@orpc/contract\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n \"@orpc/server\": {\n version: getInstalledPackageVersion(\"@orpc/server\", pkg.peerDependencies[\"@orpc/server\"]),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.replace(/^[\\^~>=<]+/, \"\");\n const match = clean.match(/^(\\d+)\\.(\\d+)/);\n if (!match) return \"^0.0.0\";\n return `^${match[1]}.${match[2]}.0`;\n}\n"],"mappings":";;;;;;AAKA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AACzD,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAI;AAEJ,IAAI;AACF,O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C1C,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG"}
|
|
@@ -12,7 +12,7 @@ function getInstalledPackageVersion(packageName, fallbackRange) {
|
|
|
12
12
|
return match ? match[0] : fallbackRange.replace(/^[\^~>=<\s]+/, "");
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
const PLUGIN_VERSION = "2.4.
|
|
15
|
+
const PLUGIN_VERSION = "2.4.2";
|
|
16
16
|
const SHARE_CONFIG = {
|
|
17
17
|
singleton: true,
|
|
18
18
|
requiredVersion: false,
|
|
@@ -31,6 +31,22 @@ const MF_SHARED_DEPS = {
|
|
|
31
31
|
zod: {
|
|
32
32
|
version: getInstalledPackageVersion("zod", "^4.3.6"),
|
|
33
33
|
shareConfig: SHARE_CONFIG
|
|
34
|
+
},
|
|
35
|
+
"better-auth": {
|
|
36
|
+
version: getInstalledPackageVersion("better-auth", "^1.6.9"),
|
|
37
|
+
shareConfig: SHARE_CONFIG
|
|
38
|
+
},
|
|
39
|
+
"drizzle-orm": {
|
|
40
|
+
version: getInstalledPackageVersion("drizzle-orm", "^0.45.1"),
|
|
41
|
+
shareConfig: SHARE_CONFIG
|
|
42
|
+
},
|
|
43
|
+
"@orpc/contract": {
|
|
44
|
+
version: getInstalledPackageVersion("@orpc/contract", "^1.13.4"),
|
|
45
|
+
shareConfig: SHARE_CONFIG
|
|
46
|
+
},
|
|
47
|
+
"@orpc/server": {
|
|
48
|
+
version: getInstalledPackageVersion("@orpc/server", "^1.13.4"),
|
|
49
|
+
shareConfig: SHARE_CONFIG
|
|
34
50
|
}
|
|
35
51
|
};
|
|
36
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mf-config.cjs","names":["require"],"sources":["../../src/runtime/mf-config.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\ndeclare const __EVERY_PLUGIN_VERSION__: string | undefined;\n\nfunction readPackageVersion(): string {\n try {\n return (require(\"../../package.json\") as { version: string }).version;\n } catch {\n return \"0.0.0\";\n }\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackRange: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n const match = fallbackRange.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : fallbackRange.replace(/^[\\^~>=<\\s]+/, \"\");\n }\n}\n\nexport const PLUGIN_VERSION =\n typeof __EVERY_PLUGIN_VERSION__ === \"string\" ? __EVERY_PLUGIN_VERSION__ : readPackageVersion();\n\nexport const SHARE_CONFIG = {\n singleton: true,\n requiredVersion: false,\n strictVersion: false,\n eager: false,\n} as const;\n\nexport const MF_SHARED_DEPS = {\n \"every-plugin\": {\n version: PLUGIN_VERSION,\n shareConfig: SHARE_CONFIG,\n },\n effect: {\n version: getInstalledPackageVersion(\"effect\", \"^3.21.0\"),\n shareConfig: SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", \"^4.3.6\"),\n shareConfig: SHARE_CONFIG,\n },\n} as const;\n\nexport type SharedDepName = keyof typeof MF_SHARED_DEPS;\n"],"mappings":";;;;;AAEA,MAAMA,yFAAwC;AAW9C,SAAS,2BAA2B,aAAqB,eAA+B;AACtF,KAAI;AACF,SAAOA,UAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;EACN,MAAM,QAAQ,cAAc,MAAM,oCAAoC;AACtE,SAAO,QAAQ,MAAM,KAAK,cAAc,QAAQ,gBAAgB,GAAG;;;AAIvE,MAAa;AAGb,MAAa,eAAe;CAC1B,WAAW;CACX,iBAAiB;CACjB,eAAe;CACf,OAAO;CACR;AAED,MAAa,iBAAiB;CAC5B,gBAAgB;EACd,SAAS;EACT,aAAa;EACd;CACD,QAAQ;EACN,SAAS,2BAA2B,UAAU,UAAU;EACxD,aAAa;EACd;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,SAAS;EACpD,aAAa;EACd;CACF"}
|
|
1
|
+
{"version":3,"file":"mf-config.cjs","names":["require"],"sources":["../../src/runtime/mf-config.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\ndeclare const __EVERY_PLUGIN_VERSION__: string | undefined;\n\nfunction readPackageVersion(): string {\n try {\n return (require(\"../../package.json\") as { version: string }).version;\n } catch {\n return \"0.0.0\";\n }\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackRange: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n const match = fallbackRange.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : fallbackRange.replace(/^[\\^~>=<\\s]+/, \"\");\n }\n}\n\nexport const PLUGIN_VERSION =\n typeof __EVERY_PLUGIN_VERSION__ === \"string\" ? __EVERY_PLUGIN_VERSION__ : readPackageVersion();\n\nexport const SHARE_CONFIG = {\n singleton: true,\n requiredVersion: false,\n strictVersion: false,\n eager: false,\n} as const;\n\nexport const MF_SHARED_DEPS = {\n \"every-plugin\": {\n version: PLUGIN_VERSION,\n shareConfig: SHARE_CONFIG,\n },\n effect: {\n version: getInstalledPackageVersion(\"effect\", \"^3.21.0\"),\n shareConfig: SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", \"^4.3.6\"),\n shareConfig: SHARE_CONFIG,\n },\n \"better-auth\": {\n version: getInstalledPackageVersion(\"better-auth\", \"^1.6.9\"),\n shareConfig: SHARE_CONFIG,\n },\n \"drizzle-orm\": {\n version: getInstalledPackageVersion(\"drizzle-orm\", \"^0.45.1\"),\n shareConfig: SHARE_CONFIG,\n },\n \"@orpc/contract\": {\n version: getInstalledPackageVersion(\"@orpc/contract\", \"^1.13.4\"),\n shareConfig: SHARE_CONFIG,\n },\n \"@orpc/server\": {\n version: getInstalledPackageVersion(\"@orpc/server\", \"^1.13.4\"),\n shareConfig: SHARE_CONFIG,\n },\n} as const;\n\nexport type SharedDepName = keyof typeof MF_SHARED_DEPS;\n"],"mappings":";;;;;AAEA,MAAMA,yFAAwC;AAW9C,SAAS,2BAA2B,aAAqB,eAA+B;AACtF,KAAI;AACF,SAAOA,UAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;EACN,MAAM,QAAQ,cAAc,MAAM,oCAAoC;AACtE,SAAO,QAAQ,MAAM,KAAK,cAAc,QAAQ,gBAAgB,GAAG;;;AAIvE,MAAa;AAGb,MAAa,eAAe;CAC1B,WAAW;CACX,iBAAiB;CACjB,eAAe;CACf,OAAO;CACR;AAED,MAAa,iBAAiB;CAC5B,gBAAgB;EACd,SAAS;EACT,aAAa;EACd;CACD,QAAQ;EACN,SAAS,2BAA2B,UAAU,UAAU;EACxD,aAAa;EACd;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,SAAS;EACpD,aAAa;EACd;CACD,eAAe;EACb,SAAS,2BAA2B,eAAe,SAAS;EAC5D,aAAa;EACd;CACD,eAAe;EACb,SAAS,2BAA2B,eAAe,UAAU;EAC7D,aAAa;EACd;CACD,kBAAkB;EAChB,SAAS,2BAA2B,kBAAkB,UAAU;EAChE,aAAa;EACd;CACD,gBAAgB;EACd,SAAS,2BAA2B,gBAAgB,UAAU;EAC9D,aAAa;EACd;CACF"}
|
|
@@ -34,6 +34,42 @@ declare const MF_SHARED_DEPS: {
|
|
|
34
34
|
readonly eager: false;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
+
readonly "better-auth": {
|
|
38
|
+
readonly version: string;
|
|
39
|
+
readonly shareConfig: {
|
|
40
|
+
readonly singleton: true;
|
|
41
|
+
readonly requiredVersion: false;
|
|
42
|
+
readonly strictVersion: false;
|
|
43
|
+
readonly eager: false;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly "drizzle-orm": {
|
|
47
|
+
readonly version: string;
|
|
48
|
+
readonly shareConfig: {
|
|
49
|
+
readonly singleton: true;
|
|
50
|
+
readonly requiredVersion: false;
|
|
51
|
+
readonly strictVersion: false;
|
|
52
|
+
readonly eager: false;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly "@orpc/contract": {
|
|
56
|
+
readonly version: string;
|
|
57
|
+
readonly shareConfig: {
|
|
58
|
+
readonly singleton: true;
|
|
59
|
+
readonly requiredVersion: false;
|
|
60
|
+
readonly strictVersion: false;
|
|
61
|
+
readonly eager: false;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly "@orpc/server": {
|
|
65
|
+
readonly version: string;
|
|
66
|
+
readonly shareConfig: {
|
|
67
|
+
readonly singleton: true;
|
|
68
|
+
readonly requiredVersion: false;
|
|
69
|
+
readonly strictVersion: false;
|
|
70
|
+
readonly eager: false;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
37
73
|
};
|
|
38
74
|
type SharedDepName = keyof typeof MF_SHARED_DEPS;
|
|
39
75
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mf-config.d.cts","names":[],"sources":["../../src/runtime/mf-config.ts"],"mappings":";cAsBa,cAAA;AAAA,cAGA,YAAA;EAAA;;;;;cAOA,cAAA;EAAA
|
|
1
|
+
{"version":3,"file":"mf-config.d.cts","names":[],"sources":["../../src/runtime/mf-config.ts"],"mappings":";cAsBa,cAAA;AAAA,cAGA,YAAA;EAAA;;;;;cAOA,cAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BD,aAAA,gBAA6B,cAAA"}
|
|
@@ -34,6 +34,42 @@ declare const MF_SHARED_DEPS: {
|
|
|
34
34
|
readonly eager: false;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
+
readonly "better-auth": {
|
|
38
|
+
readonly version: string;
|
|
39
|
+
readonly shareConfig: {
|
|
40
|
+
readonly singleton: true;
|
|
41
|
+
readonly requiredVersion: false;
|
|
42
|
+
readonly strictVersion: false;
|
|
43
|
+
readonly eager: false;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly "drizzle-orm": {
|
|
47
|
+
readonly version: string;
|
|
48
|
+
readonly shareConfig: {
|
|
49
|
+
readonly singleton: true;
|
|
50
|
+
readonly requiredVersion: false;
|
|
51
|
+
readonly strictVersion: false;
|
|
52
|
+
readonly eager: false;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly "@orpc/contract": {
|
|
56
|
+
readonly version: string;
|
|
57
|
+
readonly shareConfig: {
|
|
58
|
+
readonly singleton: true;
|
|
59
|
+
readonly requiredVersion: false;
|
|
60
|
+
readonly strictVersion: false;
|
|
61
|
+
readonly eager: false;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly "@orpc/server": {
|
|
65
|
+
readonly version: string;
|
|
66
|
+
readonly shareConfig: {
|
|
67
|
+
readonly singleton: true;
|
|
68
|
+
readonly requiredVersion: false;
|
|
69
|
+
readonly strictVersion: false;
|
|
70
|
+
readonly eager: false;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
37
73
|
};
|
|
38
74
|
type SharedDepName = keyof typeof MF_SHARED_DEPS;
|
|
39
75
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mf-config.d.mts","names":[],"sources":["../../src/runtime/mf-config.ts"],"mappings":";cAsBa,cAAA;AAAA,cAGA,YAAA;EAAA;;;;;cAOA,cAAA;EAAA
|
|
1
|
+
{"version":3,"file":"mf-config.d.mts","names":[],"sources":["../../src/runtime/mf-config.ts"],"mappings":";cAsBa,cAAA;AAAA,cAGA,YAAA;EAAA;;;;;cAOA,cAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BD,aAAA,gBAA6B,cAAA"}
|
|
@@ -10,7 +10,7 @@ function getInstalledPackageVersion(packageName, fallbackRange) {
|
|
|
10
10
|
return match ? match[0] : fallbackRange.replace(/^[\^~>=<\s]+/, "");
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
const PLUGIN_VERSION = "2.4.
|
|
13
|
+
const PLUGIN_VERSION = "2.4.2";
|
|
14
14
|
const SHARE_CONFIG = {
|
|
15
15
|
singleton: true,
|
|
16
16
|
requiredVersion: false,
|
|
@@ -29,6 +29,22 @@ const MF_SHARED_DEPS = {
|
|
|
29
29
|
zod: {
|
|
30
30
|
version: getInstalledPackageVersion("zod", "^4.3.6"),
|
|
31
31
|
shareConfig: SHARE_CONFIG
|
|
32
|
+
},
|
|
33
|
+
"better-auth": {
|
|
34
|
+
version: getInstalledPackageVersion("better-auth", "^1.6.9"),
|
|
35
|
+
shareConfig: SHARE_CONFIG
|
|
36
|
+
},
|
|
37
|
+
"drizzle-orm": {
|
|
38
|
+
version: getInstalledPackageVersion("drizzle-orm", "^0.45.1"),
|
|
39
|
+
shareConfig: SHARE_CONFIG
|
|
40
|
+
},
|
|
41
|
+
"@orpc/contract": {
|
|
42
|
+
version: getInstalledPackageVersion("@orpc/contract", "^1.13.4"),
|
|
43
|
+
shareConfig: SHARE_CONFIG
|
|
44
|
+
},
|
|
45
|
+
"@orpc/server": {
|
|
46
|
+
version: getInstalledPackageVersion("@orpc/server", "^1.13.4"),
|
|
47
|
+
shareConfig: SHARE_CONFIG
|
|
32
48
|
}
|
|
33
49
|
};
|
|
34
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mf-config.mjs","names":[],"sources":["../../src/runtime/mf-config.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\ndeclare const __EVERY_PLUGIN_VERSION__: string | undefined;\n\nfunction readPackageVersion(): string {\n try {\n return (require(\"../../package.json\") as { version: string }).version;\n } catch {\n return \"0.0.0\";\n }\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackRange: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n const match = fallbackRange.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : fallbackRange.replace(/^[\\^~>=<\\s]+/, \"\");\n }\n}\n\nexport const PLUGIN_VERSION =\n typeof __EVERY_PLUGIN_VERSION__ === \"string\" ? __EVERY_PLUGIN_VERSION__ : readPackageVersion();\n\nexport const SHARE_CONFIG = {\n singleton: true,\n requiredVersion: false,\n strictVersion: false,\n eager: false,\n} as const;\n\nexport const MF_SHARED_DEPS = {\n \"every-plugin\": {\n version: PLUGIN_VERSION,\n shareConfig: SHARE_CONFIG,\n },\n effect: {\n version: getInstalledPackageVersion(\"effect\", \"^3.21.0\"),\n shareConfig: SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", \"^4.3.6\"),\n shareConfig: SHARE_CONFIG,\n },\n} as const;\n\nexport type SharedDepName = keyof typeof MF_SHARED_DEPS;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAW9C,SAAS,2BAA2B,aAAqB,eAA+B;AACtF,KAAI;AACF,SAAO,QAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;EACN,MAAM,QAAQ,cAAc,MAAM,oCAAoC;AACtE,SAAO,QAAQ,MAAM,KAAK,cAAc,QAAQ,gBAAgB,GAAG;;;AAIvE,MAAa;AAGb,MAAa,eAAe;CAC1B,WAAW;CACX,iBAAiB;CACjB,eAAe;CACf,OAAO;CACR;AAED,MAAa,iBAAiB;CAC5B,gBAAgB;EACd,SAAS;EACT,aAAa;EACd;CACD,QAAQ;EACN,SAAS,2BAA2B,UAAU,UAAU;EACxD,aAAa;EACd;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,SAAS;EACpD,aAAa;EACd;CACF"}
|
|
1
|
+
{"version":3,"file":"mf-config.mjs","names":[],"sources":["../../src/runtime/mf-config.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\ndeclare const __EVERY_PLUGIN_VERSION__: string | undefined;\n\nfunction readPackageVersion(): string {\n try {\n return (require(\"../../package.json\") as { version: string }).version;\n } catch {\n return \"0.0.0\";\n }\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackRange: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n const match = fallbackRange.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : fallbackRange.replace(/^[\\^~>=<\\s]+/, \"\");\n }\n}\n\nexport const PLUGIN_VERSION =\n typeof __EVERY_PLUGIN_VERSION__ === \"string\" ? __EVERY_PLUGIN_VERSION__ : readPackageVersion();\n\nexport const SHARE_CONFIG = {\n singleton: true,\n requiredVersion: false,\n strictVersion: false,\n eager: false,\n} as const;\n\nexport const MF_SHARED_DEPS = {\n \"every-plugin\": {\n version: PLUGIN_VERSION,\n shareConfig: SHARE_CONFIG,\n },\n effect: {\n version: getInstalledPackageVersion(\"effect\", \"^3.21.0\"),\n shareConfig: SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", \"^4.3.6\"),\n shareConfig: SHARE_CONFIG,\n },\n \"better-auth\": {\n version: getInstalledPackageVersion(\"better-auth\", \"^1.6.9\"),\n shareConfig: SHARE_CONFIG,\n },\n \"drizzle-orm\": {\n version: getInstalledPackageVersion(\"drizzle-orm\", \"^0.45.1\"),\n shareConfig: SHARE_CONFIG,\n },\n \"@orpc/contract\": {\n version: getInstalledPackageVersion(\"@orpc/contract\", \"^1.13.4\"),\n shareConfig: SHARE_CONFIG,\n },\n \"@orpc/server\": {\n version: getInstalledPackageVersion(\"@orpc/server\", \"^1.13.4\"),\n shareConfig: SHARE_CONFIG,\n },\n} as const;\n\nexport type SharedDepName = keyof typeof MF_SHARED_DEPS;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAW9C,SAAS,2BAA2B,aAAqB,eAA+B;AACtF,KAAI;AACF,SAAO,QAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;EACN,MAAM,QAAQ,cAAc,MAAM,oCAAoC;AACtE,SAAO,QAAQ,MAAM,KAAK,cAAc,QAAQ,gBAAgB,GAAG;;;AAIvE,MAAa;AAGb,MAAa,eAAe;CAC1B,WAAW;CACX,iBAAiB;CACjB,eAAe;CACf,OAAO;CACR;AAED,MAAa,iBAAiB;CAC5B,gBAAgB;EACd,SAAS;EACT,aAAa;EACd;CACD,QAAQ;EACN,SAAS,2BAA2B,UAAU,UAAU;EACxD,aAAa;EACd;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,SAAS;EACpD,aAAa;EACd;CACD,eAAe;EACb,SAAS,2BAA2B,eAAe,SAAS;EAC5D,aAAa;EACd;CACD,eAAe;EACb,SAAS,2BAA2B,eAAe,UAAU;EAC7D,aAAa;EACd;CACD,kBAAkB;EAChB,SAAS,2BAA2B,kBAAkB,UAAU;EAChE,aAAa;EACd;CACD,gBAAgB;EACd,SAAS,2BAA2B,gBAAgB,UAAU;EAC9D,aAAa;EACd;CACF"}
|
|
@@ -10,27 +10,35 @@ let _module_federation_runtime_core = require("@module-federation/runtime-core")
|
|
|
10
10
|
const sharedModuleLoaders = {
|
|
11
11
|
"every-plugin": () => Promise.resolve().then(() => require("../../index.cjs")),
|
|
12
12
|
effect: () => import("effect"),
|
|
13
|
-
zod: () => import("zod")
|
|
13
|
+
zod: () => import("zod"),
|
|
14
|
+
"better-auth": () => Promise.resolve().then(() => require("../../node_modules/.bun/better-auth@1.6.9_a51fe808ef526527/node_modules/better-auth/dist/index.cjs")),
|
|
15
|
+
"drizzle-orm": () => Promise.resolve().then(() => require("../../node_modules/.bun/drizzle-orm@0.45.2_5d168cad3842e387/node_modules/drizzle-orm/index.cjs")),
|
|
16
|
+
"@orpc/contract": () => import("@orpc/contract"),
|
|
17
|
+
"@orpc/server": () => import("@orpc/server")
|
|
14
18
|
};
|
|
19
|
+
function buildSharedConfig() {
|
|
20
|
+
return Object.fromEntries(Object.entries(require_runtime_mf_config.MF_SHARED_DEPS).map(([name, config]) => {
|
|
21
|
+
const load = sharedModuleLoaders[name];
|
|
22
|
+
if (!load) throw new Error(`Missing shared module loader for ${name}`);
|
|
23
|
+
return [name, {
|
|
24
|
+
version: config.version,
|
|
25
|
+
get: () => load().then((mod) => () => mod),
|
|
26
|
+
shareConfig: config.shareConfig
|
|
27
|
+
}];
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
15
30
|
const createModuleFederationInstance = effect.Effect.cached(effect.Effect.sync(() => {
|
|
16
31
|
try {
|
|
32
|
+
const shared = buildSharedConfig();
|
|
17
33
|
let instance = (0, _module_federation_enhanced_runtime.getInstance)();
|
|
18
34
|
if (!instance) {
|
|
19
35
|
instance = (0, _module_federation_enhanced_runtime.createInstance)({
|
|
20
36
|
name: "host",
|
|
21
37
|
remotes: [],
|
|
22
|
-
shared
|
|
23
|
-
const load = sharedModuleLoaders[name];
|
|
24
|
-
if (!load) throw new Error(`Missing shared module loader for ${name}`);
|
|
25
|
-
return [name, {
|
|
26
|
-
version: config.version,
|
|
27
|
-
get: () => load().then((mod) => () => mod),
|
|
28
|
-
shareConfig: config.shareConfig
|
|
29
|
-
}];
|
|
30
|
-
}))
|
|
38
|
+
shared
|
|
31
39
|
});
|
|
32
40
|
(0, _module_federation_runtime_core.setGlobalFederationInstance)(instance);
|
|
33
|
-
}
|
|
41
|
+
} else instance.registerShared(shared);
|
|
34
42
|
return instance;
|
|
35
43
|
} catch (error) {
|
|
36
44
|
throw new Error(`Failed to initialize Module Federation: ${error}`);
|