@nestia/core 13.0.4 → 14.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/MIGRATION.md +20 -0
  2. package/README.md +1 -1
  3. package/lib/adaptors/McpAdaptor.d.ts +5 -0
  4. package/lib/adaptors/McpAdaptor.js +114 -26
  5. package/lib/adaptors/McpAdaptor.js.map +1 -1
  6. package/lib/adaptors/WebSocketAdaptor.js +124 -32
  7. package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
  8. package/lib/adaptors/internal/RoutePathMatcher.d.ts +1 -0
  9. package/lib/adaptors/internal/RoutePathMatcher.js +88 -0
  10. package/lib/adaptors/internal/RoutePathMatcher.js.map +1 -0
  11. package/lib/adaptors/internal/external_context.d.ts +1 -0
  12. package/lib/adaptors/internal/external_context.js +43 -0
  13. package/lib/adaptors/internal/external_context.js.map +1 -0
  14. package/lib/decorators/EncryptedBody.js +2 -2
  15. package/lib/decorators/EncryptedBody.js.map +1 -1
  16. package/lib/decorators/EncryptedController.js +1 -1
  17. package/lib/decorators/EncryptedController.js.map +1 -1
  18. package/lib/decorators/EncryptedModule.d.ts +7 -3
  19. package/lib/decorators/EncryptedModule.js +69 -15
  20. package/lib/decorators/EncryptedModule.js.map +1 -1
  21. package/lib/decorators/EncryptedRoute.js +7 -2
  22. package/lib/decorators/EncryptedRoute.js.map +1 -1
  23. package/lib/decorators/TypedBody.d.ts +1 -1
  24. package/lib/decorators/TypedBody.js +1 -1
  25. package/lib/decorators/TypedFormData.d.ts +22 -8
  26. package/lib/decorators/TypedFormData.js +116 -31
  27. package/lib/decorators/TypedFormData.js.map +1 -1
  28. package/lib/decorators/TypedParam.d.ts +3 -3
  29. package/lib/decorators/TypedParam.js +3 -3
  30. package/lib/decorators/TypedQuery.d.ts +1 -1
  31. package/lib/decorators/TypedQuery.js +9 -4
  32. package/lib/decorators/TypedQuery.js.map +1 -1
  33. package/lib/decorators/internal/EncryptedConstant.js +13 -2
  34. package/lib/decorators/internal/EncryptedConstant.js.map +1 -1
  35. package/lib/decorators/internal/get_encryption_password.d.ts +1 -0
  36. package/lib/decorators/internal/get_encryption_password.js +14 -0
  37. package/lib/decorators/internal/get_encryption_password.js.map +1 -0
  38. package/lib/decorators/internal/get_path_and_querify.js +21 -3
  39. package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
  40. package/lib/decorators/internal/get_text_body.js +9 -3
  41. package/lib/decorators/internal/get_text_body.js.map +1 -1
  42. package/lib/decorators/internal/group_entries.d.ts +1 -0
  43. package/lib/decorators/internal/group_entries.js +19 -0
  44. package/lib/decorators/internal/group_entries.js.map +1 -0
  45. package/lib/decorators/internal/validate_request_form_data.js +3 -1
  46. package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
  47. package/lib/decorators/internal/validate_request_headers.js +2 -1
  48. package/lib/decorators/internal/validate_request_headers.js.map +1 -1
  49. package/lib/decorators/internal/validate_request_query.js +3 -1
  50. package/lib/decorators/internal/validate_request_query.js.map +1 -1
  51. package/lib/options/IResponseBodyQuerifier.d.ts +5 -1
  52. package/lib/utils/ExceptionManager.d.ts +3 -4
  53. package/lib/utils/ExceptionManager.js +10 -6
  54. package/lib/utils/ExceptionManager.js.map +1 -1
  55. package/lib/utils/SourceFinder.js +26 -3
  56. package/lib/utils/SourceFinder.js.map +1 -1
  57. package/lib/utils/VersioningStrategy.d.ts +9 -1
  58. package/lib/utils/VersioningStrategy.js +18 -6
  59. package/lib/utils/VersioningStrategy.js.map +1 -1
  60. package/native/go.mod +1 -1
  61. package/native/go.sum +2 -2
  62. package/native/transform/ast.go +4 -2
  63. package/native/transform/core_querify.go +26 -6
  64. package/native/transform/core_transform.go +76 -1
  65. package/native/transform/core_websocket.go +94 -13
  66. package/native/transform/node_transform.go +6 -0
  67. package/native/transform/transform.go +8 -18
  68. package/native/transform/typia_fast.go +6 -0
  69. package/native/transform.cjs +49 -0
  70. package/package.json +14 -17
  71. package/src/adaptors/McpAdaptor.ts +150 -28
  72. package/src/adaptors/WebSocketAdaptor.ts +136 -38
  73. package/src/adaptors/internal/RoutePathMatcher.ts +91 -0
  74. package/src/adaptors/internal/external_context.ts +50 -0
  75. package/src/decorators/EncryptedBody.ts +2 -2
  76. package/src/decorators/EncryptedController.ts +6 -2
  77. package/src/decorators/EncryptedModule.ts +71 -15
  78. package/src/decorators/EncryptedRoute.ts +7 -5
  79. package/src/decorators/TypedBody.ts +1 -1
  80. package/src/decorators/TypedFormData.ts +148 -44
  81. package/src/decorators/TypedParam.ts +3 -3
  82. package/src/decorators/TypedQuery.ts +19 -7
  83. package/src/decorators/internal/EncryptedConstant.ts +14 -1
  84. package/src/decorators/internal/get_encryption_password.ts +19 -0
  85. package/src/decorators/internal/get_path_and_querify.ts +29 -2
  86. package/src/decorators/internal/get_text_body.ts +8 -4
  87. package/src/decorators/internal/group_entries.ts +17 -0
  88. package/src/decorators/internal/validate_request_form_data.ts +3 -1
  89. package/src/decorators/internal/validate_request_headers.ts +2 -2
  90. package/src/decorators/internal/validate_request_query.ts +3 -2
  91. package/src/options/IResponseBodyQuerifier.ts +6 -1
  92. package/src/utils/ExceptionManager.ts +10 -6
  93. package/src/utils/SourceFinder.ts +24 -3
  94. package/src/utils/VersioningStrategy.ts +21 -7
  95. package/lib/transform.d.ts +0 -10
  96. package/lib/transform.js +0 -25
  97. package/lib/transform.js.map +0 -1
  98. package/src/transform.ts +0 -26
