@gp2f/client-sdk 1.0.2 → 1.0.4
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/dist/index.js +10 -6
- package/package.json +8 -2
- package/src/index.ts +10 -6
package/dist/index.js
CHANGED
|
@@ -32,13 +32,17 @@ let _policyEngineCache = null;
|
|
|
32
32
|
* to emit this as a separate chunk so it is only downloaded on demand.
|
|
33
33
|
*/
|
|
34
34
|
async function _importPolicyEngine() {
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
35
|
+
// We intentionally defeat static import analysis by building the specifier
|
|
36
|
+
// at runtime. Vite / Rollup / webpack resolve bare string literals in
|
|
37
|
+
// dynamic imports at *build time*, before any try/catch can help. A computed
|
|
38
|
+
// expression is invisible to those static passes, so the try/catch below
|
|
39
|
+
// actually runs at runtime when the package is absent.
|
|
40
|
+
//
|
|
41
|
+
// If @gp2f/policy-core-wasm IS installed, this resolves normally.
|
|
42
|
+
// If it is NOT installed, the runtime import() throws and we return the stub.
|
|
43
|
+
const specifier = /* @vite-ignore */ "@gp2f/" + "policy-core-wasm";
|
|
38
44
|
try {
|
|
39
|
-
|
|
40
|
-
// that may not be installed. The try/catch below handles the absence case.
|
|
41
|
-
const mod = await import(/* webpackChunkName: "policy-engine" */ "@gp2f/policy-core-wasm");
|
|
45
|
+
const mod = await import(/* @vite-ignore */ specifier);
|
|
42
46
|
return mod;
|
|
43
47
|
}
|
|
44
48
|
catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gp2f/client-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "GP2F client SDK – reconciliation UX components and WebSocket client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,13 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=18.0.0",
|
|
31
|
-
"react-dom": ">=18.0.0"
|
|
31
|
+
"react-dom": ">=18.0.0",
|
|
32
|
+
"@gp2f/policy-core-wasm": "*"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"@gp2f/policy-core-wasm": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
"devDependencies": {
|
|
34
40
|
"@types/react": "^18.0.0",
|
package/src/index.ts
CHANGED
|
@@ -69,13 +69,17 @@ let _policyEngineCache: PolicyEngineModule | null = null;
|
|
|
69
69
|
* to emit this as a separate chunk so it is only downloaded on demand.
|
|
70
70
|
*/
|
|
71
71
|
async function _importPolicyEngine(): Promise<PolicyEngineModule> {
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
72
|
+
// We intentionally defeat static import analysis by building the specifier
|
|
73
|
+
// at runtime. Vite / Rollup / webpack resolve bare string literals in
|
|
74
|
+
// dynamic imports at *build time*, before any try/catch can help. A computed
|
|
75
|
+
// expression is invisible to those static passes, so the try/catch below
|
|
76
|
+
// actually runs at runtime when the package is absent.
|
|
77
|
+
//
|
|
78
|
+
// If @gp2f/policy-core-wasm IS installed, this resolves normally.
|
|
79
|
+
// If it is NOT installed, the runtime import() throws and we return the stub.
|
|
80
|
+
const specifier = /* @vite-ignore */ "@gp2f/" + "policy-core-wasm";
|
|
75
81
|
try {
|
|
76
|
-
|
|
77
|
-
// that may not be installed. The try/catch below handles the absence case.
|
|
78
|
-
const mod = await import(/* webpackChunkName: "policy-engine" */ "@gp2f/policy-core-wasm");
|
|
82
|
+
const mod = await import(/* @vite-ignore */ specifier);
|
|
79
83
|
return mod as PolicyEngineModule;
|
|
80
84
|
} catch {
|
|
81
85
|
// WASM package not installed – return a stub that always delegates to the
|