@bleedingdev/modern-js-plugin-bff 3.8.2-ultramodern.12 → 3.8.2-ultramodern.14

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.
@@ -79,7 +79,7 @@ async function clientGenerator(draftOptions) {
79
79
  return result;
80
80
  };
81
81
  const writeClientTypeFacade = async (source, clientCode)=>{
82
- if (!await utils_namespaceObject.fs.pathExists(external_path_default().resolve(source.relativeTargetDistDir))) throw new external_type_facade_js_namespaceObject.MissingClientDeclarationError(source.resourcePath, source.relativeTargetDistDir);
82
+ if (!await utils_namespaceObject.fs.pathExists(external_path_default().resolve(source.relativeTargetDistDir))) throw (0, external_type_facade_js_namespaceObject.createMissingClientDeclarationError)(source.resourcePath, source.relativeTargetDistDir);
83
83
  const clientTypesFile = source.targetDir.replace(/\.js$/, '.d.ts');
84
84
  await (0, external_files_js_namespaceObject.writeTargetFile)(external_path_default().resolve(clientTypesFile), (0, external_type_facade_js_namespaceObject.buildClientTypeFacade)(clientTypesFile, source.relativeTargetDistDir, external_type_facade_js_namespaceObject.DEFAULT_EXPORT_RE.test(clientCode), true));
85
85
  };
@@ -127,7 +127,7 @@ async function clientGenerator(draftOptions) {
127
127
  }
128
128
  utils_namespaceObject.logger.info("Client bundle generate succeed");
129
129
  } catch (error) {
130
- if (error instanceof external_type_facade_js_namespaceObject.MissingClientDeclarationError) throw error;
130
+ if ((0, external_type_facade_js_namespaceObject.isMissingClientDeclarationError)(error)) throw error;
131
131
  utils_namespaceObject.logger.error(`Client bundle generate failed: ${error}`);
132
132
  }
133
133
  if (generatedSourceList.length > 0) await (0, external_write_package_js_namespaceObject.writeClientModuleBoundary)(draftOptions.appDir, draftOptions.relativeDistPath);
@@ -37,7 +37,6 @@ var __webpack_require__ = {};
37
37
  var __webpack_exports__ = {};
38
38
  __webpack_require__.r(__webpack_exports__);
