@wemush/wols 0.1.0 → 1.3.0

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/README.md +204 -31
  3. package/dist/cjs/compact-url.d.ts +150 -0
  4. package/dist/cjs/compact-url.d.ts.map +1 -0
  5. package/dist/cjs/compact-url.js +64 -0
  6. package/dist/cjs/compact-url.js.map +1 -1
  7. package/dist/cjs/crypto/decrypt.d.ts +110 -0
  8. package/dist/cjs/crypto/decrypt.d.ts.map +1 -0
  9. package/dist/cjs/crypto/decrypt.js +521 -90
  10. package/dist/cjs/crypto/decrypt.js.map +1 -1
  11. package/dist/cjs/crypto/encrypt.d.ts +132 -0
  12. package/dist/cjs/crypto/encrypt.d.ts.map +1 -0
  13. package/dist/cjs/crypto/encrypt.js +288 -105
  14. package/dist/cjs/crypto/encrypt.js.map +1 -1
  15. package/dist/cjs/crypto/index.d.ts +12 -0
  16. package/dist/cjs/crypto/index.d.ts.map +1 -0
  17. package/dist/cjs/crypto/index.js +15 -2
  18. package/dist/cjs/crypto/index.js.map +1 -1
  19. package/dist/cjs/crypto/shared.d.ts +116 -0
  20. package/dist/cjs/crypto/shared.d.ts.map +1 -0
  21. package/dist/cjs/crypto/shared.js +238 -0
  22. package/dist/cjs/crypto/shared.js.map +1 -0
  23. package/dist/cjs/errors.d.ts +133 -0
  24. package/dist/cjs/errors.d.ts.map +1 -0
  25. package/dist/cjs/errors.js +39 -1
  26. package/dist/cjs/errors.js.map +1 -1
  27. package/dist/cjs/index.d.ts +29 -0
  28. package/dist/cjs/index.d.ts.map +1 -0
  29. package/dist/cjs/index.js +70 -3
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/package.json +3 -0
  32. package/dist/cjs/parser.d.ts +30 -0
  33. package/dist/cjs/parser.d.ts.map +1 -0
  34. package/dist/cjs/parser.js +3 -0
  35. package/dist/cjs/parser.js.map +1 -1
  36. package/dist/cjs/qr/generate.d.ts +62 -0
  37. package/dist/cjs/qr/generate.d.ts.map +1 -0
  38. package/dist/cjs/qr/index.d.ts +10 -0
  39. package/dist/cjs/qr/index.d.ts.map +1 -0
  40. package/dist/cjs/specimen.d.ts +96 -0
  41. package/dist/cjs/specimen.d.ts.map +1 -0
  42. package/dist/cjs/specimen.js +95 -9
  43. package/dist/cjs/specimen.js.map +1 -1
  44. package/dist/cjs/types.d.ts +735 -0
  45. package/dist/cjs/types.d.ts.map +1 -0
  46. package/dist/cjs/types.js +327 -3
  47. package/dist/cjs/types.js.map +1 -1
  48. package/dist/cjs/utils/cuid.d.ts +46 -0
  49. package/dist/cjs/utils/cuid.d.ts.map +1 -0
  50. package/dist/cjs/utils/cuid.js +6 -4
  51. package/dist/cjs/utils/cuid.js.map +1 -1
  52. package/dist/cjs/utils/environment.d.ts +137 -0
  53. package/dist/cjs/utils/environment.d.ts.map +1 -0
  54. package/dist/cjs/utils/environment.js +206 -0
  55. package/dist/cjs/utils/environment.js.map +1 -0
  56. package/dist/cjs/utils/iso8601.d.ts +79 -0
  57. package/dist/cjs/utils/iso8601.d.ts.map +1 -0
  58. package/dist/cjs/utils/migration.d.ts +162 -0
  59. package/dist/cjs/utils/migration.d.ts.map +1 -0
  60. package/dist/cjs/utils/migration.js +248 -0
  61. package/dist/cjs/utils/migration.js.map +1 -0
  62. package/dist/cjs/validator.d.ts +25 -0
  63. package/dist/cjs/validator.d.ts.map +1 -0
  64. package/dist/cjs/validator.js +85 -21
  65. package/dist/cjs/validator.js.map +1 -1
  66. package/dist/esm/compact-url.js +62 -0
  67. package/dist/esm/compact-url.js.map +1 -1
  68. package/dist/esm/crypto/decrypt.js +517 -90
  69. package/dist/esm/crypto/decrypt.js.map +1 -1
  70. package/dist/esm/crypto/encrypt.js +284 -105
  71. package/dist/esm/crypto/encrypt.js.map +1 -1
  72. package/dist/esm/crypto/index.js +5 -3
  73. package/dist/esm/crypto/index.js.map +1 -1
  74. package/dist/esm/crypto/shared.js +222 -0
  75. package/dist/esm/crypto/shared.js.map +1 -0
  76. package/dist/esm/errors.js +37 -0
  77. package/dist/esm/errors.js.map +1 -1
  78. package/dist/esm/index.js +26 -6
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/esm/parser.js +3 -0
  81. package/dist/esm/parser.js.map +1 -1
  82. package/dist/esm/specimen.js +95 -10
  83. package/dist/esm/specimen.js.map +1 -1
  84. package/dist/esm/types.js +317 -2
  85. package/dist/esm/types.js.map +1 -1
  86. package/dist/esm/utils/cuid.js +6 -4
  87. package/dist/esm/utils/cuid.js.map +1 -1
  88. package/dist/esm/utils/environment.js +193 -0
  89. package/dist/esm/utils/environment.js.map +1 -0
  90. package/dist/esm/utils/migration.js +237 -0
  91. package/dist/esm/utils/migration.js.map +1 -0
  92. package/dist/esm/validator.js +86 -22
  93. package/dist/esm/validator.js.map +1 -1
  94. package/dist/types/compact-url.d.ts +46 -0
  95. package/dist/types/compact-url.d.ts.map +1 -1
  96. package/dist/types/crypto/decrypt.d.ts +95 -18
  97. package/dist/types/crypto/decrypt.d.ts.map +1 -1
  98. package/dist/types/crypto/encrypt.d.ts +114 -14
  99. package/dist/types/crypto/encrypt.d.ts.map +1 -1
  100. package/dist/types/crypto/index.d.ts +5 -3
  101. package/dist/types/crypto/index.d.ts.map +1 -1
  102. package/dist/types/crypto/shared.d.ts +116 -0
  103. package/dist/types/crypto/shared.d.ts.map +1 -0
  104. package/dist/types/errors.d.ts +31 -1
  105. package/dist/types/errors.d.ts.map +1 -1
  106. package/dist/types/index.d.ts +15 -7
  107. package/dist/types/index.d.ts.map +1 -1
  108. package/dist/types/parser.d.ts.map +1 -1
  109. package/dist/types/specimen.d.ts +29 -4
  110. package/dist/types/specimen.d.ts.map +1 -1
  111. package/dist/types/types.d.ts +483 -17
  112. package/dist/types/types.d.ts.map +1 -1
  113. package/dist/types/utils/cuid.d.ts +5 -3
  114. package/dist/types/utils/cuid.d.ts.map +1 -1
  115. package/dist/types/utils/environment.d.ts +137 -0
  116. package/dist/types/utils/environment.d.ts.map +1 -0
  117. package/dist/types/utils/migration.d.ts +162 -0
  118. package/dist/types/utils/migration.d.ts.map +1 -0
  119. package/dist/types/validator.d.ts +1 -1
  120. package/dist/types/validator.d.ts.map +1 -1
  121. package/package.json +32 -14
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Environment Detection Utilities
3
+ *
4
+ * This module provides runtime environment detection for selecting
5
+ * appropriate crypto implementations and other environment-specific behavior.
6
+ *
7
+ * @module utils/environment
8
+ * @since 1.2.0
9
+ */
10
+ /**
11
+ * Runtime environment type.
12
+ *
13
+ * @since 1.2.0
14
+ */
15
+ export type RuntimeEnvironment = 'node' | 'browser' | 'webworker' | 'deno' | 'bun' | 'unknown';
16
+ /**
17
+ * Check if running in a server-side Node.js environment.
18
+ *
19
+ * @returns True if running in Node.js, false otherwise
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * if (isServer()) {
24
+ * // Use Node.js crypto module
25
+ * }
26
+ * ```
27
+ *
28
+ * @since 1.2.0
29
+ */
30
+ export declare function isServer(): boolean;
31
+ /**
32
+ * Check if running in a browser environment.
33
+ *
34
+ * @returns True if running in a browser, false otherwise
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * if (isBrowser()) {
39
+ * // Use Web Crypto API
40
+ * }
41
+ * ```
42
+ *
43
+ * @since 1.2.0
44
+ */
45
+ export declare function isBrowser(): boolean;
46
+ /**
47
+ * Check if running in a Web Worker environment.
48
+ *
49
+ * @returns True if running in a Web Worker, false otherwise
50
+ *
51
+ * @since 1.2.0
52
+ */
53
+ export declare function isWebWorker(): boolean;
54
+ /**
55
+ * Check if running in Deno environment.
56
+ *
57
+ * @returns True if running in Deno, false otherwise
58
+ *
59
+ * @since 1.2.0
60
+ */
61
+ export declare function isDeno(): boolean;
62
+ /**
63
+ * Check if running in Bun environment.
64
+ *
65
+ * @returns True if running in Bun, false otherwise
66
+ *
67
+ * @since 1.2.0
68
+ */
69
+ export declare function isBun(): boolean;
70
+ /**
71
+ * Get the current runtime environment.
72
+ *
73
+ * @returns The detected runtime environment
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const env = getRuntimeEnvironment();
78
+ * console.log(`Running in: ${env}`);
79
+ * ```
80
+ *
81
+ * @since 1.2.0
82
+ */
83
+ export declare function getRuntimeEnvironment(): RuntimeEnvironment;
84
+ /**
85
+ * Check if Web Crypto API is available.
86
+ *
87
+ * @returns True if Web Crypto API is available, false otherwise
88
+ *
89
+ * @since 1.2.0
90
+ */
91
+ export declare function supportsWebCrypto(): boolean;
92
+ /**
93
+ * Check if Node.js crypto module is available.
94
+ *
95
+ * Note: This performs a synchronous check and does not actually import the module.
96
+ *
97
+ * @returns True if likely running in Node.js with crypto support, false otherwise
98
+ *
99
+ * @since 1.2.0
100
+ */
101
+ export declare function supportsNodeCrypto(): boolean;
102
+ /**
103
+ * Check if any cryptographic support is available.
104
+ *
105
+ * This is useful for determining if encryption/decryption features can be used.
106
+ *
107
+ * @returns True if crypto is supported, false otherwise
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * if (isCryptoSupported()) {
112
+ * const encrypted = await encryptSpecimen(specimen, { key: password });
113
+ * } else {
114
+ * console.warn('Crypto not supported in this environment');
115
+ * }
116
+ * ```
117
+ *
118
+ * @since 1.2.0
119
+ */
120
+ export declare function isCryptoSupported(): boolean;
121
+ /**
122
+ * Check if TextEncoder/TextDecoder are available.
123
+ *
124
+ * @returns True if text encoding is supported, false otherwise
125
+ *
126
+ * @since 1.2.0
127
+ */
128
+ export declare function supportsTextEncoding(): boolean;
129
+ /**
130
+ * Check if URL and URLSearchParams are available.
131
+ *
132
+ * @returns True if URL APIs are supported, false otherwise
133
+ *
134
+ * @since 1.2.0
135
+ */
136
+ export declare function supportsURLAPIs(): boolean;
137
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/utils/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAM/F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAMlC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAkBrC;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,IAAI,OAAO,CAKhC;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAO1D;AAMD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAMzC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Version Migration Utilities
3
+ *
4
+ * This module provides utilities for comparing WOLS versions and
5
+ * migrating specimens between versions.
6
+ *
7
+ * @module utils/migration
8
+ * @since 1.2.0
9
+ */
10
+ import type { Specimen } from '../types.js';
11
+ /**
12
+ * Version comparison result.
13
+ *
14
+ * - `-1`: First version is older than second
15
+ * - `0`: Versions are equal
16
+ * - `1`: First version is newer than second
17
+ *
18
+ * @since 1.2.0
19
+ */
20
+ export type VersionComparison = -1 | 0 | 1;
21
+ /**
22
+ * Migration handler function signature.
23
+ *
24
+ * @since 1.2.0
25
+ */
26
+ export type MigrationHandler = (specimen: Specimen) => Specimen;
27
+ /**
28
+ * Migration definition.
29
+ *
30
+ * @since 1.2.0
31
+ */
32
+ interface MigrationDefinition {
33
+ from: string;
34
+ to: string;
35
+ handler: MigrationHandler;
36
+ }
37
+ /**
38
+ * Compare two semantic versions.
39
+ *
40
+ * @param a - First version string
41
+ * @param b - Second version string
42
+ * @returns -1 if a < b, 0 if a === b, 1 if a > b
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * compareVersions('1.0.0', '1.1.0') // Returns -1
47
+ * compareVersions('1.1.0', '1.1.0') // Returns 0
48
+ * compareVersions('2.0.0', '1.9.0') // Returns 1
49
+ * ```
50
+ *
51
+ * @since 1.2.0
52
+ */
53
+ export declare function compareVersions(a: string, b: string): VersionComparison;
54
+ /**
55
+ * Check if a specimen is using an outdated WOLS version.
56
+ *
57
+ * @param specimen - Specimen object or version string
58
+ * @returns True if the specimen version is older than current library version
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * isOutdated(specimen) // True if specimen.version < WOLS_VERSION
63
+ * isOutdated('1.0.0') // True (older than current)
64
+ * ```
65
+ *
66
+ * @since 1.2.0
67
+ */
68
+ export declare function isOutdated(specimen: Specimen | string): boolean;
69
+ /**
70
+ * Check if a specimen is using a newer WOLS version than this library.
71
+ *
72
+ * This can happen when specimens are created by a newer library version.
73
+ *
74
+ * @param specimen - Specimen object or version string
75
+ * @returns True if the specimen version is newer than current library version
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * isNewer(specimen) // True if specimen.version > WOLS_VERSION
80
+ * isNewer('2.0.0') // True if library is 1.x
81
+ * ```
82
+ *
83
+ * @since 1.2.0
84
+ */
85
+ export declare function isNewer(specimen: Specimen | string): boolean;
86
+ /**
87
+ * Get the current library WOLS version.
88
+ *
89
+ * @returns The WOLS version this library implements
90
+ *
91
+ * @since 1.2.0
92
+ */
93
+ export declare function getCurrentVersion(): string;
94
+ /**
95
+ * Register a migration handler for upgrading specimens between versions.
96
+ *
97
+ * Migrations are applied in order from oldest to newest when calling `migrate()`.
98
+ *
99
+ * @param from - Source version (e.g., "1.0.0")
100
+ * @param to - Target version (e.g., "1.1.0")
101
+ * @param handler - Function to transform the specimen
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * registerMigration('1.0.0', '1.1.0', (specimen) => {
106
+ * // Add new required field with default value
107
+ * return { ...specimen, newField: 'default' };
108
+ * });
109
+ * ```
110
+ *
111
+ * @since 1.2.0
112
+ */
113
+ export declare function registerMigration(from: string, to: string, handler: MigrationHandler): void;
114
+ /**
115
+ * Check if a specimen can be migrated to the current version.
116
+ *
117
+ * @param specimen - Specimen to check
118
+ * @returns True if migration path exists, false otherwise
119
+ *
120
+ * @since 1.2.0
121
+ */
122
+ export declare function canMigrate(specimen: Specimen): boolean;
123
+ /**
124
+ * Migrate a specimen to the current WOLS version.
125
+ *
126
+ * Applies all registered migrations in order from the specimen's version
127
+ * to the current library version.
128
+ *
129
+ * @param specimen - Specimen to migrate
130
+ * @returns Migrated specimen with updated version
131
+ * @throws Error if no migration path exists
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const oldSpecimen = parseSpecimen(oldJson);
136
+ * if (isOutdated(oldSpecimen)) {
137
+ * const updated = migrate(oldSpecimen);
138
+ * console.log('Migrated to:', updated.version);
139
+ * }
140
+ * ```
141
+ *
142
+ * @since 1.2.0
143
+ */
144
+ export declare function migrate(specimen: Specimen): Specimen;
145
+ /**
146
+ * Get all registered migrations.
147
+ *
148
+ * @returns Array of migration definitions
149
+ *
150
+ * @since 1.2.0
151
+ */
152
+ export declare function getMigrations(): readonly MigrationDefinition[];
153
+ /**
154
+ * Clear all registered migrations.
155
+ *
156
+ * Primarily useful for testing.
157
+ *
158
+ * @since 1.2.0
159
+ */
160
+ export declare function clearMigrations(): void;
161
+ export {};
162
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/utils/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAO5C;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE3C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAEhE;;;;GAIG;AACH,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAgCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAmBvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAG/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAG5D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAK3F;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAiBtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAiCpD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,SAAS,mBAAmB,EAAE,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { type Specimen, type ValidationOptions, type ValidationResult } from './types.js';
9
9
  /**
10
- * Validate a specimen object against the WOLS v1.1.0 schema.
10
+ * Validate a specimen object against the WOLS v1.3.0 schema.
11
11
  *
12
12
  * @param specimen - The specimen object to validate
13
13
  * @param options - Validation options
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAGL,KAAK,QAAQ,EAGb,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,YAAY,CAAC;AAmZpB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,GAAG,OAAO,EAC5B,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB,CA+ClB"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAIL,KAAK,QAAQ,EAGb,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,YAAY,CAAC;AA4fpB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,GAAG,OAAO,EAC5B,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB,CAgDlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wemush/wols",
3
- "version": "0.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Official WOLS (WeMush Open Labeling Standard) library for specimen labeling and traceability",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -8,19 +8,34 @@
8
8
  "types": "./dist/types/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/esm/index.js",
12
- "require": "./dist/cjs/index.js",
13
- "types": "./dist/types/index.d.ts"
11
+ "import": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "default": "./dist/esm/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/cjs/index.d.ts",
17
+ "default": "./dist/cjs/index.js"
18
+ }
14
19
  },
15
20
  "./qr": {
16
- "import": "./dist/esm/qr/index.js",
17
- "require": "./dist/cjs/qr/index.js",
18
- "types": "./dist/types/qr/index.d.ts"
21
+ "import": {
22
+ "types": "./dist/types/qr/index.d.ts",
23
+ "default": "./dist/esm/qr/index.js"
24
+ },
25
+ "require": {
26
+ "types": "./dist/cjs/qr/index.d.ts",
27
+ "default": "./dist/cjs/qr/index.js"
28
+ }
19
29
  },
20
30
  "./crypto": {
21
- "import": "./dist/esm/crypto/index.js",
22
- "require": "./dist/cjs/crypto/index.js",
23
- "types": "./dist/types/crypto/index.d.ts"
31
+ "import": {
32
+ "types": "./dist/types/crypto/index.d.ts",
33
+ "default": "./dist/esm/crypto/index.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/cjs/crypto/index.d.ts",
37
+ "default": "./dist/cjs/crypto/index.js"
38
+ }
24
39
  }
25
40
  },
26
41
  "files": [
@@ -32,18 +47,21 @@
32
47
  "scripts": {
33
48
  "build": "npm run build:esm && npm run build:cjs && npm run build:types",
34
49
  "build:esm": "tsc -p tsconfig.esm.json",
35
- "build:cjs": "tsc -p tsconfig.cjs.json",
50
+ "build:cjs": "tsc -p tsconfig.cjs.json && node scripts/write-cjs-package.mjs",
36
51
  "build:types": "tsc -p tsconfig.types.json",
37
52
  "test": "vitest run",
38
53
  "test:watch": "vitest",
39
54
  "test:coverage": "vitest run --coverage",
55
+ "test:conformance": "vitest run tests/conformance",
56
+ "conformance:update": "node scripts/update-conformance-vectors.mjs",
40
57
  "lint": "eslint src --ext .ts",
41
58
  "lint:fix": "eslint src --ext .ts --fix",
42
59
  "format": "prettier --write \"src/**/*.ts\"",
43
60
  "typecheck": "tsc --noEmit",
44
61
  "bench": "vitest bench",
45
- "prepublishOnly": "npm run build && npm test",
46
- "clean": "rm -rf dist"
62
+ "prepublishOnly": "npm run build && npm test && npm run test:package",
63
+ "clean": "rm -rf dist",
64
+ "test:package": "node scripts/smoke-package.mjs"
47
65
  },
48
66
  "keywords": [
49
67
  "wols",
@@ -68,7 +86,7 @@
68
86
  },
69
87
  "homepage": "https://wemush.com/open-standard",
70
88
  "engines": {
71
- "node": ">=18.0.0"
89
+ "node": ">=20.0.0"
72
90
  },
73
91
  "peerDependencies": {
74
92
  "qrcode": ""