@inkandswitch/patchwork 0.3.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @inkandswitch/patchwork
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 896fa22: Resolve built-in import-map packages through Vite during development so the site and dynamically loaded tools share module singletons.
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
@@ -66,14 +66,20 @@ export function importmap(options) {
66
66
  },
67
67
  transformIndexHtml: {
68
68
  order: "pre",
69
- handler(html) {
69
+ handler(html, context) {
70
+ const activeImportmap = structuredClone(importmap);
71
+ if (context.server) {
72
+ for (const id of Object.keys(builtins)) {
73
+ activeImportmap.imports[id] = `/@id/${id}`;
74
+ }
75
+ }
70
76
  return {
71
77
  html,
72
78
  tags: [
73
79
  {
74
80
  tag: "script",
75
81
  attrs: { type: "importmap" },
76
- children: JSON.stringify(importmap, null, 2),
82
+ children: JSON.stringify(activeImportmap, null, 2),
77
83
  },
78
84
  ],
79
85
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/inkandswitch/patchwork-system.git",
6
6
  "directory": "core/patchwork"
7
7
  },
8
- "version": "0.3.0",
8
+ "version": "0.3.1",
9
9
  "author": "Ink & Switch",
10
10
  "type": "module",
11
11
  "license": "MIT",
@@ -42,11 +42,11 @@
42
42
  "debug": "^4.4.3",
43
43
  "sharp": "^0.35.3",
44
44
  "vite-plugin-wasm": "^3.6.0",
45
- "@inkandswitch/patchwork-bootloader": "^0.5.3",
45
+ "@inkandswitch/patchwork-filesystem": "^0.2.5",
46
46
  "@inkandswitch/patchwork-elements": "^5.0.0",
47
47
  "@inkandswitch/patchwork-plugins": "^1.1.0",
48
- "@inkandswitch/patchwork-filesystem": "^0.2.5",
49
- "@inkandswitch/patchwork-providers": "^0.4.2"
48
+ "@inkandswitch/patchwork-providers": "^0.4.2",
49
+ "@inkandswitch/patchwork-bootloader": "^0.5.3"
50
50
  },
51
51
  "devDependencies": {
52
52
  "esbuild": "^0.23.1",
@@ -95,14 +95,20 @@ export function importmap(options?: PatchworkVitePluginOptions): Plugin {
95
95
  },
96
96
  transformIndexHtml: {
97
97
  order: "pre",
98
- handler(html) {
98
+ handler(html, context) {
99
+ const activeImportmap = structuredClone(importmap);
100
+ if (context.server) {
101
+ for (const id of Object.keys(builtins)) {
102
+ activeImportmap.imports[id] = `/@id/${id}`;
103
+ }
104
+ }
99
105
  return {
100
106
  html,
101
107
  tags: [
102
108
  {
103
109
  tag: "script",
104
110
  attrs: { type: "importmap" },
105
- children: JSON.stringify(importmap, null, 2),
111
+ children: JSON.stringify(activeImportmap, null, 2),
106
112
  },
107
113
  ],
108
114
  };