39
39
  __webpack_require__.d(__webpack_exports__, {
40
- MissingClientDeclarationError: ()=>external_type_facade_js_namespaceObject.MissingClientDeclarationError,
41
40
  buildClientTypeFacade: ()=>external_type_facade_js_namespaceObject.buildClientTypeFacade,
42
41
  clientGenerator: ()=>external_generate_js_namespaceObject.clientGenerator,
43
42
  createFileDetails: ()=>external_files_js_namespaceObject.createFileDetails,
@@ -56,7 +55,6 @@ var external_generate_js_default = /*#__PURE__*/ __webpack_require__.n(external_
56
55
  const external_package_json_js_namespaceObject = require("./package-json.js");
57
56
  const external_type_facade_js_namespaceObject = require("./type-facade.js");
58
57
  const external_write_package_js_namespaceObject = require("./write-package.js");
59
- exports.MissingClientDeclarationError = __webpack_exports__.MissingClientDeclarationError;
60
58
  exports.buildClientTypeFacade = __webpack_exports__.buildClientTypeFacade;
61
59
  exports.clientGenerator = __webpack_exports__.clientGenerator;
62
60
  exports.createFileDetails = __webpack_exports__.createFileDetails;
@@ -69,7 +67,6 @@ exports.setPackage = __webpack_exports__.setPackage;
69
67
  exports.writeClientModuleBoundary = __webpack_exports__.writeClientModuleBoundary;
70
68
  exports.writeTargetFile = __webpack_exports__.writeTargetFile;
71
69
  for(var __rspack_i in __webpack_exports__)if (-1 === [
72
- "MissingClientDeclarationError",
73
70
  "buildClientTypeFacade",
74
71
  "clientGenerator",
75
72
  "createFileDetails",
@@ -38,19 +38,23 @@ var __webpack_exports__ = {};
38
38
  __webpack_require__.r(__webpack_exports__);
39
39
  __webpack_require__.d(__webpack_exports__, {
40
40
  DEFAULT_EXPORT_RE: ()=>DEFAULT_EXPORT_RE,
41
- MissingClientDeclarationError: ()=>MissingClientDeclarationError,
42
- buildClientTypeFacade: ()=>buildClientTypeFacade
41
+ buildClientTypeFacade: ()=>buildClientTypeFacade,
42
+ createMissingClientDeclarationError: ()=>createMissingClientDeclarationError,
43
+ isMissingClientDeclarationError: ()=>isMissingClientDeclarationError
43
44
  });
44
45
  const external_path_namespaceObject = require("path");
45
46
  var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
46
47
  const external_files_js_namespaceObject = require("./files.js");
47
48
  const DEFAULT_EXPORT_RE = /(^|[\s;])export\s+default\b/;
48
- class MissingClientDeclarationError extends Error {
49
- constructor(resourcePath, expectedDeclaration){
50
- super(`[plugin-bff] No declaration was emitted for "${resourcePath}", so the published client type for it cannot be generated (expected "${expectedDeclaration}"). Enable "declaration": true in the server tsconfig used by this app.`);
51
- this.name = 'MissingClientDeclarationError';
52
- }
49
+ const missingClientDeclarationCause = Symbol('MissingClientDeclarationError');
50
+ function createMissingClientDeclarationError(resourcePath, expectedDeclaration) {
51
+ const error = new Error(`[plugin-bff] No declaration was emitted for "${resourcePath}", so the published client type for it cannot be generated (expected "${expectedDeclaration}"). Enable "declaration": true in the server tsconfig used by this app.`, {
52
+ cause: missingClientDeclarationCause
53
+ });
54
+ error.name = 'MissingClientDeclarationError';
55
+ return error;
53
56
  }
57
+ const isMissingClientDeclarationError = (error)=>error instanceof Error && error.cause === missingClientDeclarationCause;
54
58
  function buildClientTypeFacade(clientTypesFile, originTypesFile, hasDefaultExport, esm = false) {
55
59
  const originNoExt = originTypesFile.replace(/\.d\.ts$/, '');
56
60
  let specifier = (0, external_files_js_namespaceObject.toPosixPath)(external_path_default().relative(external_path_default().dirname(clientTypesFile), originNoExt));
@@ -62,12 +66,14 @@ function buildClientTypeFacade(clientTypesFile, originTypesFile, hasDefaultExpor
62
66
  return `${lines.join('\n')}\n`;
63
67
  }
64
68
  exports.DEFAULT_EXPORT_RE = __webpack_exports__.DEFAULT_EXPORT_RE;
65
- exports.MissingClientDeclarationError = __webpack_exports__.MissingClientDeclarationError;
66
69
  exports.buildClientTypeFacade = __webpack_exports__.buildClientTypeFacade;
70
+ exports.createMissingClientDeclarationError = __webpack_exports__.createMissingClientDeclarationError;
71
+ exports.isMissingClientDeclarationError = __webpack_exports__.isMissingClientDeclarationError;
67
72
  for(var __rspack_i in __webpack_exports__)if (-1 === [
68
73
  "DEFAULT_EXPORT_RE",
69
- "MissingClientDeclarationError",
70
- "buildClientTypeFacade"
74
+ "buildClientTypeFacade",
75
+ "createMissingClientDeclarationError",
76
+ "isMissingClientDeclarationError"
71
77
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
72
78
  Object.defineProperty(exports, '__esModule', {
73
79
  value: true
@@ -4,7 +4,7 @@ import path from "path";
4
4
  import { generateEffectClient, resolveEffectEntryFile } from "../effectClientGenerator.mjs";
5
5
  import { CLIENT_DIR, createFileDetails, readDirectoryFiles, writeTargetFile } from "./files.mjs";
6
6
  import { getPackageName } from "./package-json.mjs";
7
- import { DEFAULT_EXPORT_RE, MissingClientDeclarationError, buildClientTypeFacade } from "./type-facade.mjs";
7
+ import { DEFAULT_EXPORT_RE, buildClientTypeFacade, createMissingClientDeclarationError, isMissingClientDeclarationError } from "./type-facade.mjs";
8
8
  import { setPackage, writeClientModuleBoundary } from "./write-package.mjs";
9
9
  async function clientGenerator(draftOptions) {
10
10
  const generatedClientDir = path.resolve(draftOptions.appDir, draftOptions.relativeDistPath, CLIENT_DIR);
@@ -36,7 +36,7 @@ async function clientGenerator(draftOptions) {
36
36
  return result;
37
37
  };
38
38
  const writeClientTypeFacade = async (source, clientCode)=>{
39
- if (!await fs.pathExists(path.resolve(source.relativeTargetDistDir))) throw new MissingClientDeclarationError(source.resourcePath, source.relativeTargetDistDir);
39
+ if (!await fs.pathExists(path.resolve(source.relativeTargetDistDir))) throw createMissingClientDeclarationError(source.resourcePath, source.relativeTargetDistDir);
40
40
  const clientTypesFile = source.targetDir.replace(/\.js$/, '.d.ts');
41
41
  await writeTargetFile(path.resolve(clientTypesFile), buildClientTypeFacade(clientTypesFile, source.relativeTargetDistDir, DEFAULT_EXPORT_RE.test(clientCode), true));
42
42
  };
@@ -84,7 +84,7 @@ async function clientGenerator(draftOptions) {
84
84
  }
85
85
  logger.info("Client bundle generate succeed");
86
86
  } catch (error) {
87
- if (error instanceof MissingClientDeclarationError) throw error;
87
+ if (isMissingClientDeclarationError(error)) throw error;
88
88
  logger.error(`Client bundle generate failed: ${error}`);
89
89
  }
90
90
  if (generatedSourceList.length > 0) await writeClientModuleBoundary(draftOptions.appDir, draftOptions.relativeDistPath);
@@ -1,5 +1,5 @@
1
1
  export { createFileDetails, readDirectoryFiles, writeTargetFile } from "./files.mjs";
2
2
  export { clientGenerator, default } from "./generate.mjs";
3
3
  export { getClientPackageName, getPackageName, mergePackageJson } from "./package-json.mjs";
4
- export { MissingClientDeclarationError, buildClientTypeFacade } from "./type-facade.mjs";
4
+ export { buildClientTypeFacade } from "./type-facade.mjs";
5
5
  export { setPackage, writeClientModuleBoundary } from "./write-package.mjs";
@@ -1,12 +1,15 @@
1
1
  import path from "path";
2
2
  import { toPosixPath } from "./files.mjs";
3
3
  const DEFAULT_EXPORT_RE = /(^|[\s;])export\s+default\b/;
4
- class MissingClientDeclarationError extends Error {
5
- constructor(resourcePath, expectedDeclaration){
6
- super(`[plugin-bff] No declaration was emitted for "${resourcePath}", so the published client type for it cannot be generated (expected "${expectedDeclaration}"). Enable "declaration": true in the server tsconfig used by this app.`);
7
- this.name = 'MissingClientDeclarationError';
8
- }
4
+ const missingClientDeclarationCause = Symbol('MissingClientDeclarationError');
5
+ function createMissingClientDeclarationError(resourcePath, expectedDeclaration) {
6
+ const error = new Error(`[plugin-bff] No declaration was emitted for "${resourcePath}", so the published client type for it cannot be generated (expected "${expectedDeclaration}"). Enable "declaration": true in the server tsconfig used by this app.`, {
7
+ cause: missingClientDeclarationCause
8
+ });
9
+ error.name = 'MissingClientDeclarationError';
10
+ return error;
9
11
  }
12
+ const isMissingClientDeclarationError = (error)=>error instanceof Error && error.cause === missingClientDeclarationCause;
10
13
  function buildClientTypeFacade(clientTypesFile, originTypesFile, hasDefaultExport, esm = false) {
11
14
  const originNoExt = originTypesFile.replace(/\.d\.ts$/, '');
12
15
  let specifier = toPosixPath(path.relative(path.dirname(clientTypesFile), originNoExt));
@@ -17,4 +20,4 @@ function buildClientTypeFacade(clientTypesFile, originTypesFile, hasDefaultExpor
17
20
  lines.push(`export * from '${specifier}';`);
18
21
  return `${lines.join('\n')}\n`;
19
22
  }
20
- export { DEFAULT_EXPORT_RE, MissingClientDeclarationError, buildClientTypeFacade };
23
+ export { DEFAULT_EXPORT_RE, buildClientTypeFacade, createMissingClientDeclarationError, isMissingClientDeclarationError };
@@ -5,7 +5,7 @@ import path from "path";
5
5
  import { generateEffectClient, resolveEffectEntryFile } from "../effectClientGenerator.mjs";
6
6
  import { CLIENT_DIR, createFileDetails, readDirectoryFiles, writeTargetFile } from "./files.mjs";
7
7
  import { getPackageName } from "./package-json.mjs";
8
- import { DEFAULT_EXPORT_RE, MissingClientDeclarationError, buildClientTypeFacade } from "./type-facade.mjs";
8
+ import { DEFAULT_EXPORT_RE, buildClientTypeFacade, createMissingClientDeclarationError, isMissingClientDeclarationError } from "./type-facade.mjs";
9
9
  import { setPackage, writeClientModuleBoundary } from "./write-package.mjs";
10
10
  async function clientGenerator(draftOptions) {
11
11
  const generatedClientDir = path.resolve(draftOptions.appDir, draftOptions.relativeDistPath, CLIENT_DIR);
@@ -37,7 +37,7 @@ async function clientGenerator(draftOptions) {
37
37
  return result;
38
38
  };
39
39
  const writeClientTypeFacade = async (source, clientCode)=>{
40
- if (!await fs.pathExists(path.resolve(source.relativeTargetDistDir))) throw new MissingClientDeclarationError(source.resourcePath, source.relativeTargetDistDir);
40
+ if (!await fs.pathExists(path.resolve(source.relativeTargetDistDir))) throw createMissingClientDeclarationError(source.resourcePath, source.relativeTargetDistDir);
41
41
  const clientTypesFile = source.targetDir.replace(/\.js$/, '.d.ts');
42
42
  await writeTargetFile(path.resolve(clientTypesFile), buildClientTypeFacade(clientTypesFile, source.relativeTargetDistDir, DEFAULT_EXPORT_RE.test(clientCode), true));
43
43
  };
@@ -85,7 +85,7 @@ async function clientGenerator(draftOptions) {
85
85
  }
86
86
  logger.info("Client bundle generate succeed");
87
87
  } catch (error) {
88
- if (error instanceof MissingClientDeclarationError) throw error;
88
+ if (isMissingClientDeclarationError(error)) throw error;
89
89
  logger.error(`Client bundle generate failed: ${error}`);
90
90
  }
91
91
  if (generatedSourceList.length > 0) await writeClientModuleBoundary(draftOptions.appDir, draftOptions.relativeDistPath);
@@ -2,5 +2,5 @@ import "node:module";
2
2
  export { createFileDetails, readDirectoryFiles, writeTargetFile } from "./files.mjs";
3
3
  export { clientGenerator, default } from "./generate.mjs";
4
4
  export { getClientPackageName, getPackageName, mergePackageJson } from "./package-json.mjs";
5
- export { MissingClientDeclarationError, buildClientTypeFacade } from "./type-facade.mjs";
5
+ export { buildClientTypeFacade } from "./type-facade.mjs";
6
6
  export { setPackage, writeClientModuleBoundary } from "./write-package.mjs";
@@ -2,12 +2,15 @@ import "node:module";
2
2
  import path from "path";
3
3
  import { toPosixPath } from "./files.mjs";
4
4
  const DEFAULT_EXPORT_RE = /(^|[\s;])export\s+default\b/;
5
- class MissingClientDeclarationError extends Error {
6
- constructor(resourcePath, expectedDeclaration){
7
- super(`[plugin-bff] No declaration was emitted for "${resourcePath}", so the published client type for it cannot be generated (expected "${expectedDeclaration}"). Enable "declaration": true in the server tsconfig used by this app.`);
8
- this.name = 'MissingClientDeclarationError';
9
- }
5
+ const missingClientDeclarationCause = Symbol('MissingClientDeclarationError');
6
+ function createMissingClientDeclarationError(resourcePath, expectedDeclaration) {
7
+ const error = new Error(`[plugin-bff] No declaration was emitted for "${resourcePath}", so the published client type for it cannot be generated (expected "${expectedDeclaration}"). Enable "declaration": true in the server tsconfig used by this app.`, {
8
+ cause: missingClientDeclarationCause
9
+ });
10
+ error.name = 'MissingClientDeclarationError';
11
+ return error;
10
12
  }
13
+ const isMissingClientDeclarationError = (error)=>error instanceof Error && error.cause === missingClientDeclarationCause;
11
14
  function buildClientTypeFacade(clientTypesFile, originTypesFile, hasDefaultExport, esm = false) {
12
15
  const originNoExt = originTypesFile.replace(/\.d\.ts$/, '');
13
16
  let specifier = toPosixPath(path.relative(path.dirname(clientTypesFile), originNoExt));
@@ -18,4 +21,4 @@ function buildClientTypeFacade(clientTypesFile, originTypesFile, hasDefaultExpor
18
21
  lines.push(`export * from '${specifier}';`);
19
22
  return `${lines.join('\n')}\n`;
20
23
  }
21
- export { DEFAULT_EXPORT_RE, MissingClientDeclarationError, buildClientTypeFacade };
24
+ export { DEFAULT_EXPORT_RE, buildClientTypeFacade, createMissingClientDeclarationError, isMissingClientDeclarationError };
@@ -4,5 +4,5 @@ export type { APILoaderOptions } from './generate';
4
4
  export { clientGenerator, default } from './generate';
5
5
  export type { PackageJsonLike } from './package-json';
6
6
  export { getClientPackageName, getPackageName, mergePackageJson, } from './package-json';
7
- export { buildClientTypeFacade, MissingClientDeclarationError, } from './type-facade';
7
+ export { buildClientTypeFacade } from './type-facade';
8
8
  export { setPackage, writeClientModuleBoundary } from './write-package';
@@ -1,16 +1,6 @@
1
1
  export declare const DEFAULT_EXPORT_RE: RegExp;
2
- /**
3
- * Raised when the handler declaration the client facade must re-export was
4
- * never emitted. `setPackage` unconditionally publishes `types` entries for
5
- * every generated client, so a missing declaration means the published package
6
- * advertises a type surface it cannot resolve. Failing the build is the only
7
- * honest outcome: the previous behaviour (copy the declaration if it happens to
8
- * exist, otherwise carry on) shipped tarballs whose clients silently degraded
9
- * to `any` in consumer projects.
10
- */
11
- export declare class MissingClientDeclarationError extends Error {
12
- constructor(resourcePath: string, expectedDeclaration: string);
13
- }
2
+ export declare function createMissingClientDeclarationError(resourcePath: string, expectedDeclaration: string): Error;
3
+ export declare const isMissingClientDeclarationError: (error: unknown) => boolean;
14
4
  /**
15
5
  * Build the `.d.ts` that sits next to a generated client module.
16
6
  *
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.8.2-ultramodern.12",
20
+ "version": "3.8.2-ultramodern.14",
21
21
  "types": "./dist/types/cli.d.ts",
22
22
  "main": "./dist/cjs/cli.js",
23
23
  "exports": {
@@ -169,13 +169,13 @@
169
169
  }
170
170
  },
171
171
  "dependencies": {
172
- "@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.8.2-ultramodern.12",
173
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.8.2-ultramodern.12",
174
- "@modern-js/create-request": "npm:@bleedingdev/modern-js-create-request@3.8.2-ultramodern.12",
175
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.2-ultramodern.12",
176
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.8.2-ultramodern.12",
177
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.2-ultramodern.12",
178
- "@module-federation/runtime": "2.8.2",
172
+ "@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.8.2-ultramodern.14",
173
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.8.2-ultramodern.14",
174
+ "@modern-js/create-request": "npm:@bleedingdev/modern-js-create-request@3.8.2-ultramodern.14",
175
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.2-ultramodern.14",
176
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.8.2-ultramodern.14",
177
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.2-ultramodern.14",
178
+ "@module-federation/runtime": "2.9.0",
179
179
  "@opentelemetry/api": "1.9.1",
180
180
  "@opentelemetry/api-logs": "0.220.0",
181
181
  "@opentelemetry/resources": "2.9.0",
@@ -192,8 +192,8 @@
192
192
  "type-is": "^2.1.0"
193
193
  },
194
194
  "peerDependencies": {
195
- "@effect/opentelemetry": "4.0.0-beta.107",
196
- "effect": "4.0.0-beta.107"
195
+ "@effect/opentelemetry": "4.0.0-rc.112",
196
+ "effect": "4.0.0-rc.112"
197
197
  },
198
198
  "peerDependenciesMeta": {
199
199
  "@effect/opentelemetry": {
@@ -204,20 +204,20 @@
204
204
  }
205
205
  },
206
206
  "devDependencies": {
207
- "@effect/opentelemetry": "4.0.0-beta.107",
208
- "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.8.2-ultramodern.12",
209
- "@modern-js/bff-runtime": "npm:@bleedingdev/modern-js-bff-runtime@3.8.2-ultramodern.12",
210
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.8.2-ultramodern.12",
211
- "@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.8.2-ultramodern.12",
212
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.2-ultramodern.12",
213
- "@rsbuild/core": "2.2.0-rc.0",
207
+ "@effect/opentelemetry": "4.0.0-rc.112",
208
+ "@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.8.2-ultramodern.14",
209
+ "@modern-js/bff-runtime": "npm:@bleedingdev/modern-js-bff-runtime@3.8.2-ultramodern.14",
210
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.8.2-ultramodern.14",
211
+ "@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.8.2-ultramodern.14",
212
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.2-ultramodern.14",
213
+ "@rsbuild/core": "2.2.0",
214
214
  "@rslib/core": "0.23.2",
215
215
  "@scripts/rstest-config": "2.66.0",
216
216
  "@types/node": "^26.2.0",
217
217
  "@types/qs": "^6.15.1",
218
218
  "@types/type-is": "^1.6.7",
219
219
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
220
- "effect": "4.0.0-beta.107",
220
+ "effect": "4.0.0-rc.112",
221
221
  "memfs": "^4.64.0",
222
222
  "typescript": "^7.0.2",
223
223
  "zod": "^4.4.3"