@inkandswitch/patchwork 0.3.1 → 0.3.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/CHANGELOG.md +15 -0
- package/dist/vite/importmap-plugin.js +22 -1
- package/package.json +4 -4
- package/src/vite/importmap-plugin.ts +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @inkandswitch/patchwork
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [eed5a2c]
|
|
8
|
+
- @inkandswitch/patchwork-providers@0.5.0
|
|
9
|
+
- @inkandswitch/patchwork-elements@6.0.0
|
|
10
|
+
- @inkandswitch/patchwork-bootloader@0.5.4
|
|
11
|
+
|
|
12
|
+
## 0.3.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 5fbc712: Prebundle development import-map dependencies so dynamically loaded packages share module singletons and receive Vite's CommonJS interop.
|
|
17
|
+
|
|
3
18
|
## 0.3.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -37,11 +37,32 @@ function createImportMap(options) {
|
|
|
37
37
|
Object.assign(importmap.imports, builtins);
|
|
38
38
|
return { importmap, builtins };
|
|
39
39
|
}
|
|
40
|
+
function devDependencyId(id) {
|
|
41
|
+
if (id === "@inkandswitch/patchwork")
|
|
42
|
+
return id;
|
|
43
|
+
if (id === "@inkandswitch/patchwork-bootloader") {
|
|
44
|
+
return `@inkandswitch/patchwork > ${id}`;
|
|
45
|
+
}
|
|
46
|
+
return `@inkandswitch/patchwork > @inkandswitch/patchwork-bootloader > ${id}`;
|
|
47
|
+
}
|
|
40
48
|
export function importmap(options) {
|
|
41
49
|
const { importmap, builtins } = createImportMap(options);
|
|
50
|
+
let serve = false;
|
|
42
51
|
return {
|
|
43
52
|
name: "@patchwork/vite",
|
|
53
|
+
config() {
|
|
54
|
+
return {
|
|
55
|
+
optimizeDeps: {
|
|
56
|
+
include: Object.keys(builtins).map(devDependencyId),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
configResolved(config) {
|
|
61
|
+
serve = config.command === "serve";
|
|
62
|
+
},
|
|
44
63
|
async buildStart() {
|
|
64
|
+
if (serve)
|
|
65
|
+
return;
|
|
45
66
|
for (const [id, fileName] of Object.entries(builtins)) {
|
|
46
67
|
this.emitFile({
|
|
47
68
|
type: "chunk",
|
|
@@ -70,7 +91,7 @@ export function importmap(options) {
|
|
|
70
91
|
const activeImportmap = structuredClone(importmap);
|
|
71
92
|
if (context.server) {
|
|
72
93
|
for (const id of Object.keys(builtins)) {
|
|
73
|
-
activeImportmap.imports[id] = `/@id/${id}`;
|
|
94
|
+
activeImportmap.imports[id] = `/@id/${devDependencyId(id)}`;
|
|
74
95
|
}
|
|
75
96
|
}
|
|
76
97
|
return {
|
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.
|
|
8
|
+
"version": "0.3.3",
|
|
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.4",
|
|
46
|
+
"@inkandswitch/patchwork-elements": "^6.0.0",
|
|
45
47
|
"@inkandswitch/patchwork-filesystem": "^0.2.5",
|
|
46
|
-
"@inkandswitch/patchwork-elements": "^5.0.0",
|
|
47
48
|
"@inkandswitch/patchwork-plugins": "^1.1.0",
|
|
48
|
-
"@inkandswitch/patchwork-providers": "^0.
|
|
49
|
-
"@inkandswitch/patchwork-bootloader": "^0.5.3"
|
|
49
|
+
"@inkandswitch/patchwork-providers": "^0.5.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"esbuild": "^0.23.1",
|
|
@@ -65,11 +65,31 @@ function createImportMap(options?: PatchworkVitePluginOptions) {
|
|
|
65
65
|
return { importmap, builtins };
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function devDependencyId(id: string): string {
|
|
69
|
+
if (id === "@inkandswitch/patchwork") return id;
|
|
70
|
+
if (id === "@inkandswitch/patchwork-bootloader") {
|
|
71
|
+
return `@inkandswitch/patchwork > ${id}`;
|
|
72
|
+
}
|
|
73
|
+
return `@inkandswitch/patchwork > @inkandswitch/patchwork-bootloader > ${id}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
export function importmap(options?: PatchworkVitePluginOptions): Plugin {
|
|
69
77
|
const { importmap, builtins } = createImportMap(options);
|
|
78
|
+
let serve = false;
|
|
70
79
|
return {
|
|
71
80
|
name: "@patchwork/vite",
|
|
81
|
+
config() {
|
|
82
|
+
return {
|
|
83
|
+
optimizeDeps: {
|
|
84
|
+
include: Object.keys(builtins).map(devDependencyId),
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
configResolved(config) {
|
|
89
|
+
serve = config.command === "serve";
|
|
90
|
+
},
|
|
72
91
|
async buildStart() {
|
|
92
|
+
if (serve) return;
|
|
73
93
|
for (const [id, fileName] of Object.entries(builtins)) {
|
|
74
94
|
this.emitFile({
|
|
75
95
|
type: "chunk",
|
|
@@ -99,7 +119,7 @@ export function importmap(options?: PatchworkVitePluginOptions): Plugin {
|
|
|
99
119
|
const activeImportmap = structuredClone(importmap);
|
|
100
120
|
if (context.server) {
|
|
101
121
|
for (const id of Object.keys(builtins)) {
|
|
102
|
-
activeImportmap.imports[id] = `/@id/${id}`;
|
|
122
|
+
activeImportmap.imports[id] = `/@id/${devDependencyId(id)}`;
|
|
103
123
|
}
|
|
104
124
|
}
|
|
105
125
|
return {
|