@paciolan/remote-module-loader 3.2.2 → 3.2.3
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 +16 -0
- package/dist/lib/loadRemoteModule.d.ts +1 -0
- package/dist/lib/loadRemoteModule.js +12 -1
- package/dist/lib/loadRemoteModule.js.map +1 -1
- package/gl-sast-report.json +4 -4
- package/gl-sbom-npm-npm.cdx.json +8 -8
- package/gl-secret-detection-report.json +16 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -140,6 +140,22 @@ main();
|
|
|
140
140
|
|
|
141
141
|
Remote modules can be in CommonJS, AMD, or UMD format. The loader provides both `require`/`module`/`exports` (CommonJS) and `define` (AMD) to every module, so the module itself determines which format to use.
|
|
142
142
|
|
|
143
|
+
### Specifying the module format
|
|
144
|
+
|
|
145
|
+
The `type` option tells the loader which format the remote module is in:
|
|
146
|
+
|
|
147
|
+
| `type` | Loads |
|
|
148
|
+
|--------|-------|
|
|
149
|
+
| `"amd"` (default) | AMD modules |
|
|
150
|
+
| `"cjs"` | CommonJS modules |
|
|
151
|
+
| `"umd"` | UMD modules |
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
const loadRemoteModule = createLoadRemoteModule({ type: "umd" });
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use `"cjs"` or `"umd"` when loading a CommonJS or UMD bundle that embeds UMD dependencies (for example, a Vite 8 library build that bundles lodash), which can otherwise fail under the default `"amd"` behavior. See [issue #39](https://github.com/Paciolan/remote-module-loader/issues/39).
|
|
158
|
+
|
|
143
159
|
### CommonJS
|
|
144
160
|
|
|
145
161
|
```javascript
|
|
@@ -14,12 +14,23 @@ const defaultFetcher = isBrowser ? index_1.default : nodeFetcher_1.default;
|
|
|
14
14
|
const defaultRequires = (name) => {
|
|
15
15
|
throw new Error(`Could not require '${name}'. The 'requires' function was not provided.`);
|
|
16
16
|
};
|
|
17
|
-
const createLoadRemoteModule = ({ requires, fetcher } = {}) => {
|
|
17
|
+
const createLoadRemoteModule = ({ requires, fetcher, type } = {}) => {
|
|
18
18
|
const _requires = requires || defaultRequires;
|
|
19
19
|
const _fetcher = fetcher || defaultFetcher;
|
|
20
20
|
return (0, memoize_1.default)((url) => _fetcher(url).then(data => {
|
|
21
21
|
const exports = {};
|
|
22
22
|
const module = { exports };
|
|
23
|
+
// "cjs" and "umd" keep `define` out of scope entirely. A UMD wrapper
|
|
24
|
+
// then resolves through its CommonJS branch instead of registering via
|
|
25
|
+
// `define`, which also fixes CJS bundles that embed a UMD dependency
|
|
26
|
+
// (an injected `define` would otherwise hijack the dependency's exports;
|
|
27
|
+
// GitHub issue #39). "umd" is handled identically to "cjs"; it exists as
|
|
28
|
+
// a separate option only to read clearly at the call site.
|
|
29
|
+
if (type === "cjs" || type === "umd") {
|
|
30
|
+
const func = new Function("require", "module", "exports", data);
|
|
31
|
+
func(_requires, module, exports);
|
|
32
|
+
return module.exports;
|
|
33
|
+
}
|
|
23
34
|
const define = (...args) => {
|
|
24
35
|
let factory;
|
|
25
36
|
let deps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRemoteModule.js","sourceRoot":"","sources":["../../src/lib/loadRemoteModule.ts"],"names":[],"mappings":";;;;;;AACA,wDAAgC;AAChC,gEAAwC;AACxC,0EAAkE;AAElE,kDAAkD;AAClD,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAE1E,8CAA8C;AAC9C,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,eAAqB,CAAC,CAAC,CAAC,qBAAW,CAAC;AAEvE,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;IACvC,MAAM,IAAI,KAAK,CACb,sBAAsB,IAAI,8CAA8C,CACzE,CAAC;AACJ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"loadRemoteModule.js","sourceRoot":"","sources":["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,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,sBAAsB,0BAqDjC"}
|
package/gl-sast-report.json
CHANGED
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"version": "1.145.0"
|
|
20
20
|
},
|
|
21
21
|
"type": "sast",
|
|
22
|
-
"start_time": "2026-
|
|
23
|
-
"end_time": "2026-
|
|
22
|
+
"start_time": "2026-06-15T22:43:11",
|
|
23
|
+
"end_time": "2026-06-15T22:43:27",
|
|
24
24
|
"status": "success",
|
|
25
25
|
"observability": {
|
|
26
26
|
"events": [
|
|
27
27
|
{
|
|
28
28
|
"event": "collect_sast_scan_metrics_from_pipeline",
|
|
29
|
-
"property": "
|
|
29
|
+
"property": "4eaa9fdd-b811-4e3a-859d-af986958d9b4",
|
|
30
30
|
"label": "semgrep",
|
|
31
31
|
"value": 0,
|
|
32
32
|
"version": "6.14.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"override_count": 0,
|
|
35
35
|
"passthrough_count": 4,
|
|
36
36
|
"custom_exclude_path_count": 0,
|
|
37
|
-
"time_s":
|
|
37
|
+
"time_s": 15,
|
|
38
38
|
"file_count": 19
|
|
39
39
|
}
|
|
40
40
|
]
|
package/gl-sbom-npm-npm.cdx.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.4",
|
|
4
|
-
"serialNumber": "urn:uuid:
|
|
4
|
+
"serialNumber": "urn:uuid:f9759b7c-ad86-4c7e-971a-95fe960c0125",
|
|
5
5
|
"version": 1,
|
|
6
6
|
"metadata": {
|
|
7
|
-
"timestamp": "2026-
|
|
7
|
+
"timestamp": "2026-06-15T22:43:12Z",
|
|
8
8
|
"tools": [
|
|
9
9
|
{
|
|
10
10
|
"vendor": "GitLab",
|
|
@@ -463,10 +463,10 @@
|
|
|
463
463
|
},
|
|
464
464
|
{
|
|
465
465
|
"name": "@babel/plugin-transform-modules-systemjs",
|
|
466
|
-
"version": "7.29.
|
|
467
|
-
"purl": "pkg:npm/%40babel/plugin-transform-modules-systemjs@7.29.
|
|
466
|
+
"version": "7.29.4",
|
|
467
|
+
"purl": "pkg:npm/%40babel/plugin-transform-modules-systemjs@7.29.4",
|
|
468
468
|
"type": "library",
|
|
469
|
-
"bom-ref": "pkg:npm/%40babel/plugin-transform-modules-systemjs@7.29.
|
|
469
|
+
"bom-ref": "pkg:npm/%40babel/plugin-transform-modules-systemjs@7.29.4"
|
|
470
470
|
},
|
|
471
471
|
{
|
|
472
472
|
"name": "@babel/plugin-transform-modules-umd",
|
|
@@ -1611,10 +1611,10 @@
|
|
|
1611
1611
|
},
|
|
1612
1612
|
{
|
|
1613
1613
|
"name": "fast-uri",
|
|
1614
|
-
"version": "3.1.
|
|
1615
|
-
"purl": "pkg:npm/fast-uri@3.1.
|
|
1614
|
+
"version": "3.1.2",
|
|
1615
|
+
"purl": "pkg:npm/fast-uri@3.1.2",
|
|
1616
1616
|
"type": "library",
|
|
1617
|
-
"bom-ref": "pkg:npm/fast-uri@3.1.
|
|
1617
|
+
"bom-ref": "pkg:npm/fast-uri@3.1.2"
|
|
1618
1618
|
},
|
|
1619
1619
|
{
|
|
1620
1620
|
"name": "file-entry-cache",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"vendor": {
|
|
8
8
|
"name": "GitLab"
|
|
9
9
|
},
|
|
10
|
-
"version": "7.
|
|
10
|
+
"version": "7.36.0"
|
|
11
11
|
},
|
|
12
12
|
"scanner": {
|
|
13
13
|
"id": "gitleaks",
|
|
@@ -16,25 +16,33 @@
|
|
|
16
16
|
"vendor": {
|
|
17
17
|
"name": "GitLab"
|
|
18
18
|
},
|
|
19
|
-
"version": "8.30.
|
|
19
|
+
"version": "8.30.1"
|
|
20
20
|
},
|
|
21
21
|
"type": "secret_detection",
|
|
22
|
-
"start_time": "2026-
|
|
23
|
-
"end_time": "2026-
|
|
22
|
+
"start_time": "2026-06-15T22:43:13",
|
|
23
|
+
"end_time": "2026-06-15T22:43:14",
|
|
24
24
|
"status": "success",
|
|
25
25
|
"observability": {
|
|
26
26
|
"events": [
|
|
27
27
|
{
|
|
28
28
|
"event": "collect_secrets_analyzer_scan_metrics_from_pipeline",
|
|
29
|
-
"time_s": 0.
|
|
29
|
+
"time_s": 0.692676816,
|
|
30
30
|
"exit_code": 0,
|
|
31
31
|
"git_strategy": "FetchNone",
|
|
32
|
-
"repo_size_kb":
|
|
33
|
-
"bytes_scanned":
|
|
32
|
+
"repo_size_kb": 732,
|
|
33
|
+
"bytes_scanned": 46807
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"event": "collect_secrets_analyzer_ruleset_adoption_metrics_from_pipeline",
|
|
37
|
+
"custom_ruleset": false,
|
|
38
|
+
"passthrough_types": null,
|
|
39
|
+
"passthrough_count": 0,
|
|
40
|
+
"passthrough_auth_used": false,
|
|
41
|
+
"rules_version": "0.24.3"
|
|
34
42
|
}
|
|
35
43
|
]
|
|
36
44
|
}
|
|
37
45
|
},
|
|
38
|
-
"version": "15.2.
|
|
46
|
+
"version": "15.2.4",
|
|
39
47
|
"vulnerabilities": []
|
|
40
48
|
}
|