@preference-sl/prefconfigurator-wasm 0.1.57 → 0.1.59-beta.202509291322

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 (31) hide show
  1. package/README.md +5 -9
  2. package/_framework/PrefConfigurator.Abstractions.6lzt7qgexf.wasm +0 -0
  3. package/_framework/PrefConfigurator.Abstractions.6lzt7qgexf.wasm.br +0 -0
  4. package/_framework/PrefConfigurator.Abstractions.6lzt7qgexf.wasm.gz +0 -0
  5. package/_framework/PrefConfigurator.Abstractions.s6id4a28it.wasm +0 -0
  6. package/_framework/PrefConfigurator.Abstractions.s6id4a28it.wasm.br +0 -0
  7. package/_framework/PrefConfigurator.Abstractions.s6id4a28it.wasm.gz +0 -0
  8. package/_framework/PrefConfigurator.Application.0iimu41vgx.wasm +0 -0
  9. package/_framework/PrefConfigurator.Application.0iimu41vgx.wasm.br +0 -0
  10. package/_framework/PrefConfigurator.Application.0iimu41vgx.wasm.gz +0 -0
  11. package/_framework/PrefConfigurator.Application.4bp1xw2vcx.wasm +0 -0
  12. package/_framework/PrefConfigurator.Application.4bp1xw2vcx.wasm.br +0 -0
  13. package/_framework/PrefConfigurator.Application.4bp1xw2vcx.wasm.gz +0 -0
  14. package/_framework/PrefConfigurator.Infrastructure.ghwh3g3pv2.wasm +0 -0
  15. package/_framework/PrefConfigurator.Infrastructure.ghwh3g3pv2.wasm.br +0 -0
  16. package/_framework/PrefConfigurator.Infrastructure.ghwh3g3pv2.wasm.gz +0 -0
  17. package/_framework/PrefConfigurator.Infrastructure.m88dsgskqk.wasm +0 -0
  18. package/_framework/PrefConfigurator.Infrastructure.m88dsgskqk.wasm.br +0 -0
  19. package/_framework/PrefConfigurator.Infrastructure.m88dsgskqk.wasm.gz +0 -0
  20. package/_framework/PrefConfigurator.Wasm.9agkeig53x.wasm +0 -0
  21. package/_framework/PrefConfigurator.Wasm.9agkeig53x.wasm.br +0 -0
  22. package/_framework/PrefConfigurator.Wasm.9agkeig53x.wasm.gz +0 -0
  23. package/_framework/PrefConfigurator.Wasm.hwkfwxuiob.wasm +0 -0
  24. package/_framework/PrefConfigurator.Wasm.hwkfwxuiob.wasm.br +0 -0
  25. package/_framework/PrefConfigurator.Wasm.hwkfwxuiob.wasm.gz +0 -0
  26. package/_framework/blazor.boot.json +9 -9
  27. package/_framework/blazor.boot.json.br +0 -0
  28. package/_framework/blazor.boot.json.gz +0 -0
  29. package/main.js +1 -2
  30. package/package.json +3 -5
  31. package/scripts/postinstall.js +25 -70
package/README.md CHANGED
@@ -1,12 +1,8 @@
1
1
  # prefconfigurator-wasm
2
2
 
3
- Upon install, postinstall copies into the consumer project:
3
+ Upon install, \postinstall\ copies into the consumer project:
4
4
 
