vaderjs 1.8.8 → 1.9.0
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/bundler/index.js +20 -7
- package/main.js +2 -2
- package/package.json +1 -1
package/bundler/index.js
CHANGED
|
@@ -33,6 +33,22 @@ globalThis.document = {
|
|
|
33
33
|
getElementById: (id) => { },
|
|
34
34
|
querySelector: (query) => { },
|
|
35
35
|
};
|
|
36
|
+
globalThis.window = {
|
|
37
|
+
addEventListener: (event, cb) => { },
|
|
38
|
+
removeEventListener: (event, cb) => { },
|
|
39
|
+
localStorage: {
|
|
40
|
+
setItem: (key, value) => { },
|
|
41
|
+
getItem: (key) => { },
|
|
42
|
+
},
|
|
43
|
+
sessionStorage: {
|
|
44
|
+
setItem: (key, value) => { },
|
|
45
|
+
getItem: (key) => { },
|
|
46
|
+
},
|
|
47
|
+
location: {
|
|
48
|
+
href: "",
|
|
49
|
+
pathname: "",
|
|
50
|
+
},
|
|
51
|
+
}
|
|
36
52
|
try {
|
|
37
53
|
await Bun.build({
|
|
38
54
|
entrypoints: [process.env.ENTRYPOINT],
|
|
@@ -177,21 +193,18 @@ const generatePage = async (
|
|
|
177
193
|
|
|
178
194
|
|
|
179
195
|
|
|
180
|
-
|
|
181
|
-
h = h.replace("<head>", `<head>${process.env.bindes}`)
|
|
182
|
-
} else {
|
|
183
|
-
h += process.env.bindes
|
|
184
|
-
}
|
|
185
|
-
|
|
196
|
+
|
|
186
197
|
await Bun.write(
|
|
187
198
|
process.cwd() + "/dist/" + route + "/index.html",
|
|
188
199
|
`<!DOCTYPE html>
|
|
200
|
+
|
|
201
|
+
${process.env.bindes}
|
|
189
202
|
${h}
|
|
190
203
|
<script type="module">
|
|
191
204
|
import c from '${process.env.filePath}'
|
|
192
205
|
import {render, e} from '/src/vader/index.js'
|
|
193
206
|
window.e = e
|
|
194
|
-
render(c, document.body
|
|
207
|
+
render(c, document.body)
|
|
195
208
|
</script>
|
|
196
209
|
`
|
|
197
210
|
);
|
package/main.js
CHANGED
|
@@ -179,8 +179,8 @@ const handleReplacements = (code) => {
|
|
|
179
179
|
return c
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
if (!fs.existsSync(process.cwd() + '/dev/bundler.js')) {
|
|
183
|
-
|
|
182
|
+
if (!fs.existsSync(process.cwd() + '/dev/bundler.js')) {
|
|
183
|
+
fs.mkdirSync(process.cwd() + '/dev', { recursive: true })
|
|
184
184
|
fs.copyFileSync(require.resolve('vaderjs/bundler/index.js'), process.cwd() + '/dev/bundler.js')
|
|
185
185
|
}
|
|
186
186
|
let start = Date.now()
|