phecda-module 1.0.4-alpha.9 → 1.0.4-beta.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.
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/work/phecda/phecda/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
2
2
 
3
- > phecda-module@1.0.4-alpha.9 build /home/runner/work/phecda/phecda/packages/module
3
+ > phecda-module@1.0.4-beta.14 build /home/runner/work/phecda/phecda/packages/module
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: src/index.ts, src/vite.ts
@@ -10,13 +10,13 @@
10
10
  CLI Target: esnext
11
11
  CJS Build start
12
12
  ESM Build start
13
+ ESM dist/index.mjs 1.89 KB
14
+ ESM dist/vite.mjs 519.00 B
15
+ ESM ⚡️ Build success in 52ms
13
16
  CJS dist/index.js 3.14 KB
14
17
  CJS dist/vite.js 1.42 KB
15
- CJS ⚡️ Build success in 56ms
16
- ESM dist/index.mjs 1.92 KB
17
- ESM dist/vite.mjs 519.00 B
18
- ESM ⚡️ Build success in 58ms
18
+ CJS ⚡️ Build success in 53ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 2979ms
21
- DTS dist/index.d.ts 186.00 B
20
+ DTS ⚡️ Build success in 2186ms
21
+ DTS dist/index.d.ts 191.00 B
22
22
  DTS dist/vite.d.ts 210.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # phecda-module
2
2
 
3
+ ## 1.0.4-beta.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [074a815]
8
+ - phecda-core@3.0.0-beta.14
9
+
10
+ ## 1.0.4-beta.13
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [d1f7041]
15
+ - Updated dependencies [5a477d0]
16
+ - Updated dependencies [aefd80c]
17
+ - phecda-core@3.0.0-beta.13
18
+
19
+ ## 1.0.4-alpha.12
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [671fbc9]
24
+ - Updated dependencies [671fbc9]
25
+ - phecda-core@3.0.0-alpha.12
26
+
27
+ ## 1.0.4-alpha.11
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [c6427b1]
32
+ - Updated dependencies [7b0d6fa]
33
+ - Updated dependencies [4621244]
34
+ - Updated dependencies [dbb599a]
35
+ - phecda-core@3.0.0-alpha.11
36
+
37
+ ## 1.0.4-alpha.10
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies [e254263]
42
+ - phecda-core@3.0.0-alpha.10
43
+
3
44
  ## 1.0.4-alpha.9
4
45
 
5
46
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from 'phecda-core';
2
2
 
3
- declare const moduleMap: Map<string, any>;
3
+ declare const moduleMap: Map<PropertyKey, any>;
4
4
  declare function Factory(Modules: (new (...args: any) => any)[]): Promise<void>;
5
5
 
6
6
  export { Factory, moduleMap };
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ __name(Factory, "Factory");
39
39
  if (__DEV__) {
40
40
  window.__PHECDA_MODULE_UPDATE__ = (target) => {
41
41
  target = Object.values(target)[0];
42
- const tag = target.prototype?.__TAG__ || target.name;
42
+ const tag = (0, import_phecda_core.getTag)(target);
43
43
  const module2 = moduleMap.get(tag);
44
44
  module2.destroy?.();
45
45
  moduleMap.delete(tag);
@@ -49,11 +49,11 @@ if (__DEV__) {
49
49
  async function buildNestModule(Module) {
50
50
  const paramtypes = getParamtypes(Module);
51
51
  let instance;
52
- const tag = Module.prototype?.__TAG__ || Module.name;
52
+ const tag = (0, import_phecda_core.getTag)(Module);
53
53
  if (moduleMap.has(tag)) {
54
54
  instance = moduleMap.get(tag);
55
55
  if (!instance)
56
- throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${tag}--[module] ${Module}`);
56
+ throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Module}`);
57
57
  return instance;
58
58
  }
59
59
  moduleMap.set(tag, void 0);
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/core.ts
5
- import { invokeHandler } from "phecda-core";
5
+ import { getTag, invokeHandler } from "phecda-core";
6
6
  import "reflect-metadata";
7
7
  var moduleMap = /* @__PURE__ */ new Map();
8
8
  async function Factory(Modules) {
@@ -13,7 +13,7 @@ __name(Factory, "Factory");
13
13
  if (__DEV__) {
14
14
  window.__PHECDA_MODULE_UPDATE__ = (target) => {
15
15
  target = Object.values(target)[0];
16
- const tag = target.prototype?.__TAG__ || target.name;
16
+ const tag = getTag(target);
17
17
  const module = moduleMap.get(tag);
18
18
  module.destroy?.();
19
19
  moduleMap.delete(tag);
@@ -23,11 +23,11 @@ if (__DEV__) {
23
23
  async function buildNestModule(Module) {
24
24
  const paramtypes = getParamtypes(Module);
25
25
  let instance;
26
- const tag = Module.prototype?.__TAG__ || Module.name;
26
+ const tag = getTag(Module);
27
27
  if (moduleMap.has(tag)) {
28
28
  instance = moduleMap.get(tag);
29
29
  if (!instance)
30
- throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${tag}--[module] ${Module}`);
30
+ throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Module}`);
31
31
  return instance;
32
32
  }
33
33
  moduleMap.set(tag, void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-module",
3
- "version": "1.0.4-alpha.9",
3
+ "version": "1.0.4-beta.14",
4
4
  "description": "provide DI and HMR for modules by reflect-metadata and vite",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,7 +27,7 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "reflect-metadata": "^0.1.13",
30
- "phecda-core": "3.0.0-alpha.9"
30
+ "phecda-core": "3.0.0-beta.14"
31
31
  },
32
32
  "devDependencies": {
33
33
  "tsup": "^6.5.0"
package/src/core.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { Construct } from 'phecda-core'
2
- import { invokeHandler } from 'phecda-core'
2
+ import { getTag, invokeHandler } from 'phecda-core'
3
3
  import 'reflect-metadata'
4
4
 
5
- export const moduleMap = new Map<string, InstanceType<Construct>>()
5
+ export const moduleMap = new Map<PropertyKey, InstanceType<Construct>>()
6
6
 
7
7
  export async function Factory(Modules: (new (...args: any) => any)[]) {
8
8
  for (const Module of Modules)
@@ -13,7 +13,7 @@ if (__DEV__) {
13
13
  // @ts-expect-error work for hmr
14
14
  window.__PHECDA_MODULE_UPDATE__ = (target) => {
15
15
  target = Object.values(target)[0]
16
- const tag = target.prototype?.__TAG__ || target.name
16
+ const tag = getTag(target)
17
17
  const module = moduleMap.get(tag)
18
18
  module.destroy?.()
19
19
  moduleMap.delete(tag)
@@ -25,12 +25,12 @@ async function buildNestModule(Module: Construct) {
25
25
  const paramtypes = getParamtypes(Module) as Construct[]
26
26
 
27
27
  let instance: InstanceType<Construct>
28
- const tag = Module.prototype?.__TAG__ || Module.name
28
+ const tag = getTag(Module)
29
29
 
30
30
  if (moduleMap.has(tag)) {
31
31
  instance = moduleMap.get(tag)
32
32
  if (!instance)
33
- throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${tag}--[module] ${Module}`)
33
+ throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Module}`)
34
34
 
35
35
  return instance
36
36
  }