5
- - public/preference-sl/prefconfigurator-wasm/_framework
6
- - public/preference-sl/prefconfigurator-wasm/main.js (if not present)
7
- - public/preference-sl/prefconfigurator-wasm/index.demo.html (if not present; example to try it)
8
- - public/preference-sl/prefconfigurator-wasm/ extra JS found under wwwroot (without overwriting existing files)
9
-
10
- Env vars:
11
- - PUBLIC_DIR — destination root (auto-detects public, wwwroot, or src/assets if not set)
12
- - WASM_SUBDIR — subfolder for runtime under the app folder (default _framework)
5
+ - \public/preference-sl/prefconfigurator-wasm/_framework\
6
+ - \public/preference-sl/prefconfigurator-wasm/main.js\ (if not present)
7
+ - \public/preference-sl/prefconfigurator-wasm/index.demo.html\ (if not present)
8
+ - Extra JS under \public/preference-sl/prefconfigurator-wasm/\ (without overwriting)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "mainAssemblyName": "PrefConfigurator.Wasm",
3
3
  "resources": {
4
- "hash": "sha256-qHljwD5eNr5sj/1BPqhjQ4r+l3bsVGLCRh8emtGr1Bw=",
4
+ "hash": "sha256-dIIwO9q3ORPn79hyNXrNZJtAE6gIBtfAq7Srf58bhy4=",
5
5
  "fingerprinting": {
6
6
  "Microsoft.CSharp.soa7iupusj.wasm": "Microsoft.CSharp.wasm",
7
7
  "Microsoft.Extensions.Caching.Abstractions.9tfokavdri.wasm": "Microsoft.Extensions.Caching.Abstractions.wasm",
@@ -34,10 +34,10 @@
34
34
  "Microsoft.Extensions.Options.bzdoshyjeq.wasm": "Microsoft.Extensions.Options.wasm",
35
35
  "Microsoft.Extensions.Primitives.ii8zcoqmmf.wasm": "Microsoft.Extensions.Primitives.wasm",
36
36
  "Newtonsoft.Json.ou6h2ikg0u.wasm": "Newtonsoft.Json.wasm",
37
- "PrefConfigurator.Abstractions.2bryzubrjq.wasm": "PrefConfigurator.Abstractions.wasm",
38
- "PrefConfigurator.Application.rfr8131he7.wasm": "PrefConfigurator.Application.wasm",
39
- "PrefConfigurator.Infrastructure.2kgr0bqncg.wasm": "PrefConfigurator.Infrastructure.wasm",
40
- "PrefConfigurator.Wasm.3353law3tz.wasm": "PrefConfigurator.Wasm.wasm",
37
+ "PrefConfigurator.Abstractions.s6id4a28it.wasm": "PrefConfigurator.Abstractions.wasm",
38
+ "PrefConfigurator.Application.0iimu41vgx.wasm": "PrefConfigurator.Application.wasm",
39
+ "PrefConfigurator.Infrastructure.ghwh3g3pv2.wasm": "PrefConfigurator.Infrastructure.wasm",
40
+ "PrefConfigurator.Wasm.hwkfwxuiob.wasm": "PrefConfigurator.Wasm.wasm",
41
41
  "Preference.Hydra.OpenApi.oba396x8m7.wasm": "Preference.Hydra.OpenApi.wasm",
42
42
  "System.Collections.Concurrent.kq7l3koqtq.wasm": "System.Collections.Concurrent.wasm",
43
43
  "System.Collections.NonGeneric.u4veqqwbpo.wasm": "System.Collections.NonGeneric.wasm",
@@ -134,10 +134,10 @@
134
134
  "Microsoft.Extensions.Options.bzdoshyjeq.wasm": "sha256-OUMXYxUKhNC6l0LAh4xpi+gy+X9b0XXW3pZh9YdZ9C8=",
135
135
  "Microsoft.Extensions.Primitives.ii8zcoqmmf.wasm": "sha256-Jt5QBSXSDEahiZ89Pn1MhJ9A3C/ftN8ZXaBGV9JgqwQ=",
136
136
  "Newtonsoft.Json.ou6h2ikg0u.wasm": "sha256-8EZ4H5Mb5yxuavrUzuw5k75ewxJQbdU+Y1rksETqPVo=",
137
- "PrefConfigurator.Abstractions.2bryzubrjq.wasm": "sha256-QpbFfMMv+aaG/rlM2lu8m1zsTL3OIDGtCsbIfKzvR+U=",
138
- "PrefConfigurator.Application.rfr8131he7.wasm": "sha256-5xkrnBcPpp4gMUuYNO+0vnzag0oFQYafUdzT9V3PbNU=",
139
- "PrefConfigurator.Infrastructure.2kgr0bqncg.wasm": "sha256-kvgzZw6DTpclR84sX9EwaDz3x3tKj6NpAiCmBP76Q30=",
140
- "PrefConfigurator.Wasm.3353law3tz.wasm": "sha256-gWYjTUTWxSSsuYkIT12DMgjl7POv6LIUDQ+ZJd6Ix8U=",
137
+ "PrefConfigurator.Abstractions.s6id4a28it.wasm": "sha256-VKmg2p/yXfU7r8ZsIPMfSfMMPKkfJvqNC8+eozyDFZo=",
138
+ "PrefConfigurator.Application.0iimu41vgx.wasm": "sha256-KEXIrHi0NBNgaz092LvIljwjZHsQ+Dz0G/J27Dtq0tY=",
139
+ "PrefConfigurator.Infrastructure.ghwh3g3pv2.wasm": "sha256-TK7zeguQLSaqMLnvW+V/ZoxvImf732fWInya1+XhqCo=",
140
+ "PrefConfigurator.Wasm.hwkfwxuiob.wasm": "sha256-kbsG/dDDx68FoMVPiRRiC2DfpMc8yz22yA2Qpl5PlJI=",
141
141
  "Preference.Hydra.OpenApi.oba396x8m7.wasm": "sha256-BOitG9XqTGoVdagU40GvNefDuOylKCPs3Gp5VG0M3oY=",
142
142
  "System.Collections.Concurrent.kq7l3koqtq.wasm": "sha256-lDJetX8MOCPfYgq+j+JjNEwEFA9oW7BLaaNmAFUZQaE=",
143
143
  "System.Collections.NonGeneric.u4veqqwbpo.wasm": "sha256-Hlfxail2eLYOSROomwSdgZ3zfxPgxeQCs+6AiZn4uBE=",
Binary file
Binary file
package/main.js CHANGED
@@ -1,3 +1,2 @@
1
- // Expose relative path to packaged _framework (optional helper)
2
- const path = require("path");
1
+ const path = require("path");
3
2
  module.exports = { frameworkPath: path.join(__dirname, "_framework") };
package/package.json CHANGED
@@ -3,14 +3,12 @@
3
3
  "postinstall": "node scripts/postinstall.js"
4
4
  },
5
5
  "description": ".NET WebAssembly runtime package that centralizes logic for building product configurators, exposing a simple API for integration into ecommerce platforms.",
6
- "version": "0.1.57",
6
+ "version": "0.1.59-beta.202509291322",
7
7
  "files": [
8
8
  "_framework/**",
9
- "scripts/**",
10
- "main.js",
9
+ "**/*.js",
11
10
  "index.html",
12
- "README.md",
13
- "**/*.js"
11
+ "README.md"
14
12
  ],
15
13
  "author": "Alex Moreno Palacio \u003camoreno@preference.es\u003e",
16
14
  "name": "@preference-sl/prefconfigurator-wasm",
@@ -1,101 +1,56 @@
1
1
  "use strict";
2
- /* eslint-disable no-console */
3
2
  const fs = require("fs");
4
3
  const path = require("path");
5
4
 
6
- function walkDir(root, onFile) {
7
- const stack = [root];
8
- while (stack.length) {
9
- const dir = stack.pop();
10
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
11
- const abs = path.join(dir, entry.name);
12
- if (entry.isDirectory()) stack.push(abs);
13
- else if (entry.isFile()) onFile(abs);
14
- }
15
- }
16
- }
17
-
18
- function ensureDir(p) {
19
- fs.mkdirSync(path.dirname(p), { recursive: true });
20
- }
21
-
22
- function copyFileIfAbsent(src, dest) {
23
- if (!fs.existsSync(dest)) {
24
- ensureDir(dest);
25
- fs.copyFileSync(src, dest);
26
- }
27
- }
5
+ function walk(root, cb){ const st=[root]; while(st.length){ const d=st.pop(); for(const e of fs.readdirSync(d,{withFileTypes:true})){ const a=path.join(d,e.name); if(e.isDirectory()) st.push(a); else if(e.isFile()) cb(a); }}}
6
+ function ensureDir(p){ fs.mkdirSync(path.dirname(p), { recursive: true }); }
7
+ function copyIfAbsent(src,dst){ if(!fs.existsSync(dst)){ ensureDir(dst); fs.copyFileSync(src,dst); } }
28
8
 
