@skmtc/core 0.0.408 → 0.0.409

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.
@@ -544,7 +544,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_moduleImportMap = new W
544
544
  if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
545
545
  throw new Error(`File already exists: ${normalisedPath}`);
546
546
  }
547
- const newFile = new File(normalisedPath);
547
+ const newFile = new File(normalisedPath, this.settings);
548
548
  __classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
549
549
  return newFile;
550
550
  };
package/esm/dsl/File.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Definition } from './Definition.js';
2
2
  import type { GeneratorKey } from '../types/GeneratorKeys.js';
3
+ import type { ClientSettings } from '../types/Settings.js';
3
4
  export declare class File {
4
5
  #private;
5
6
  path: string;
@@ -7,7 +8,8 @@ export declare class File {
7
8
  imports: Map<string, Set<string>>;
8
9
  definitions: Map<string, Definition>;
9
10
  moduleImportMap: Map<string, string>;
10
- constructor(path: string);
11
+ settings: ClientSettings | undefined;
12
+ constructor(path: string, settings: ClientSettings | undefined);
11
13
  get generatorKeys(): Set<GeneratorKey>;
12
14
  toString(): string;
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAGxB,IAAI,EAAE,MAAM;IASxB,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAgCT"}
1
+ {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEpC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;gBAExB,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS;IAU9D,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAkCT"}
package/esm/dsl/File.js CHANGED
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _File_generatorKeys;
13
13
  import { Import } from './Import.js';
14
14
  export class File {
15
- constructor(path) {
15
+ constructor(path, settings) {
16
16
  Object.defineProperty(this, "path", {
17
17
  enumerable: true,
18
18
  configurable: true,
@@ -44,12 +44,19 @@ export class File {
44
44
  value: void 0
45
45
  });
46
46
  _File_generatorKeys.set(this, void 0);
47
+ Object.defineProperty(this, "settings", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: void 0
52
+ });
47
53
  this.path = path;
48
54
  this.reExports = new Map();
49
55
  this.imports = new Map();
50
56
  this.definitions = new Map();
51
57
  __classPrivateFieldSet(this, _File_generatorKeys, new Set(), "f");
52
58
  this.moduleImportMap = new Map();
59
+ this.settings = settings;
53
60
  }
54
61
  get generatorKeys() {
55
62
  return __classPrivateFieldGet(this, _File_generatorKeys, "f");
@@ -59,7 +66,8 @@ export class File {
59
66
  const updatedModuleName = updateModuleName({
60
67
  destinationPath: this.path,
61
68
  moduleImportMap: this.moduleImportMap,
62
- exportPath: module
69
+ exportPath: module,
70
+ settings: this.settings
63
71
  });
64
72
  return Object.entries(entityTypes).map(([entityType, names]) => {
65
73
  const prefix = entityType === 'type' ? 'type' : '';
@@ -70,7 +78,8 @@ export class File {
70
78
  const updatedModuleName = updateModuleName({
71
79
  destinationPath: this.path,
72
80
  moduleImportMap: this.moduleImportMap,
73
- exportPath: module
81
+ exportPath: module,
82
+ settings: this.settings
74
83
  });
75
84
  return new Import({ module: updatedModuleName, importNames: Array.from(importItems) });
76
85
  });
@@ -82,14 +91,15 @@ export class File {
82
91
  }
83
92
  }
84
93
  _File_generatorKeys = new WeakMap();
85
- const updateModuleName = ({ destinationPath, moduleImportMap, exportPath }) => {
94
+ const updateModuleName = ({ destinationPath, moduleImportMap, exportPath, settings }) => {
86
95
  const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
87
96
  // If exportPath does not match any module imports, return the original exportPath
88
97
  if (!matchedModuleImport) {
89
98
  return exportPath;
90
99
  }
91
100
  const [matchedPath, moduleName] = matchedModuleImport;
101
+ const matchedRoot = settings?.appRoots?.find(root => matchedPath.startsWith(root)) ?? matchedPath;
92
102
  // If module import is imported from inside module, turn into a local absolute path starting with '@/'
93
103
  // Otherwise, if module import is imported from outside module, use module name
94
- return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
104
+ return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedRoot, '@') : moduleName;
95
105
  };
@@ -96,6 +96,7 @@ export declare const clientGeneratorSettings: z.ZodUnion<[z.ZodObject<{
96
96
  export type ClientGeneratorSettings = OperationsGeneratorSettings | ModelsGeneratorSettings;
97
97
  export declare const clientSettings: z.ZodObject<{
98
98
  basePath: z.ZodOptional<z.ZodString>;
99
+ appRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
99
100
  generators: z.ZodArray<z.ZodUnion<[z.ZodObject<{
100
101
  id: z.ZodString;
101
102
  description: z.ZodOptional<z.ZodString>;
@@ -144,6 +145,7 @@ export declare const clientSettings: z.ZodObject<{
144
145
  exportPath?: string | undefined;
145
146
  })[];
146
147
  basePath?: string | undefined;
148
+ appRoots?: string[] | undefined;
147
149
  }, {
148
150
  generators: ({
149
151
  id: string;
@@ -158,9 +160,11 @@ export declare const clientSettings: z.ZodObject<{
158
160
  exportPath?: string | undefined;
159
161
  })[];
160
162
  basePath?: string | undefined;
163
+ appRoots?: string[] | undefined;
161
164
  }>;
162
165
  export type ClientSettings = {
163
166
  basePath?: string;
167
+ appRoots?: string[];
164
168
  generators: ClientGeneratorSettings[];
165
169
  };
166
170
  export type SkmtcClientConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAO/C,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,U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AE3D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA"}
@@ -28,6 +28,7 @@ export const clientGeneratorSettings = z.union([
28
28
  ]);
29
29
  export const clientSettings = z.object({
30
30
  basePath: z.string().optional(),
31
+ appRoots: z.array(z.string()).optional(),
31
32
  generators: z.array(clientGeneratorSettings)
32
33
  });
33
34
  export const skmtcClientConfig = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.408",
3
+ "version": "0.0.409",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -574,7 +574,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_moduleImportMap = new W
574
574
  if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
575
575
  throw new Error(`File already exists: ${normalisedPath}`);
576
576
  }
577
- const newFile = new File_js_1.File(normalisedPath);
577
+ const newFile = new File_js_1.File(normalisedPath, this.settings);
578
578
  __classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
579
579
  return newFile;
580
580
  };
@@ -1,5 +1,6 @@
1
1
  import type { Definition } from './Definition.js';
2
2
  import type { GeneratorKey } from '../types/GeneratorKeys.js';
3
+ import type { ClientSettings } from '../types/Settings.js';
3
4
  export declare class File {
4
5
  #private;
5
6
  path: string;
@@ -7,7 +8,8 @@ export declare class File {
7
8
  imports: Map<string, Set<string>>;
8
9
  definitions: Map<string, Definition>;
9
10
  moduleImportMap: Map<string, string>;
10
- constructor(path: string);
11
+ settings: ClientSettings | undefined;
12
+ constructor(path: string, settings: ClientSettings | undefined);
11
13
  get generatorKeys(): Set<GeneratorKey>;
12
14
  toString(): string;
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAGxB,IAAI,EAAE,MAAM;IASxB,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAgCT"}
1
+ {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEpC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;gBAExB,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS;IAU9D,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAkCT"}
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.File = void 0;
16
16
  const Import_js_1 = require("./Import.js");
17
17
  class File {
18
- constructor(path) {
18
+ constructor(path, settings) {
19
19
  Object.defineProperty(this, "path", {
20
20
  enumerable: true,
21
21
  configurable: true,
@@ -47,12 +47,19 @@ class File {
47
47
  value: void 0
48
48
  });
49
49
  _File_generatorKeys.set(this, void 0);
50
+ Object.defineProperty(this, "settings", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
50
56
  this.path = path;
51
57
  this.reExports = new Map();
52
58
  this.imports = new Map();
53
59
  this.definitions = new Map();
54
60
  __classPrivateFieldSet(this, _File_generatorKeys, new Set(), "f");
55
61
  this.moduleImportMap = new Map();
62
+ this.settings = settings;
56
63
  }
57
64
  get generatorKeys() {
58
65
  return __classPrivateFieldGet(this, _File_generatorKeys, "f");
@@ -62,7 +69,8 @@ class File {
62
69
  const updatedModuleName = updateModuleName({
63
70
  destinationPath: this.path,
64
71
  moduleImportMap: this.moduleImportMap,
65
- exportPath: module
72
+ exportPath: module,
73
+ settings: this.settings
66
74
  });
67
75
  return Object.entries(entityTypes).map(([entityType, names]) => {
68
76
  const prefix = entityType === 'type' ? 'type' : '';
@@ -73,7 +81,8 @@ class File {
73
81
  const updatedModuleName = updateModuleName({
74
82
  destinationPath: this.path,
75
83
  moduleImportMap: this.moduleImportMap,
76
- exportPath: module
84
+ exportPath: module,
85
+ settings: this.settings
77
86
  });
78
87
  return new Import_js_1.Import({ module: updatedModuleName, importNames: Array.from(importItems) });
79
88
  });
@@ -86,14 +95,15 @@ class File {
86
95
  }
87
96
  exports.File = File;
88
97
  _File_generatorKeys = new WeakMap();
89
- const updateModuleName = ({ destinationPath, moduleImportMap, exportPath }) => {
98
+ const updateModuleName = ({ destinationPath, moduleImportMap, exportPath, settings }) => {
90
99
  const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
91
100
  // If exportPath does not match any module imports, return the original exportPath
92
101
  if (!matchedModuleImport) {
93
102
  return exportPath;
94
103
  }
95
104
  const [matchedPath, moduleName] = matchedModuleImport;
105
+ const matchedRoot = settings?.appRoots?.find(root => matchedPath.startsWith(root)) ?? matchedPath;
96
106
  // If module import is imported from inside module, turn into a local absolute path starting with '@/'
97
107
  // Otherwise, if module import is imported from outside module, use module name
98
- return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
108
+ return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedRoot, '@') : moduleName;
99
109
  };
@@ -96,6 +96,7 @@ export declare const clientGeneratorSettings: z.ZodUnion<[z.ZodObject<{
96
96
  export type ClientGeneratorSettings = OperationsGeneratorSettings | ModelsGeneratorSettings;
97
97
  export declare const clientSettings: z.ZodObject<{
98
98
  basePath: z.ZodOptional<z.ZodString>;
99
+ appRoots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
99
100
  generators: z.ZodArray<z.ZodUnion<[z.ZodObject<{
100
101
  id: z.ZodString;
101
102
  description: z.ZodOptional<z.ZodString>;
@@ -144,6 +145,7 @@ export declare const clientSettings: z.ZodObject<{
144
145
  exportPath?: string | undefined;
145
146
  })[];
146
147
  basePath?: string | undefined;
148
+ appRoots?: string[] | undefined;
147
149
  }, {
148
150
  generators: ({
149
151
  id: string;
@@ -158,9 +160,11 @@ export declare const clientSettings: z.ZodObject<{
158
160
  exportPath?: string | undefined;
159
161
  })[];
160
162
  basePath?: string | undefined;
163
+ appRoots?: string[] | undefined;
161
164
  }>;
162
165
  export type ClientSettings = {
163
166
  basePath?: string;
167
+ appRoots?: string[];
164
168
  generators: ClientGeneratorSettings[];
165
169
  };
166
170
  export type SkmtcClientConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAO/C,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAA;AAEnF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;EAKtC,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IACjE,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;EAMlC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAA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;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,EAAE,uBAAuB,EAAE,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,cAAc,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAKzD,CAAA;AAEF,eAAO,MAAM,aAAa,mCAAiC,CAAA;AAE3D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA"}
@@ -31,6 +31,7 @@ exports.clientGeneratorSettings = zod_1.z.union([
31
31
  ]);
32
32
  exports.clientSettings = zod_1.z.object({
33
33
  basePath: zod_1.z.string().optional(),
34
+ appRoots: zod_1.z.array(zod_1.z.string()).optional(),
34
35
  generators: zod_1.z.array(exports.clientGeneratorSettings)
35
36
  });
36
37
  exports.skmtcClientConfig = zod_1.z.object({