@@ -1,2 +1,15 @@
1
- /** @internal */
1
+ /**
2
+ * The password an {@link EncryptedModule} gives each controller it reaches.
3
+ *
4
+ * @internal
5
+ */
2
6
  export const ENCRYPTION_METADATA_KEY = "nestia:core:encryption:password";
7
+
8
+ /**
9
+ * The password an {@link EncryptedController} declares for its own class, kept
10
+ * apart from the module's so that the module never replaces it.
11
+ *
12
+ * @internal
13
+ */
14
+ export const ENCRYPTION_CONTROLLER_METADATA_KEY =
15
+ "nestia:core:encryption:controller-password";
@@ -0,0 +1,19 @@
1
+ import { IEncryptionPassword } from "@nestia/fetcher";
2
+
3
+ import {
4
+ ENCRYPTION_CONTROLLER_METADATA_KEY,
5
+ ENCRYPTION_METADATA_KEY,
6
+ } from "./EncryptedConstant";
7
+
8
+ /**
9
+ * The encryption password of a controller class. The password its own
10
+ * `@EncryptedController()` declares, which a subclass inherits, precedes the
11
+ * one an `EncryptedModule` gave it: the more specific declaration wins.
12
+ *
13
+ * @internal
14
+ */
15
+ export const get_encryption_password = (
16
+ target: Function,
17
+ ): IEncryptionPassword | IEncryptionPassword.Closure | undefined =>
18
+ Reflect.getMetadata(ENCRYPTION_CONTROLLER_METADATA_KEY, target) ??
19
+ Reflect.getMetadata(ENCRYPTION_METADATA_KEY, target);
@@ -3,13 +3,18 @@ import typia, { IValidation, TypeGuardError } from "typia";
3
3
 
4
4
  import { IResponseBodyQuerifier } from "../../options/IResponseBodyQuerifier";
5
5
  import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+ import type { TypedRoute } from "../TypedRoute";
6
7
 
7
8
  /** @internal */
