@ndustrial/contxt-sdk 5.7.3 → 5.7.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/package.json +1 -1
- package/support/auth0-cjs-compat.js +19 -0
- package/support/mocharc.yml +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// auth0-js 9.32.0 added "type": "module" to its package.json but its main
|
|
4
|
+
// entry is still a UMD bundle with no ESM exports. Node refuses to require()
|
|
5
|
+
// it on < 22.12. We manually compile the UMD source as CJS via
|
|
6
|
+
// Module._compile, which bypasses the ESM type check, and cache the result.
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const Module = require('module');
|
|
10
|
+
|
|
11
|
+
const auth0Path = require.resolve('auth0-js');
|
|
12
|
+
const auth0Source = fs.readFileSync(auth0Path, 'utf8');
|
|
13
|
+
|
|
14
|
+
const auth0Module = new Module(auth0Path, module);
|
|
15
|
+
auth0Module.filename = auth0Path;
|
|
16
|
+
auth0Module.paths = Module._nodeModulePaths(path.dirname(auth0Path));
|
|
17
|
+
auth0Module._compile(auth0Source, auth0Path);
|
|
18
|
+
|
|
19
|
+
require.cache[auth0Path] = auth0Module;
|