@omnia/tooling-vue 8.0.288-dev → 8.0.289-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 +48 -20
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
- package/internal-do-not-import-from-here/vite/middlewares/index.d.ts +0 -1
- package/internal-do-not-import-from-here/vite/middlewares/index.js +0 -1
- package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +0 -3
- package/package.json +4 -4
- package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.d.ts +0 -2
- package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.js +0 -174
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./OmniaMiddleware"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./WebpackMiddleware"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./StaticFileMiddleware"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./HmrMiddleware"), exports);
|
|
@@ -83,9 +83,6 @@ function omniaPlugin(options) {
|
|
|
83
83
|
if (server.config.server.hmr) {
|
|
84
84
|
(0, middlewares_1.registerHmrMiddleware)(server);
|
|
85
85
|
}
|
|
86
|
-
else {
|
|
87
|
-
(0, middlewares_1.registerWebpackMiddleware)(server);
|
|
88
|
-
}
|
|
89
86
|
(0, middlewares_1.registerStaticFileMiddleware)(server);
|
|
90
87
|
}
|
|
91
88
|
};
|
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.289-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.289-dev",
|
|
23
|
+
"@omnia/tooling-composers": "8.0.289-dev",
|
|
24
24
|
"@types/mousetrap": "1.5.34",
|
|
25
25
|
"@types/quill": "1.3.6",
|
|
26
26
|
"@types/zepto": "1.0.29",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"webpack-dev-middleware": "7.1.1",
|
|
52
52
|
"webpack-merge": "5.8.0",
|
|
53
53
|
"zepto-webpack": "1.2.1",
|
|
54
|
-
"@swc/core": "1.
|
|
54
|
+
"@swc/core": "1.7.26",
|
|
55
55
|
"md5-file": "3.2.3",
|
|
56
56
|
"csx": "10.0.0",
|
|
57
57
|
"es6-promise": "4.2.4",
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerWebpackMiddleware = registerWebpackMiddleware;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const webpack_1 = require("webpack");
|
|
6
|
-
const webpack_dev_middleware_1 = tslib_1.__importDefault(require("webpack-dev-middleware"));
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const $ = tslib_1.__importStar(require("../../variables"));
|
|
9
|
-
const bundler = tslib_1.__importStar(require("../../tasks/bundle"));
|
|
10
|
-
const tooling_1 = require("@omnia/tooling");
|
|
11
|
-
const tooling_composers_1 = require("@omnia/tooling-composers");
|
|
12
|
-
const fx_models_1 = require("@omnia/fx-models");
|
|
13
|
-
const OmniaMiddleware_1 = require("./OmniaMiddleware");
|
|
14
|
-
let _webpackDevMiddlewareInstance = null;
|
|
15
|
-
let _server = null;
|
|
16
|
-
let _errorMessage = '';
|
|
17
|
-
function registerWebpackMiddleware(server) {
|
|
18
|
-
_server = server;
|
|
19
|
-
$.tooling.core.registerServeTask({
|
|
20
|
-
stage: $.tooling.core.TaskStage.BundleManifest,
|
|
21
|
-
order: 3,
|
|
22
|
-
task: function (entries) {
|
|
23
|
-
return registerWebpackMiddleWareBundle(entries);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function registerWebpackMiddleWareBundle(entries) {
|
|
28
|
-
_server.httpServer.on('upgrade', (req, socket, head) => {
|
|
29
|
-
// have new connection
|
|
30
|
-
if (req.headers['sec-websocket-protocol'] === 'vite-hmr') {
|
|
31
|
-
if (_errorMessage) {
|
|
32
|
-
sendMessage({
|
|
33
|
-
err: Object.create({
|
|
34
|
-
message: _errorMessage
|
|
35
|
-
}),
|
|
36
|
-
type: fx_models_1.LocalServingMessageType.Error
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
OmniaMiddleware_1.ManifestChangedMessage.subcribe(() => {
|
|
42
|
-
if (_webpackDevMiddlewareInstance) {
|
|
43
|
-
_webpackDevMiddlewareInstance.close();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
tooling_1.utils.registerLogToClient((message, type) => {
|
|
47
|
-
_errorMessage = message;
|
|
48
|
-
sendMessage({
|
|
49
|
-
err: Object.create({
|
|
50
|
-
message: _errorMessage
|
|
51
|
-
}),
|
|
52
|
-
type: fx_models_1.LocalServingMessageType.Error
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
return new Promise(function (resolve, reject) {
|
|
56
|
-
$.tooling.log("Webpack Middleware running...");
|
|
57
|
-
if (_webpackDevMiddlewareInstance) {
|
|
58
|
-
_webpackDevMiddlewareInstance.close();
|
|
59
|
-
}
|
|
60
|
-
let _initialized = false;
|
|
61
|
-
const hosting = (0, tooling_composers_1.getHosting)();
|
|
62
|
-
let configs = buildWebpackEntries(entries);
|
|
63
|
-
let webpackCompiler = (0, webpack_1.webpack)(configs);
|
|
64
|
-
let statOptions = {
|
|
65
|
-
//errorStack: false,
|
|
66
|
-
children: webpackCompiler.compilers.map(comp => Object.assign({ preset: 'errors-only', colors: false, errorStack: false }))
|
|
67
|
-
};
|
|
68
|
-
webpackCompiler.hooks.done.tap("omnia-done", stats => {
|
|
69
|
-
if (_initialized) {
|
|
70
|
-
const errorStats = stats.toString(statOptions);
|
|
71
|
-
if (errorStats) {
|
|
72
|
-
_errorMessage = errorStats;
|
|
73
|
-
sendMessage({
|
|
74
|
-
type: fx_models_1.LocalServingMessageType.Error,
|
|
75
|
-
err: Object.create({
|
|
76
|
-
message: _errorMessage
|
|
77
|
-
})
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
else if (!bundler.checkDuplicateBundle()) {
|
|
81
|
-
_errorMessage = null;
|
|
82
|
-
sendMessage({
|
|
83
|
-
type: fx_models_1.LocalServingMessageType.Update
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
_webpackDevMiddlewareInstance = (0, webpack_dev_middleware_1.default)(webpackCompiler, {
|
|
89
|
-
writeToDisk: (filePath) => {
|
|
90
|
-
if (OmniaMiddleware_1.resolvableManifest?.resolved) {
|
|
91
|
-
if (_initialized) {
|
|
92
|
-
let manifestId = $.tooling.utils.getguid(filePath);
|
|
93
|
-
if (manifestId) {
|
|
94
|
-
let manifest = $.tooling.composer.getManifestById(manifestId);
|
|
95
|
-
if (manifest) {
|
|
96
|
-
let manifestsData = $.tooling.composer.getManifestsJson();
|
|
97
|
-
let bundleType = path_1.default.extname(filePath).replace('.', '');
|
|
98
|
-
manifest.version = manifest.version || {};
|
|
99
|
-
manifest.version[bundleType] = $.tooling.utils.generateguid().replace(/-/g, '');
|
|
100
|
-
$.tooling.composer.updateManifestData(manifestsData);
|
|
101
|
-
// check if the manifest in agroup
|
|
102
|
-
if (manifestsData.groupedResouresAndComponents) {
|
|
103
|
-
let manifestGroup = manifestsData.groupedResouresAndComponents.find(g => g.manifestIdsInGroup.indexOf(manifestId) > -1);
|
|
104
|
-
if (manifestGroup) {
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
if (OmniaMiddleware_1.resolvableManifest?.resolved) {
|
|
107
|
-
bundler.createCombinedManfest(bundler.getServiceId(), manifestGroup.manifestIdsInGroup, manifestGroup.resourceId, manifestGroup.resourceName, $.tooling.composer.OmniaOutput.OutputBundlePath).then(() => {
|
|
108
|
-
tooling_1.utils.log(`Webpack bundle changed -> ${manifestGroup.resourceName ? manifestGroup.resourceName + '_' : ''}${manifestGroup.resourceId}.js`);
|
|
109
|
-
manifestGroup.version = manifest.version || {};
|
|
110
|
-
manifestGroup.version['js'] = $.tooling.utils.generateguid().replace(/-/g, '');
|
|
111
|
-
$.tooling.composer.updateManifestData(manifestsData);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}, 100);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (!_errorMessage && hosting.disableAutoReload !== true) {
|
|
118
|
-
bundler.ensureManifestDependencyInRuntime(manifestId, filePath);
|
|
119
|
-
tooling_1.utils.timeWatch("registerWebpackMiddleWareBundle_autoreload", () => {
|
|
120
|
-
sendMessage({ type: fx_models_1.LocalServingMessageType.FullReload });
|
|
121
|
-
}, 200);
|
|
122
|
-
}
|
|
123
|
-
//_webpackCompiler.
|
|
124
|
-
tooling_1.utils.log(`Webpack bundle changed -> ${path_1.default.basename(filePath)}&v=${manifest.version[bundleType]}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
_webpackDevMiddlewareInstance.waitUntilValid(() => {
|
|
133
|
-
if (bundler.checkDuplicateBundle()) { // detect duplicated bundle
|
|
134
|
-
tooling_1.utils.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
|
|
135
|
-
// reject();
|
|
136
|
-
// process.exit();
|
|
137
|
-
}
|
|
138
|
-
tooling_1.utils.log("Webpack Middleware done");
|
|
139
|
-
_initialized = true;
|
|
140
|
-
resolve(entries);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function buildWebpackEntries(entries) {
|
|
145
|
-
let configs = [];
|
|
146
|
-
let bundleOptions = bundler.getBuildOption().bundleOptions;
|
|
147
|
-
if (bundleOptions && bundleOptions.commonsChunk) {
|
|
148
|
-
let config = bundler.createVueWebpackConfig(null, entries, $.tooling.composer.OmniaOutput.OutputBundlePath);
|
|
149
|
-
config.stats = 'errors-only';
|
|
150
|
-
config.watchOptions = {
|
|
151
|
-
aggregateTimeout: 200
|
|
152
|
-
};
|
|
153
|
-
configs.push(config);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
configs = Object.keys(entries).map(key => {
|
|
157
|
-
var entry = {};
|
|
158
|
-
entry[key] = entries[key];
|
|
159
|
-
let config = bundler.createVueWebpackConfig(entry, entries, $.tooling.composer.OmniaOutput.OutputBundlePath);
|
|
160
|
-
config.stats = 'errors-only';
|
|
161
|
-
config.watchOptions = {
|
|
162
|
-
aggregateTimeout: 200
|
|
163
|
-
};
|
|
164
|
-
return config;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
configs.forEach(config => {
|
|
168
|
-
config.output.path = $.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath);
|
|
169
|
-
});
|
|
170
|
-
return configs;
|
|
171
|
-
}
|
|
172
|
-
function sendMessage(message) {
|
|
173
|
-
_server.ws.send(message);
|
|
174
|
-
}
|