phecda-web 1.0.1-alpha.7 → 1.0.1-alpha.9
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/README.md +5 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.js +2 -28
- package/dist/index.mjs +1 -25
- package/package.json +2 -2
package/README.md
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,4 @@ declare function serializeState(): any;
|
|
|
23
23
|
declare function isModuleLoad(module: Construct): boolean;
|
|
24
24
|
declare function unmountModule(module: Construct | PropertyKey): Promise<void>;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
declare function isAsyncFunc(fn: Function): boolean;
|
|
28
|
-
|
|
29
|
-
export { ActiveInstance, PhecdaEmitter, defaultWebInject, emitter, getActiveInstance, isAsyncFunc, isModuleLoad, resetActiveInstance, serializeState, unmountModule, waitUntilInit, wrapError };
|
|
26
|
+
export { ActiveInstance, PhecdaEmitter, defaultWebInject, emitter, getActiveInstance, isModuleLoad, resetActiveInstance, serializeState, unmountModule, waitUntilInit };
|
package/dist/index.js
CHANGED
|
@@ -31,13 +31,11 @@ __export(src_exports, {
|
|
|
31
31
|
defaultWebInject: () => defaultWebInject,
|
|
32
32
|
emitter: () => emitter,
|
|
33
33
|
getActiveInstance: () => getActiveInstance,
|
|
34
|
-
isAsyncFunc: () => isAsyncFunc,
|
|
35
34
|
isModuleLoad: () => isModuleLoad,
|
|
36
35
|
resetActiveInstance: () => resetActiveInstance,
|
|
37
36
|
serializeState: () => serializeState,
|
|
38
37
|
unmountModule: () => unmountModule,
|
|
39
|
-
waitUntilInit: () => waitUntilInit
|
|
40
|
-
wrapError: () => wrapError
|
|
38
|
+
waitUntilInit: () => waitUntilInit
|
|
41
39
|
});
|
|
42
40
|
module.exports = __toCommonJS(src_exports);
|
|
43
41
|
__reExport(src_exports, require("phecda-core"), module.exports);
|
|
@@ -128,38 +126,14 @@ async function unmountModule(module2) {
|
|
|
128
126
|
delete state[module2];
|
|
129
127
|
}
|
|
130
128
|
__name(unmountModule, "unmountModule");
|
|
131
|
-
|
|
132
|
-
// src/utils.ts
|
|
133
|
-
function wrapError(target, key, errorHandler) {
|
|
134
|
-
if (isAsyncFunc(target[key])) {
|
|
135
|
-
return (...args) => {
|
|
136
|
-
return target[key].apply(target, args).catch(errorHandler);
|
|
137
|
-
};
|
|
138
|
-
} else {
|
|
139
|
-
return (...args) => {
|
|
140
|
-
try {
|
|
141
|
-
return target[key].apply(target, args);
|
|
142
|
-
} catch (e) {
|
|
143
|
-
return errorHandler(e);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
__name(wrapError, "wrapError");
|
|
149
|
-
function isAsyncFunc(fn) {
|
|
150
|
-
return fn[Symbol.toStringTag] === "AsyncFunction";
|
|
151
|
-
}
|
|
152
|
-
__name(isAsyncFunc, "isAsyncFunc");
|
|
153
129
|
// Annotate the CommonJS export names for ESM import in node:
|
|
154
130
|
0 && (module.exports = {
|
|
155
131
|
defaultWebInject,
|
|
156
132
|
emitter,
|
|
157
133
|
getActiveInstance,
|
|
158
|
-
isAsyncFunc,
|
|
159
134
|
isModuleLoad,
|
|
160
135
|
resetActiveInstance,
|
|
161
136
|
serializeState,
|
|
162
137
|
unmountModule,
|
|
163
|
-
waitUntilInit
|
|
164
|
-
wrapError
|
|
138
|
+
waitUntilInit
|
|
165
139
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -90,37 +90,13 @@ async function unmountModule(module) {
|
|
|
90
90
|
delete state[module];
|
|
91
91
|
}
|
|
92
92
|
__name(unmountModule, "unmountModule");
|
|
93
|
-
|
|
94
|
-
// src/utils.ts
|
|
95
|
-
function wrapError(target, key, errorHandler) {
|
|
96
|
-
if (isAsyncFunc(target[key])) {
|
|
97
|
-
return (...args) => {
|
|
98
|
-
return target[key].apply(target, args).catch(errorHandler);
|
|
99
|
-
};
|
|
100
|
-
} else {
|
|
101
|
-
return (...args) => {
|
|
102
|
-
try {
|
|
103
|
-
return target[key].apply(target, args);
|
|
104
|
-
} catch (e) {
|
|
105
|
-
return errorHandler(e);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
__name(wrapError, "wrapError");
|
|
111
|
-
function isAsyncFunc(fn) {
|
|
112
|
-
return fn[Symbol.toStringTag] === "AsyncFunction";
|
|
113
|
-
}
|
|
114
|
-
__name(isAsyncFunc, "isAsyncFunc");
|
|
115
93
|
export {
|
|
116
94
|
defaultWebInject,
|
|
117
95
|
emitter,
|
|
118
96
|
getActiveInstance,
|
|
119
|
-
isAsyncFunc,
|
|
120
97
|
isModuleLoad,
|
|
121
98
|
resetActiveInstance,
|
|
122
99
|
serializeState,
|
|
123
100
|
unmountModule,
|
|
124
|
-
waitUntilInit
|
|
125
|
-
wrapError
|
|
101
|
+
waitUntilInit
|
|
126
102
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-web",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.9",
|
|
4
4
|
"description": "provide web function for phecda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"mitt": "^3.0.0",
|
|
16
|
-
"phecda-core": "3.0.0-alpha.
|
|
16
|
+
"phecda-core": "3.0.0-alpha.12"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsup": "^6.5.0"
|