8
9
  export const get_path_and_querify =
10
+ (logger: () => (log: TypedRoute.IValidateErrorLog) => void) =>
9
11
  (method: string) =>
10
12
  (
11
13
  ...args: any[]
12
- ): [string | string[] | undefined, (input: any) => URLSearchParams] => {
14
+ ): [
15
+ string | string[] | undefined,
16
+ (input: any, method: string, path: string) => URLSearchParams,
17
+ ] => {
13
18
  const path: string | string[] | null | undefined =
14
19
  args[0] === undefined ||
15
20
  typeof args[0] === "string" ||
@@ -18,11 +23,12 @@ export const get_path_and_querify =
18
23
  : null;
19
24
  const functor: IResponseBodyQuerifier<any> | undefined =
20
25
  path === null ? args[0] : args[1];
21
- return [path ?? undefined, take(method)(functor)];
26
+ return [path ?? undefined, take(logger)(method)(functor)];
22
27
  };
23
28
 
24
29
  /** @internal */
25
30
  const take =
31
+ (logger: () => (log: TypedRoute.IValidateErrorLog) => void) =>
26
32
  (method: string) =>
27
33
  <T>(functor?: IResponseBodyQuerifier<T> | null) => {
28
34
  if (functor === undefined) {
@@ -33,6 +39,8 @@ const take =
33
39
  else if (functor.type === "assert") return assert(functor.assert);
34
40
  else if (functor.type === "is") return is(functor.is);
35
41
  else if (functor.type === "validate") return validate(functor.validate);
42
+ else if (functor.type === "validate.log")
43
+ return validateLog(logger)(functor.validate);
36
44
  throw new Error(
37
45
  `Error on nestia.core.${method}(): invalid typed stringify function.`,
38
46
  );
@@ -91,4 +99,23 @@ const validate =
91
99
  };
92
100
 
93
101
  /** @internal */
102
+ /**
103
+ * `validate.log`: an invalid response is reported to the validate-error logger
104
+ * and sent as it is, as `@TypedRoute`'s JSON responses are.
105
+ */
106
+ const validateLog =
107
+ (logger: () => (log: TypedRoute.IValidateErrorLog) => void) =>
108
+ <T>(closure: (data: T) => IValidation<URLSearchParams>) =>
109
+ (data: T, method: string, path: string): URLSearchParams => {
110
+ const result: IValidation<URLSearchParams> = closure(data);
111
+ if (result.success === true) return result.data;
112
+ logger()({
113
+ errors: result.errors,
114
+ method,
115
+ path,
116
+ data,
117
+ });
118
+ return querify(data as Record<string, any>);
119
+ };
120
+
94
121
  const MESSAGE = "Response body data is not following the promised type.";
@@ -5,10 +5,14 @@ import raw from "raw-body";
5
5
  /** @internal */
6
6
  export const get_text_body = async (
7
7
  request: express.Request | FastifyRequest,
8
- ): Promise<string> =>
9
- isExpressRequest(request)
10
- ? (await raw(request)).toString("utf8")
11
- : (request.body as string);
8
+ ): Promise<string> => {
9
+ if (isExpressRequest(request) === false) return request.body as string;
10
+ // a body parser the application registered, such as
11
+ // `app.useBodyParser("text")`, has already consumed the stream
12
+ if (typeof request.body === "string") return request.body;
13
+ if (Buffer.isBuffer(request.body)) return request.body.toString("utf8");
14
+ return (await raw(request)).toString("utf8");
15
+ };
12
16
 
13
17
  /** @internal */