29
- try {
9
+ try{
30
10
  const pkgRoot = __dirname ? path.resolve(__dirname, "..") : process.cwd();
31
11
  const srcFramework = path.join(pkgRoot, "_framework");
32
- const srcMainJs = path.join(pkgRoot, "main.js");
33
- const srcIndexHtml = path.join(pkgRoot, "index.html");
34
-
12
+ const srcMain = path.join(pkgRoot, "main.js");
13
+ const srcIndex = path.join(pkgRoot, "index.html");
35
14
  const consumerRoot = process.env.INIT_CWD || process.env.npm_config_local_prefix || process.cwd();
36
15
 
37
16
  const candidates = [process.env.PUBLIC_DIR, "public", "wwwroot", path.join("src","assets")].filter(Boolean);
38
17
  let targetPublic = null;
39
- for (const c of candidates) {
18
+ for (const c of candidates){
40
19
  const abs = path.isAbsolute(c) ? c : path.resolve(consumerRoot, c);
41
20
  if (fs.existsSync(abs)) { targetPublic = abs; break; }
42
21
  }
43
22
  if (!targetPublic) targetPublic = path.resolve(consumerRoot, "public");
44
23
 
45
- // Siempre bajo public/preference-sl/<nombrepaquete>, y <nombrepaquete> en minúsculas
46
24
  const packageName = "prefconfigurator-wasm".toLowerCase();
47
- const preferenceNamespace = "preference-sl";
48
- const destRoot = path.join(targetPublic, preferenceNamespace, packageName);
25
+ const ns = "preference-sl";
26
+ const destRoot = path.join(targetPublic, ns, packageName);
49
27
 
50
28
  const wasmSubdir = process.env.WASM_SUBDIR || "_framework";
51
29
  const destFramework = path.join(destRoot, wasmSubdir);
52
30
 
53
- // 1) Copiar runtime
54
- console.log(`[${path.basename(pkgRoot)}] Copying WASM -> ${destFramework}`);
55
- (function copyRecursive(src, dest) {
56
- if (!fs.existsSync(src)) return;
57
- fs.mkdirSync(dest, { recursive: true });
58
- for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
59
- const s = path.join(src, entry.name);
60
- const d = path.join(dest, entry.name);
61
- if (entry.isDirectory()) copyRecursive(s, d);
62
- else if (entry.isFile()) fs.copyFileSync(s, d);
63
- }
64
- })(srcFramework, destFramework);
31
+ // 1) Runtime
32
+ (function copyR(src,dst){ if(!fs.existsSync(src)) return; fs.mkdirSync(dst,{recursive:true});
33
+ for(const e of fs.readdirSync(src,{withFileTypes:true})){ const s=path.join(src,e.name); const d=path.join(dst,e.name);
34
+ if(e.isDirectory()) copyR(s,d); else if(e.isFile()) fs.copyFileSync(s,d);
35
+ }})(srcFramework, destFramework);
65
36
 
66
37
  // 2) main.js (no overwrite)
67
- const destMainJs = path.join(destRoot, "main.js");
68
- if (fs.existsSync(srcMainJs) && !fs.existsSync(destMainJs)) {
69
- fs.mkdirSync(destRoot, { recursive: true });
70
- fs.copyFileSync(srcMainJs, destMainJs);
71
- console.log(`[${path.basename(pkgRoot)}] Installed main.js at ${destMainJs}`);
72
- }
38
+ const destMain = path.join(destRoot, "main.js");
39
+ if (fs.existsSync(srcMain) && !fs.existsSync(destMain)){ fs.mkdirSync(destRoot,{recursive:true}); fs.copyFileSync(srcMain, destMain); }
73
40
 
74
41
  // 3) index.html -> index.demo.html (no overwrite)
75
- const destIndexDemo = path.join(destRoot, "index.demo.html");
76
- if (fs.existsSync(srcIndexHtml) && !fs.existsSync(destIndexDemo)) {
77
- fs.mkdirSync(destRoot, { recursive: true });
78
- fs.copyFileSync(srcIndexHtml, destIndexDemo);
79
- console.log(`[${path.basename(pkgRoot)}] Installed index.demo.html at ${destIndexDemo}`);
80
- }
81
-
82
- // 4) Copiar TODOS los .js fuera de _framework y sin sobreescribir, preservando estructura.
83
- console.log(`[${path.basename(pkgRoot)}] Copying extra JS -> ${destRoot}`);
84
- const excludeAbs = new Set([
85
- path.join(pkgRoot, "main.js"),
86
- path.join(pkgRoot, "index.html"),
87
- path.join(pkgRoot, "scripts", "postinstall.js"),
88
- ]);
42
+ const destDemo = path.join(destRoot, "index.demo.html");
43
+ if (fs.existsSync(srcIndex) && !fs.existsSync(destDemo)){ fs.mkdirSync(destRoot,{recursive:true}); fs.copyFileSync(srcIndex, destDemo); }
89
44
 
90
- walkDir(pkgRoot, (abs) => {
45
+ // 4) Extra JS fuera de _framework, sin sobrescribir
46
+ const exclude = new Set([ path.join(pkgRoot,"main.js"), path.join(pkgRoot,"index.html"), path.join(pkgRoot,"scripts","postinstall.js") ]);
47
+ walk(pkgRoot, (abs)=>{
91
48
  if (!abs.toLowerCase().endsWith(".js")) return;
92
49
  if (abs.startsWith(path.join(pkgRoot, "_framework"))) return;
93
- if (excludeAbs.has(abs)) return;
94
-
95
- const rel = path.relative(pkgRoot, abs); // p.e. "js/util.js" o "extras/foo/bar.js"
96
- const dest = path.join(destRoot, rel);
97
- copyFileIfAbsent(abs, dest);
50
+ if (exclude.has(abs)) return;
51
+ const rel = path.relative(pkgRoot, abs);
52
+ copyIfAbsent(abs, path.join(destRoot, rel));
98
53
  });
99
- } catch (err) {
54
+ } catch (err){
100
55
  console.warn(`[postinstall] Warning: copy failed: ${err && (err.message || err)}`);
101
56
  }