@areb0s/scip.js 1.0.6 → 1.0.8

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/scip.js CHANGED
@@ -1,34 +1,15 @@
1
1
 
2
- // Polyfill for import.meta.url in IIFE context (supports Worker & SSR)
2
+ // Polyfill for import.meta.url in IIFE context
3
+ // Always use CDN as the base URL for WASM loading
3
4
  var __importMetaUrl = (function() {
4
5
  var CDN_BASE = 'https://cdn.jsdelivr.net/gh/areb0s/scip.js/dist/scip.min.js';
5
6
 
6
7
  // Check for explicit SCIP_BASE_URL first
7
8
  if (typeof SCIP_BASE_URL !== 'undefined' && SCIP_BASE_URL) {
8
- return SCIP_BASE_URL + 'scip.min.js';
9
+ return SCIP_BASE_URL + (SCIP_BASE_URL.endsWith('/') ? '' : '/') + 'scip.min.js';
9
10
  }
10
11
 
11
- // Worker environment
12
- if (typeof WorkerGlobalScope !== 'undefined' && typeof self !== 'undefined' && self instanceof WorkerGlobalScope) {
13
- return self.location.href || CDN_BASE;
14
- }
15
-
16
- // Browser main thread
17
- if (typeof document !== 'undefined' && typeof window !== 'undefined') {
18
- if (document.currentScript && document.currentScript.src) {
19
- return document.currentScript.src;
20
- }
21
- var scripts = document.getElementsByTagName('script');
22
- for (var i = scripts.length - 1; i >= 0; i--) {
23
- var src = scripts[i].src;
24
- if (src && (src.includes('scip') && src.includes('.js'))) {
25
- return src;
26
- }
27
- }
28
- return window.location.href;
29
- }
30
-
31
- // SSR or unknown environment - use CDN
12
+ // Always return CDN - this ensures WASM is loaded from CDN
32
13
  return CDN_BASE;
33
14
  })();
34
15
 
@@ -3213,16 +3194,16 @@ var SCIPModule = (() => {
3213
3194
  return __toCommonJS(scip_browser_exports);
3214
3195
  })();
3215
3196
 
3216
- // Expose SCIP globally
3217
- if (typeof window !== 'undefined') {
3218
- window.SCIP = SCIPModule.default || SCIPModule;
3219
- // Also expose named exports
3220
- if (SCIPModule.init) window.SCIP.init = SCIPModule.init;
3221
- if (SCIPModule.solve) window.SCIP.solve = SCIPModule.solve;
3222
- if (SCIPModule.minimize) window.SCIP.minimize = SCIPModule.minimize;
3223
- if (SCIPModule.maximize) window.SCIP.maximize = SCIPModule.maximize;
3224
- if (SCIPModule.version) window.SCIP.version = SCIPModule.version;
3225
- if (SCIPModule.Status) window.SCIP.Status = SCIPModule.Status;
3226
- }
3197
+ // Expose SCIP globally (works in Worker, Browser, Node.js)
3198
+ (function(g) {
3199
+ g.SCIP = SCIPModule.default || SCIPModule;
3200
+ if (SCIPModule.init) g.SCIP.init = SCIPModule.init;
3201
+ if (SCIPModule.solve) g.SCIP.solve = SCIPModule.solve;
3202
+ if (SCIPModule.minimize) g.SCIP.minimize = SCIPModule.minimize;
3203
+ if (SCIPModule.maximize) g.SCIP.maximize = SCIPModule.maximize;
3204
+ if (SCIPModule.version) g.SCIP.version = SCIPModule.version;
3205
+ if (SCIPModule.Status) g.SCIP.Status = SCIPModule.Status;
3206
+ if (SCIPModule.ready) g.SCIP.ready = SCIPModule.ready;
3207
+ })(typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : globalThis);
3227
3208
 
3228
3209
  //# sourceMappingURL=scip.js.map