14
18
  const isExpressRequest = (
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The entries of a `URLSearchParams` or `FormData` as a plain object: a key
3
+ * given once maps to its value, a repeated key to all of its values in order.
4
+ *
5
+ * @internal
6
+ */
7
+ export const group_entries = <Value>(source: {
8
+ keys(): Iterable<string>;
9
+ getAll(key: string): Value[];
10
+ }): Record<string, Value | Value[]> => {
11
+ const output: Record<string, Value | Value[]> = {};
12
+ for (const key of new Set(source.keys())) {
13
+ const values: Value[] = source.getAll(key);
14
+ output[key] = values.length === 1 ? values[0]! : values;
15
+ }
16
+ return output;
17
+ };
@@ -3,6 +3,7 @@ import typia, { IValidation, TypeGuardError } from "typia";
3
3
 
4
4
  import { IRequestFormDataProps } from "../../options/IRequestFormDataProps";
5
5
  import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+ import { group_entries } from "./group_entries";
6
7
 
7
8
  /** @internal */
8
9
  export const validate_request_form_data = <T>(
@@ -10,7 +11,8 @@ export const validate_request_form_data = <T>(
10
11
  ): ((value: FormData) => T | Error) => {
11
12
  if (!props) {
12
13
  NoTransformConfigurationError("TypedFormData.Body");
13
- return (input: FormData) => Object.entries(input) as T;
14
+ // no transform: the fields and files as they arrived
15
+ return (input: FormData) => group_entries(input) as T;
14
16
  } else if (props.validator.type === "assert")
15
17
  return assert(props.validator.assert);
16
18
  else if (props.validator.type === "is") return is(props.validator.is);
@@ -10,8 +10,8 @@ export const validate_request_headers = <T>(
10
10
  ): ((input: Record<string, string | string[] | undefined>) => T | Error) => {
11
11
  if (!validator) {
12
12
  NoTransformConfigurationError("TypedHeaders");
13
- return (input: Record<string, string | string[] | undefined>) =>
14
- Object.entries(input) as T;
13
+ // no transform: the headers as they arrived
14
+ return (input: Record<string, string | string[] | undefined>) => input as T;
15
15
  } else if (validator.type === "assert") return assert(validator.assert);
16
16
  else if (validator.type === "is") return is(validator.is);
17
17
  else if (validator.type === "validate") return validate(validator.validate);
@@ -3,6 +3,7 @@ import typia, { IValidation, TypeGuardError } from "typia";
3
3
 
4
4
  import { IRequestQueryValidator } from "../../options/IRequestQueryValidator";
5
5
  import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+ import { group_entries } from "./group_entries";
6
7
 
7
8
  /** @internal */
8
9
  export const validate_request_query =
@@ -10,8 +11,8 @@ export const validate_request_query =
10
11
  <T>(validator?: IRequestQueryValidator<T>) => {
11
12
  if (!validator) {
12
13
  NoTransformConfigurationError(method);
13
- return (input: URLSearchParams) =>
14
- Object.fromEntries(input.entries()) as T;
14
+ // no transform: the query as it arrived, repeated keys as arrays
15
+ return (input: URLSearchParams) => group_entries(input) as T;
15
16
  } else if (validator.type === "assert") return assert(validator.assert);
16
17
  else if (validator.type === "is") return is(validator.is);
17
18
  else if (validator.type === "validate") return validate(validator.validate);
@@ -4,7 +4,8 @@ export type IResponseBodyQuerifier<T> =
4
4
  | IResponseBodyquerifier.IStringify<T>
5
5
  | IResponseBodyquerifier.IIs<T>
6
6
  | IResponseBodyquerifier.IAssert<T>
7
- | IResponseBodyquerifier.IValidate<T>;
7
+ | IResponseBodyquerifier.IValidate<T>
8
+ | IResponseBodyquerifier.IValidateLog<T>;
8
9
  export namespace IResponseBodyquerifier {
9
10
  export interface IStringify<T> {
10
11
  type: "stringify";
@@ -22,4 +23,8 @@ export namespace IResponseBodyquerifier {
22
23
  type: "validate";
23
24
  validate: (input: T) => IValidation<URLSearchParams>;
24
25
  }
26
+ export interface IValidateLog<T> {
27
+ type: "validate.log";
28
+ validate: (input: T) => IValidation<URLSearchParams>;
29
+ }
25
30
  }
@@ -14,18 +14,17 @@ import { Creator } from "../typings/Creator";
14
14
  * {@link EncryptedRoute} instead of the basic router decorator functions like
15
15
  * {@link nest.Get} or {@link nest.Post} and the API function throws a custom
16
16
  * error whose class has been {@link ExceptionManager.insert inserted} in this
17
- * `EntityManager`, the error would be automatically converted to the regular
17
+ * `ExceptionManager`, the error would be automatically converted to the regular
18
18
  * {@link nest.HttpException} instance by the {@link ExceptionManager.Closure}
19
19
  * function.
20
20
  *
21
21
  * Therefore, with this `ExceptionManager` and {@link TypedRoute} or
22
22
  * {@link EncryptedRoute}, you can manage your custom error classes much
23
- * systemtically. You can avoid 500 internal server error or hard coding
23
+ * systematically. You can avoid 500 internal server error or hard coding
24
24
  * implementation about the custom error classes.
25
25
  *
26
- * Below error classes are defaultly configured in this `ExceptionManager`
26
+ * Below error class is configured in this `ExceptionManager` by default.
27
27
  *
28
- * - `typia.TypeGuardError`
29
28
  * - `@nestia/fetcher.HttpError`
30
29
  *
31
30
  * @author Jeongho Nam - https://github.com/samchon
@@ -47,8 +46,13 @@ export namespace ExceptionManager {
47
46
  const index: number = tuples.findIndex((tuple) => tuple[0] === creator);
48
47
  if (index !== -1) tuples.splice(index, 1);
49
48
 
50
- tuples.push([creator, closure]);
51
- tuples.sort(([x], [y]) => (x.prototype instanceof y ? -1 : 1));
49
+ // an error converts by the first class it is an instance of, so a class
50
+ // must precede every superclass of it: insert before the first one
51
+ const ancestor: number = tuples.findIndex(
52
+ ([registered]) => creator.prototype instanceof registered,
53
+ );
54
+ if (ancestor === -1) tuples.push([creator, closure]);
55
+ else tuples.splice(ancestor, 0, [creator, closure]);
52
56
  }
53
57
 
54
58
  /**
@@ -18,7 +18,7 @@ export namespace SourceFinder {
18
18
  (input: string[]) =>
19
19
  async (closure: (location: string) => void): Promise<void> => {
20
20
  for (const pattern of input) {
21
- for (const file of await _Glob(path.resolve(pattern))) {
21
+ for (const file of await _Glob(pattern)) {
22
22
  const stats: fs.Stats = await fs.promises.stat(file);
23
23
  if (stats.isDirectory() === true)
24
24
  await iterate(filter)(closure)(file);
@@ -41,9 +41,30 @@ export namespace SourceFinder {
41
41
  }
42
42
  };
43
43
 
44
+ /**
45
+ * Files and directories a path or glob pattern names.
46
+ *
47
+ * An existing path is taken literally, whatever characters it holds, as a
48
+ * directory such as `app [v2]` would otherwise read as a character class. For
49
+ * a pattern, the longest existing ancestor is the literal base and only the
50
+ * rest is globbed, with `/` separators, since glob reads a Windows backslash
51
+ * as an escape.
52
+ */
44
53
  const _Glob = async (pattern: string): Promise<string[]> => {
45
- const matches = await glob(pattern);
46
- return matches.map((str) => path.resolve(str));
54
+ const absolute: string = path.resolve(pattern);
55
+ if (fs.existsSync(absolute)) return [absolute];
56
+ let base: string = absolute;
57
+ while (fs.existsSync(base) === false) {
58
+ const parent: string = path.dirname(base);
59
+ if (parent === base) return [];
60
+ base = parent;
61
+ }
62
+ const rest: string = path
63
+ .relative(base, absolute)
64
+ .split(path.sep)
65
+ .join("/");
66
+ const matches: string[] = await glob(rest, { cwd: base });
67
+ return matches.map((str) => path.resolve(base, str));
47
68
  };
48
69
  }
49
70
 
@@ -11,17 +11,31 @@ export namespace VersioningStrategy {
11
11
  ): Array<string | typeof VERSION_NEUTRAL> =>
12
12
  value === undefined ? [] : Array.isArray(value) ? value : [value];
13
13
 
14
+ /**
15
+ * Version path segments of a route, resolved as NestJS resolves them: the
16
+ * method's versions, else the controller's, else the default version, and no
17
+ * version at all is the unversioned path (#1735).
18
+ */
14
19
  export const merge =
15
20
  (config: IConfig | undefined) =>
16
- (values: Array<string | typeof VERSION_NEUTRAL>): string[] => {
21
+ (props: {
22
+ controller: Array<string | typeof VERSION_NEUTRAL> | undefined;
23
+ method: Array<string | typeof VERSION_NEUTRAL> | undefined;
24
+ }): string[] => {
17
25
  if (config === undefined) return [""];
18
- const set: Set<string | typeof VERSION_NEUTRAL> = new Set(values);
19
- const array: Array<string | typeof VERSION_NEUTRAL> =
20
- set.size === 0 ? cast(config.defaultVersion) : Array.from(set);
21
- return !!array?.length
22
- ? array.map((x) =>
26
+ const chosen: Array<string | typeof VERSION_NEUTRAL> = props.method
27
+ ?.length
28
+ ? props.method
29
+ : props.controller?.length
30
+ ? props.controller
31
+ : cast(config.defaultVersion);
32
+ const unique: Array<string | typeof VERSION_NEUTRAL> = [
33
+ ...new Set(chosen),
34
+ ];
35
+ return unique.length
36
+ ? unique.map((x) =>
23
37
  typeof x === "symbol" ? "" : `${config.prefix}${x}`,
24
38
  )
25
- : [];
39
+ : [""];
26
40
  };
27
41
  }
@@ -1,10 +0,0 @@
1
- import type { ITtscPlugin, ITtscPluginFactoryContext } from "ttsc";
2
- /**
3
- * `@nestia/core` ttsc plugin descriptor.
4
- *
5
- * `@nestia/sdk` is not a standalone plugin: its Go transform is declared here
6
- * as a `contributor` that ttsc statically links into this host binary, and only
7
- * when `@nestia/sdk` is actually resolvable from the project. A project
8
- * depending on `@nestia/core` alone never compiles any SDK transform code.
9
- */
10
- export default function createTtscPlugin(context: ITtscPluginFactoryContext): ITtscPlugin;
package/lib/transform.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = createTtscPlugin;
7
- const node_module_1 = require("node:module");
8
- const node_path_1 = __importDefault(require("node:path"));
9
- /**
10
- * `@nestia/core` ttsc plugin descriptor.
11
- *
12
- * `@nestia/sdk` is not a standalone plugin: its Go transform is declared here
13
- * as a `contributor` that ttsc statically links into this host binary, and only
14
- * when `@nestia/sdk` is actually resolvable from the project. A project
15
- * depending on `@nestia/core` alone never compiles any SDK transform code.
16
- */
17
- function createTtscPlugin(context) {
18
- const requireFrom = (0, node_module_1.createRequire)(node_path_1.default.join(context.projectRoot, "package.json"));
19
- const root = node_path_1.default.dirname(requireFrom.resolve("@nestia/core/package.json"));
20
- return {
21
- name: "@nestia/core",
22
- source: node_path_1.default.resolve(root, "native", "cmd", "ttsc-nestia"),
23
- };
24
- }
25
- //# sourceMappingURL=transform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,0DAA6B;AAG7B;;;;;;;GAOG;AACH,0BACE,OAAkC;IAElC,MAAM,WAAW,GAAG,IAAA,2BAAa,EAC/B,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAC/C,CAAC;IACF,MAAM,IAAI,GAAW,mBAAI,CAAC,OAAO,CAC/B,WAAW,CAAC,OAAO,CAAC,2BAA2B,CAAC,CACjD,CAAC;IACF,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,mBAAI,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAC;KAC3D,CAAC;AACJ,CAAC"}
package/src/transform.ts DELETED
@@ -1,26 +0,0 @@
1
- import { createRequire } from "node:module";
2
- import path from "node:path";
3
- import type { ITtscPlugin, ITtscPluginFactoryContext } from "ttsc";
4
-
5
- /**
6
- * `@nestia/core` ttsc plugin descriptor.
7
- *
8
- * `@nestia/sdk` is not a standalone plugin: its Go transform is declared here
9
- * as a `contributor` that ttsc statically links into this host binary, and only
10
- * when `@nestia/sdk` is actually resolvable from the project. A project
11
- * depending on `@nestia/core` alone never compiles any SDK transform code.
12
- */
13
- export default function createTtscPlugin(
14
- context: ITtscPluginFactoryContext,
15
- ): ITtscPlugin {
16
- const requireFrom = createRequire(
17
- path.join(context.projectRoot, "package.json"),
18
- );
19
- const root: string = path.dirname(
20
- requireFrom.resolve("@nestia/core/package.json"),
21
- );
22
- return {
23
- name: "@nestia/core",
24
- source: path.resolve(root, "native", "cmd", "ttsc-nestia"),
25
- };
26
- }