@learncard/init 2.4.0 → 2.4.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.
@@ -0,0 +1,3 @@
1
+ export * from './init';
2
+ export * from './types/LearnCard';
3
+ //# sourceMappingURL=index.d.ts.map
package/dist/node-esm.mjs CHANGED
@@ -1,4 +1,23 @@
1
- import init from './index.cjs';
1
+ // Node ESM entrypoint (resolved via the `node.import` export condition).
2
+ //
3
+ // Node consumers are deliberately routed to the CommonJS bundle (`index.cjs`,
4
+ // which switches between the dev / minified prod CJS builds via NODE_ENV).
5
+ // We load it with `createRequire` rather than a static `import ... from
6
+ // './index.cjs'`.
7
+ //
8
+ // Why: a static ESM import of a CJS file is the one shape that breaks bundlers.
9
+ // When a bundler (e.g. Vite/Astro SSR) transforms this module — which it does
10
+ // for symlinked workspace deps — it follows the static import into `index.cjs`
11
+ // and tries to transform that CommonJS file as ESM, throwing
12
+ // `module is not defined`. `createRequire` keeps the CJS loading opaque to the
13
+ // bundler's ESM transform and hands it to Node's native CommonJS loader, where
14
+ // `module` / `require` are defined. Runtime behavior for Node consumers is
15
+ // unchanged (same CJS bundle, same didkit backend); bundler-transformed
16
+ // symlinked consumers no longer need `ssr.external` / `optimizeDeps` guards.
17
+ import { createRequire } from 'node:module';
18
+
19
+ const require = createRequire(import.meta.url);
20
+ const init = require('./index.cjs');
2
21
 
3
22
  export const customLearnCard = init.customLearnCard;
4
23
  export const didWebLearnCardFromSeed = init.didWebLearnCardFromSeed;
package/package.json CHANGED
@@ -1,19 +1,34 @@
1
1
  {
2
2
  "name": "@learncard/init",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Primary initialization of LearnCard SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/init.esm.js",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
10
  "node": {
12
- "import": "./dist/node-esm.mjs",
13
- "require": "./dist/index.cjs"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/node-esm.mjs"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "import": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/init.esm.js"
14
23
  },
15
- "import": "./dist/init.esm.js",
16
- "require": "./dist/index.cjs"
24
+ "require": {
25
+ "types": "./dist/index.d.cts",
26
+ "default": "./dist/index.cjs"
27
+ }
28
+ },
29
+ "./dist/init.esm.js": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/init.esm.js"
17
32
  }
18
33
  },
19
34
  "files": [
@@ -45,24 +60,24 @@
45
60
  },
46
61
  "types": "./dist/index.d.ts",
47
62
  "dependencies": {
48
- "@learncard/crypto-plugin": "1.1.22",
49
63
  "@learncard/chapi-plugin": "1.1.22",
50
- "@learncard/didkey-plugin": "1.1.22",
51
64
  "@learncard/core": "9.4.22",
65
+ "@learncard/crypto-plugin": "1.1.22",
66
+ "@learncard/didkey-plugin": "1.1.22",
52
67
  "@learncard/didkit-plugin": "1.9.2",
53
- "@learncard/did-web-plugin": "1.1.22",
54
- "@learncard/encryption-plugin": "1.1.22",
55
68
  "@learncard/dynamic-loader-plugin": "1.1.22",
69
+ "@learncard/encryption-plugin": "1.1.22",
70
+ "@learncard/did-web-plugin": "1.1.22",
56
71
  "@learncard/ethereum-plugin": "1.1.23",
57
72
  "@learncard/expiration-plugin": "1.2.22",
58
73
  "@learncard/helpers": "1.3.4",
59
74
  "@learncard/learn-card-plugin": "1.2.22",
75
+ "@learncard/network-plugin": "^2.13.3",
60
76
  "@learncard/openid4vc-plugin": "0.2.0",
77
+ "@learncard/sd-jwt-vc-plugin": "0.2.0",
61
78
  "@learncard/learn-cloud-plugin": "2.3.27",
62
- "@learncard/network-plugin": "^2.13.2",
63
79
  "@learncard/types": "5.17.2",
64
80
  "@learncard/vc-api-plugin": "1.1.22",
65
- "@learncard/sd-jwt-vc-plugin": "0.2.0",
66
81
  "@learncard/vc-plugin": "1.5.2",
67
82
  "@learncard/vc-templates-plugin": "1.1.22",
68
83
  "@learncard/vpqr-plugin": "1.1.22"
@@ -72,7 +87,7 @@
72
87
  },
73
88
  "sideEffects": false,
74
89
  "scripts": {
75
- "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.build.json",
90
+ "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.build.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
76
91
  "start": "aqu watch",
77
92
  "lint": "aqu lint",
78
93
  "lint:fix": "aqu lint --fix",