@omnia/tooling-vue 8.0.240-dev → 8.0.242-dev
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/internal-do-not-import-from-here/config/tooling.output.json +1 -1
- package/internal-do-not-import-from-here/config/wctypings.d.ts +13 -0
- package/internal-do-not-import-from-here/shared.d.ts +1 -0
- package/internal-do-not-import-from-here/shared.js +40 -20
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
- package/internal-do-not-import-from-here/tasks/doc.js +1 -2
- package/internal-do-not-import-from-here/vite/hmr/vueJsx.js +9 -108
- package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +1 -1
- package/package.json +4 -4
|
@@ -92,11 +92,10 @@ declare global {
|
|
|
92
92
|
if (Object.keys(docResult).length > 0) {
|
|
93
93
|
fsExtra.outputFileSync(docPath, `
|
|
94
94
|
import { extendApi } from "@omnia/fx";
|
|
95
|
-
import { ComponentDoc } from "@omnia/fx-models";
|
|
96
95
|
|
|
97
96
|
extendApi(api => api.fx.docs.registrations, api => {
|
|
98
97
|
|
|
99
|
-
const registrations
|
|
98
|
+
const registrations = ${JSON.stringify(docResult)}
|
|
100
99
|
|
|
101
100
|
Object.keys(registrations).forEach(elementName => {
|
|
102
101
|
api.register(elementName, registrations[elementName]);
|
|
@@ -90,7 +90,11 @@ function transformVueJsx(code, id) {
|
|
|
90
90
|
if (hotComponents.length) {
|
|
91
91
|
if (hasDefault) {
|
|
92
92
|
result.code =
|
|
93
|
-
result.code
|
|
93
|
+
result.code
|
|
94
|
+
.replace(/export default internalDVWCByFS/g, `const __default__ = internalDVWCByFS`)
|
|
95
|
+
.replace(/export default internalDVCByFS/g, `const __default__ = internalDVCByFS`)
|
|
96
|
+
.replace(/export default defineVueWebComponent/g, `const __default__ = defineVueWebComponent`)
|
|
97
|
+
.replace(/export default defineVueComponent/g, `const __default__ = defineVueComponent`) + `\nexport default __default__`;
|
|
94
98
|
}
|
|
95
99
|
if (!/\?vue&type=script/.test(id)) {
|
|
96
100
|
let code = result.code;
|
|
@@ -115,112 +119,6 @@ function transformVueJsx(code, id) {
|
|
|
115
119
|
};
|
|
116
120
|
}
|
|
117
121
|
exports.transformVueJsx = transformVueJsx;
|
|
118
|
-
// Customized from plugin-vue-jsx https://github.com/vitejs/vite/blob/main/packages/plugin-vue-jsx/index.js
|
|
119
|
-
// export function injectHotReloadScript(babelFile: BabelFileResult, code: string, id: string) {
|
|
120
|
-
// const [hotComponents, hasDefault] = getHotComponents(babelFile, code, id);
|
|
121
|
-
// if (hotComponents.length) {
|
|
122
|
-
// if (hasDefault) {
|
|
123
|
-
// babelFile.code = babelFile.code.replace(
|
|
124
|
-
// /export default defineVueComponent/g,
|
|
125
|
-
// `const __default__ = defineVueComponent`
|
|
126
|
-
// );
|
|
127
|
-
// babelFile.code = babelFile.code.replace(
|
|
128
|
-
// /export default defineVueWebComponent/g,
|
|
129
|
-
// `const __default__ = defineVueWebComponent`
|
|
130
|
-
// );
|
|
131
|
-
// }
|
|
132
|
-
// if (!/\?vue&type=script/.test(id)) {
|
|
133
|
-
// let code = babelFile.code;
|
|
134
|
-
// let callbackCode = ``;
|
|
135
|
-
// code = '\n' +
|
|
136
|
-
// `const __VUE_HOT_RELOAD_API__ = omniaWebpackJsonp['bb000000-0000-bbbb-0000-0000000000bb']['${o$.enums.omniaResourceManifests.HMR}']('f8ee4fc2-3876-4997-80d7-5264eaee44bb');` + '\n' + code;
|
|
137
|
-
// for (const { local, exported, id } of hotComponents) {
|
|
138
|
-
// code +=
|
|
139
|
-
// `\n\n/**\n * Vue Hot Reload\n */\n${local}.__hmrId = "${id}";` +
|
|
140
|
-
// `\n__VUE_HOT_RELOAD_API__.createRecord("${id}", ${local});`;
|
|
141
|
-
// callbackCode = callbackCode + '\n\n' +
|
|
142
|
-
// ` __VUE_HOT_RELOAD_API__.reload("${id}", __${exported});`;
|
|
143
|
-
// }
|
|
144
|
-
// code += `\nimport.meta.hot.accept(({${hotComponents
|
|
145
|
-
// .map((c) => `${c.exported}: __${c.exported}`)
|
|
146
|
-
// .join(',')}}) => {${callbackCode}\n});`;
|
|
147
|
-
// babelFile.code = code;
|
|
148
|
-
// }
|
|
149
|
-
// if (hasDefault) {
|
|
150
|
-
// babelFile.code += `\n\nexport default __default__;`;
|
|
151
|
-
// }
|
|
152
|
-
// }
|
|
153
|
-
// }
|
|
154
|
-
// function getHotComponents(babelFile: BabelFileResult, code: string, id: string): [Array<HotComponent>, boolean] {
|
|
155
|
-
// let hasDefault = false;
|
|
156
|
-
// const declaredComponents: Array<{ name: string }> = [];
|
|
157
|
-
// const hotComponents: Array<HotComponent> = [];
|
|
158
|
-
// for (const node of babelFile.ast.program.body) {
|
|
159
|
-
// if (node.type === 'VariableDeclaration') {
|
|
160
|
-
// const names = parseComponentDecls(node, code)
|
|
161
|
-
// if (names.length) {
|
|
162
|
-
// declaredComponents.push(...names)
|
|
163
|
-
// }
|
|
164
|
-
// }
|
|
165
|
-
// if (node.type === 'ExportNamedDeclaration') {
|
|
166
|
-
// if (
|
|
167
|
-
// node.declaration &&
|
|
168
|
-
// node.declaration.type === 'VariableDeclaration'
|
|
169
|
-
// ) {
|
|
170
|
-
// hotComponents.push(
|
|
171
|
-
// ...parseComponentDecls(node.declaration, code).map(
|
|
172
|
-
// ({ name }) => ({
|
|
173
|
-
// local: name,
|
|
174
|
-
// exported: name,
|
|
175
|
-
// id: hash(id + name)
|
|
176
|
-
// })
|
|
177
|
-
// )
|
|
178
|
-
// )
|
|
179
|
-
// } else if (node.specifiers.length) {
|
|
180
|
-
// for (const spec of node.specifiers) {
|
|
181
|
-
// if (
|
|
182
|
-
// spec.type === 'ExportSpecifier' &&
|
|
183
|
-
// spec.exported.type === 'Identifier'
|
|
184
|
-
// ) {
|
|
185
|
-
// const matched = declaredComponents.find(
|
|
186
|
-
// ({ name }) => name === spec.local.name
|
|
187
|
-
// )
|
|
188
|
-
// if (matched) {
|
|
189
|
-
// hotComponents.push({
|
|
190
|
-
// local: spec.local.name,
|
|
191
|
-
// exported: spec.exported.name,
|
|
192
|
-
// id: hash(id + spec.exported.name)
|
|
193
|
-
// })
|
|
194
|
-
// }
|
|
195
|
-
// }
|
|
196
|
-
// }
|
|
197
|
-
// }
|
|
198
|
-
// }
|
|
199
|
-
// if (node.type === 'ExportDefaultDeclaration') {
|
|
200
|
-
// if (node.declaration.type === 'Identifier') {
|
|
201
|
-
// const _name = node.declaration.name
|
|
202
|
-
// const matched = declaredComponents.find(
|
|
203
|
-
// ({ name }) => name === _name
|
|
204
|
-
// )
|
|
205
|
-
// if (matched) {
|
|
206
|
-
// hotComponents.push({
|
|
207
|
-
// local: node.declaration.name,
|
|
208
|
-
// exported: 'default',
|
|
209
|
-
// id: hash(id + 'default')
|
|
210
|
-
// })
|
|
211
|
-
// }
|
|
212
|
-
// } else if (isDefineComponentCall(node.declaration)) {
|
|
213
|
-
// hasDefault = true
|
|
214
|
-
// hotComponents.push({
|
|
215
|
-
// local: '__default__',
|
|
216
|
-
// exported: 'default',
|
|
217
|
-
// id: hash(id + 'default')
|
|
218
|
-
// })
|
|
219
|
-
// }
|
|
220
|
-
// }
|
|
221
|
-
// }
|
|
222
|
-
// return [hotComponents, hasDefault];
|
|
223
|
-
// }
|
|
224
122
|
function parseComponentDecls(node, source) {
|
|
225
123
|
const names = [];
|
|
226
124
|
for (const decl of node.declarations) {
|
|
@@ -236,7 +134,10 @@ function isDefineComponentCall(node) {
|
|
|
236
134
|
return (node &&
|
|
237
135
|
node.type === 'CallExpression' &&
|
|
238
136
|
node.callee.type === 'Identifier' &&
|
|
239
|
-
(node.callee.name === '
|
|
137
|
+
(node.callee.name === 'internalDVWCByFS'
|
|
138
|
+
|| node.callee.name === 'internalDVCByFS'
|
|
139
|
+
|| node.callee.name === 'defineVueComponent'
|
|
140
|
+
|| node.callee.name === 'defineVueWebComponent'));
|
|
240
141
|
}
|
|
241
142
|
function isClassComponentCall(node) {
|
|
242
143
|
return (node &&
|
|
@@ -40,7 +40,7 @@ function registerHmrMiddleware(server) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
const publicDir = server.config.publicDir.split('
|
|
43
|
+
const publicDir = server.config.publicDir.replace(/\\/g, "/").split('/').pop();
|
|
44
44
|
const host = `https://localhost:${server.config.server.port}`;
|
|
45
45
|
server.middlewares.use(utils_1.pathUtils.OMNIA_BUNDLE_REQUEST, async (req, res, next) => {
|
|
46
46
|
const { resourceId, bundleFileExtension, fromWorker } = utils_1.pathUtils.parseOmniaBundlePath(req.url);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnia/tooling-vue",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.242-dev",
|
|
5
5
|
"description": "Used to bundle and serve manifests web component that build on Vue framework.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"author": "Precio Fishbone",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@omnia/fx-models": "8.0.
|
|
23
|
-
"@omnia/tooling-composers": "8.0.
|
|
22
|
+
"@omnia/fx-models": "8.0.242-dev",
|
|
23
|
+
"@omnia/tooling-composers": "8.0.242-dev",
|
|
24
24
|
"@types/mousetrap": "1.5.34",
|
|
25
25
|
"@types/quill": "1.3.6",
|
|
26
26
|
"@types/zepto": "1.0.29",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"es6-promise": "4.2.4",
|
|
58
58
|
"hash-sum": "1.0.2",
|
|
59
59
|
"lodash": "4.17.21",
|
|
60
|
-
"vite": "5.
|
|
60
|
+
"vite": "5.3.4",
|
|
61
61
|
"vite-plugin-inspect": "0.8.3",
|
|
62
62
|
"appdata-path": "1.0.0",
|
|
63
63
|
"url": "0.11.0",
|