vaderjs 2.1.1 → 2.1.2
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 +29 -1
- package/package.json +1 -1
package/bundler/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import ansiColors from "ansi-colors";
|
|
|
13
13
|
import path from "path";
|
|
14
14
|
let path2 = require("path");
|
|
15
15
|
globalThis.Fragment = Fragment;
|
|
16
|
+
|
|
16
17
|
globalThis.window = {
|
|
17
18
|
location: {
|
|
18
19
|
hash: "",
|
|
@@ -31,7 +32,20 @@ globalThis.genKey = () => {
|
|
|
31
32
|
globalThis.document = {
|
|
32
33
|
createElement: (tag) => { },
|
|
33
34
|
getElementById: (id) => { },
|
|
34
|
-
querySelector: (query) => {
|
|
35
|
+
querySelector: (query) => {
|
|
36
|
+
return Object.create({
|
|
37
|
+
addEventListener: (event, cb) => { },
|
|
38
|
+
removeEventListener: (event, cb) => { },
|
|
39
|
+
innerHTML: "",
|
|
40
|
+
appendChild: (child) => { },
|
|
41
|
+
removeChild: (child) => { },
|
|
42
|
+
src: "",
|
|
43
|
+
style: {},
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
querySelectorAll: (query) => {
|
|
47
|
+
return []
|
|
48
|
+
},
|
|
35
49
|
};
|
|
36
50
|
globalThis.window = {
|
|
37
51
|
addEventListener: (event, cb) => { },
|
|
@@ -58,6 +72,7 @@ try {
|
|
|
58
72
|
format: "esm",
|
|
59
73
|
...(process.env.DEV ? { sourcemap: "inline" } : {}),
|
|
60
74
|
packages: "bundle",
|
|
75
|
+
env: "inline",
|
|
61
76
|
external: ["vaderjs"]
|
|
62
77
|
});
|
|
63
78
|
} catch (error) {
|
|
@@ -149,6 +164,19 @@ const handleReplacements = (code) => {
|
|
|
149
164
|
}
|
|
150
165
|
builtCode = handleReplacements(builtCode)
|
|
151
166
|
|
|
167
|
+
builtCode += `
|
|
168
|
+
var process = {
|
|
169
|
+
env: {
|
|
170
|
+
${Object.keys(process.env)
|
|
171
|
+
.filter((key) =>
|
|
172
|
+
!['bindes', 'ENTRYPOINT', 'ROOT', 'OUT', 'file', 'DEV',
|
|
173
|
+
'size', 'filePath', 'isAppFile', 'isJsx', 'INPUT'].includes(key)
|
|
174
|
+
)
|
|
175
|
+
.map((key) => `${key}: "${process.env[key]}"`)
|
|
176
|
+
.join(',\n')}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
152
180
|
fs.writeFileSync(path.join(process.cwd(), 'dist', process.env.filePath), builtCode)
|
|
153
181
|
|
|
154
182
|
let isClass = function (element) {
|