@omnia/tooling-vue 8.0.21-vnext → 8.0.22-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/omnia.vendor.manifest.json +1 -1
- package/internal-do-not-import-from-here/config/tooling.output.json +1 -0
- package/internal-do-not-import-from-here/config/wctypings.d.ts +2213 -0
- package/internal-do-not-import-from-here/index.d.ts +3 -1
- package/internal-do-not-import-from-here/index.js +6 -2
- package/internal-do-not-import-from-here/shared.d.ts +32 -122
- package/internal-do-not-import-from-here/shared.js +97 -192
- package/internal-do-not-import-from-here/swc/extract-doc-plugin/package.json +14 -0
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.d.ts +1 -0
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +9 -0
- package/internal-do-not-import-from-here/tasks/bundle.d.ts +3 -4
- package/internal-do-not-import-from-here/tasks/bundle.js +208 -238
- package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
- package/internal-do-not-import-from-here/tasks/doc.js +282 -395
- package/internal-do-not-import-from-here/tasks/vendor.js +9 -5
- package/internal-do-not-import-from-here/variables.d.ts +1 -1
- package/internal-do-not-import-from-here/variables.js +2 -2
- package/internal-do-not-import-from-here/vite/hmr/graph.js +5 -1
- package/internal-do-not-import-from-here/vite/hmr/manifest.js +5 -5
- package/internal-do-not-import-from-here/vite/hmr/runtime.js +5 -5
- package/internal-do-not-import-from-here/vite/hmr/utils/manifest.js +3 -3
- package/internal-do-not-import-from-here/vite/hmr/utils/path.js +7 -6
- package/internal-do-not-import-from-here/vite/hmr/utils/webpack.js +2 -2
- package/internal-do-not-import-from-here/vite/index.js +4 -0
- package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +8 -13
- package/internal-do-not-import-from-here/vite/middlewares/OmniaMiddleware.js +55 -17
- package/internal-do-not-import-from-here/vite/middlewares/StaticFileMiddleware.js +31 -10
- package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.js +1 -1
- package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +9 -1
- package/internal-do-not-import-from-here/wctypings.ts +0 -0
- package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
- package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +11 -4
- package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +12 -12
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +11 -1
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +34 -29
- package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
- package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +11 -0
- package/package.json +12 -8
- package/internal-do-not-import-from-here/1cacb55c-202b-4cd7-819d-11bad92fa9cb.wcdefinitions.json +0 -1
- package/internal-do-not-import-from-here/1cacb55c-202b-4cd7-819d-11bad92fa9cb.wctypings.d.ts +0 -11
- package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wcdefinitions.json +0 -1
- package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -365
- package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.js +0 -2
- package/internal-do-not-import-from-here/cc000000-0000-cccc-0000-0000000000cc.wcdefinitions.json +0 -1
- package/internal-do-not-import-from-here/config/tsconfig.es2015.json +0 -21
- package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
- package/internal-do-not-import-from-here/webpack-loaders/jsx-loader.d.ts +0 -8
- package/internal-do-not-import-from-here/webpack-loaders/jsx-loader.js +0 -61
- package/internal-do-not-import-from-here/webpack-loaders/vue-tsx-hot-loader.d.ts +0 -1
- package/internal-do-not-import-from-here/webpack-loaders/vue-tsx-hot-loader.js +0 -44
- package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
- package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
- /package/internal-do-not-import-from-here/{1cacb55c-202b-4cd7-819d-11bad92fa9cb.wctypings.js → config/wctypings.js} +0 -0
- /package/internal-do-not-import-from-here/webpack-loaders/{esbuild-custom-loader.d.ts → doc-loader.d.ts} +0 -0
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addDependency = exports.processManifestGenerated = exports.checkDuplicateBundle = exports.
|
|
3
|
+
exports.addDependency = exports.processManifestGenerated = exports.checkDuplicateBundle = exports.registerManifestsReference = exports.createCombinedManfest = exports.createVueWebpackConfig = exports.cleanUpComposer = exports.getBuildOption = exports.getServiceId = exports.bundleManifest = exports.ensureManifestDependencyInRuntime = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const del_1 = tslib_1.__importDefault(require("del"));
|
|
7
7
|
const fsExtra = tslib_1.__importStar(require("fs-extra"));
|
|
8
|
-
const
|
|
8
|
+
const globby_1 = require("globby");
|
|
9
9
|
const terser_1 = require("terser");
|
|
10
10
|
const ts_loader_1 = tslib_1.__importDefault(require("../webpack-loaders/ts-loader"));
|
|
11
11
|
const tsx_loader_1 = tslib_1.__importDefault(require("../webpack-loaders/tsx-loader"));
|
|
12
|
+
const tooling_composers_1 = require("@omnia/tooling-composers");
|
|
12
13
|
const fx_models_1 = require("@omnia/fx-models");
|
|
13
14
|
const $ = tslib_1.__importStar(require("../variables"));
|
|
14
15
|
const shared_1 = require("../shared");
|
|
15
16
|
const tooling_1 = require("@omnia/tooling");
|
|
17
|
+
const doc_1 = require("./doc");
|
|
16
18
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
17
19
|
const ConcatSource = require('webpack-core/lib/ConcatSource');
|
|
18
20
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
19
21
|
const isEqual = require('lodash/isEqual');
|
|
20
22
|
const vendorProdId = "aaf89b2d-5ea8-4b79-946a-8c1e89f713a3";
|
|
21
|
-
let outDirManifestMetadata = "client/tooling/vue/output_manifests", _manifestsEntry = {}, _registeredReferenceManifests = [], serviceId = null, _modulesStats = {}, _manifestsStats = {}, keepTrackbuildOptions = {}, _transformResourcepaths = []
|
|
23
|
+
let outDirManifestMetadata = "client/tooling/vue/output_manifests", _manifestsEntry = {}, _registeredReferenceManifests = [], serviceId = null, _modulesStats = {}, _manifestsStats = {}, keepTrackbuildOptions = {}, _transformResourcepaths = [];
|
|
22
24
|
if ($.isExtensionEnv) {
|
|
23
25
|
outDirManifestMetadata = "node_modules/@omnia/tooling-vue/internal-do-not-import-from-here/output_manifests";
|
|
24
26
|
}
|
|
@@ -36,21 +38,26 @@ $.tooling.core.registerBuildTask({
|
|
|
36
38
|
order: 2,
|
|
37
39
|
task: function () {
|
|
38
40
|
return new Promise(function (resolve, reject) {
|
|
39
|
-
|
|
41
|
+
buildEntries()
|
|
40
42
|
.then((result) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
if (process.argv.length > 0 && process.argv.find(argv => argv === "--package") !== undefined) {
|
|
44
|
+
resolve(result);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
let startTime = new Date().getTime();
|
|
48
|
+
tooling_1.utils.log("Typescript checking...");
|
|
49
|
+
const spawn = require("child_process").spawn;
|
|
50
|
+
spawn("node", [path_1.default.resolve(__dirname, "./tsc.js")], { stdio: "inherit", })
|
|
51
|
+
.on('exit', (code) => {
|
|
52
|
+
if (code == 0) {
|
|
53
|
+
tooling_1.utils.logTime('Done - Typescript', startTime);
|
|
54
|
+
resolve(result);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
process.exit(code);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
54
61
|
}, reject);
|
|
55
62
|
});
|
|
56
63
|
}
|
|
@@ -65,7 +72,7 @@ $.tooling.core.registerServeTask({
|
|
|
65
72
|
fsExtra.removeSync("node_modules/tiptap-commands/node_modules");
|
|
66
73
|
fsExtra.removeSync("node_modules/tiptap-utils/node_modules");
|
|
67
74
|
}
|
|
68
|
-
|
|
75
|
+
buildEntries(true)
|
|
69
76
|
.then(resolve, reject);
|
|
70
77
|
});
|
|
71
78
|
}
|
|
@@ -184,80 +191,38 @@ function clean() {
|
|
|
184
191
|
return new Promise(function (resolve, reject) {
|
|
185
192
|
del_1.default.sync("node_modules/.cache");
|
|
186
193
|
del_1.default.sync($.tooling.utils.root(outDirManifestMetadata + "/manifest.entries.cached.json"));
|
|
187
|
-
|
|
188
|
-
del_1.default.sync($.path.resolve(__dirname, "../wctypings.ts"));
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
del_1.default.sync($.path.resolve(__dirname, `../bb000000-0000-bbbb-0000-0000000000bb.wctypings.ts`));
|
|
192
|
-
}
|
|
194
|
+
shared_1.ConfigurationManager.webComponentTypings.delete();
|
|
193
195
|
resolve();
|
|
194
196
|
});
|
|
195
197
|
}
|
|
196
|
-
function
|
|
197
|
-
return new Promise(function (resolve, reject) {
|
|
198
|
+
function buildEntries(serve = false) {
|
|
199
|
+
return new Promise(async function (resolve, reject) {
|
|
198
200
|
try {
|
|
199
|
-
|
|
201
|
+
let startTime = new Date().getTime();
|
|
200
202
|
var componentRegistry = $.composers.ComponentRegistry;
|
|
201
203
|
let componentRegistrations = componentRegistry.getRegistrations();
|
|
204
|
+
const serviceInfo = $.composers.ServiceManifestRegistry.getServiceInfo();
|
|
205
|
+
startTime = new Date().getTime();
|
|
202
206
|
$.tooling.logTime("Found [" + componentRegistrations.length + "] component registrations", startTime);
|
|
207
|
+
let componentEntries = createVueEntryFormComponentRegistrations(componentRegistrations);
|
|
208
|
+
if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
|
|
209
|
+
await (0, doc_1.generateComponentTypingsAndDoc)(componentRegistrations);
|
|
210
|
+
}
|
|
203
211
|
var resourceRegistry = $.composers.ResourceRegistry;
|
|
204
212
|
let resourceBundlesWithBuildOptions = resourceRegistry.getRegisteredResourceBundles(shared_1.convertManifestPathToEntryPath);
|
|
205
|
-
$.tooling.logTime("Found [" +
|
|
213
|
+
$.tooling.logTime("Found [" + resourceBundlesWithBuildOptions?.size + "] resource bundles", startTime);
|
|
206
214
|
let resourceEntries = {};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
let
|
|
210
|
-
let manifest = $.composers.LoadableManifestRegistry.getRegisteredManifest(key);
|
|
215
|
+
for (const res of resourceBundlesWithBuildOptions) {
|
|
216
|
+
let resource = res[1];
|
|
217
|
+
let manifest = $.composers.LoadableManifestRegistry.getRegisteredManifest(res[0]);
|
|
211
218
|
if (!resource.buildOptions) {
|
|
212
|
-
resourceEntries[`${manifest.resourceName ? manifest.resourceName + "_" : ""}${
|
|
219
|
+
resourceEntries[`${manifest.resourceName ? manifest.resourceName + "_" : ""}${res[0]}`] = resource.paths;
|
|
213
220
|
}
|
|
214
221
|
else {
|
|
215
222
|
//Some special handling of buildoptions
|
|
216
|
-
console.log("debug " +
|
|
223
|
+
console.log("debug " + res[0] + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
|
|
217
224
|
}
|
|
218
225
|
}
|
|
219
|
-
//We only support typings for registered web components
|
|
220
|
-
wcDomProps = extractTypingsForComponents(componentRegistrations);
|
|
221
|
-
if (Object.keys(wcDomProps).length > 0) {
|
|
222
|
-
let wcDomPropsDesc = `Extracted web component typings for ${Object.keys(wcDomProps).length} component(s)`;
|
|
223
|
-
$.tooling.logTime(wcDomPropsDesc, startTime);
|
|
224
|
-
}
|
|
225
|
-
if ($.isExtensionEnv) {
|
|
226
|
-
wcDefinitionsPath = $.path.resolve(__dirname, "../wcdefinitions.json");
|
|
227
|
-
wcTypingsPath = $.path.resolve(__dirname, "../wctypings.ts");
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
wcDefinitionsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wcdefinitions.json`);
|
|
231
|
-
wcTypingsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wctypings.ts`);
|
|
232
|
-
}
|
|
233
|
-
fsExtra.writeJsonSync(wcDefinitionsPath, wcDomProps);
|
|
234
|
-
let wcTypings = `
|
|
235
|
-
//{{importWC}}
|
|
236
|
-
declare global {
|
|
237
|
-
namespace JSX {
|
|
238
|
-
interface Element { }
|
|
239
|
-
interface ElementClass { }
|
|
240
|
-
|
|
241
|
-
interface IntrinsicElements {
|
|
242
|
-
//{{elementName}}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
`;
|
|
247
|
-
if ($.isExtensionEnv) {
|
|
248
|
-
wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
|
|
249
|
-
${wcTypings}`;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
|
|
253
|
-
${wcTypings}`;
|
|
254
|
-
}
|
|
255
|
-
componentRegistrations.forEach(wc => {
|
|
256
|
-
wcTypings = generateWebComponentTypings(wc, wcTypings);
|
|
257
|
-
});
|
|
258
|
-
fsExtra.outputFileSync(wcTypingsPath, wcTypings);
|
|
259
|
-
wcDomProps = $.merge(wcDomProps, getRegisteredWebComponentDefinitions());
|
|
260
|
-
let componentEntries = createVueEntryFormRegistrations(componentRegistrations);
|
|
261
226
|
var entries = $.merge(componentEntries, resourceEntries);
|
|
262
227
|
if (checkDuplicateWebpackEntryPoints(entries)) {
|
|
263
228
|
$.tooling.log('Build manifests metadata have error that found duplicated resource path', $.tooling.LogTypes.Error);
|
|
@@ -387,14 +352,14 @@ function beforeBundleManifest(entries) {
|
|
|
387
352
|
// cleanup before generate
|
|
388
353
|
del_1.default.sync(outDirManifestMetadata);
|
|
389
354
|
const entriesToBuild = {};
|
|
390
|
-
const resourceRegistrations =
|
|
391
|
-
const wcRegistrations =
|
|
355
|
+
const resourceRegistrations = Array.from($.composers.ResourceRegistry.getResourceRegistrations().keys());
|
|
356
|
+
const wcRegistrations = $.composers.ComponentRegistry.getComponentRegistrations();
|
|
392
357
|
Object.keys(entries).forEach(name => {
|
|
393
|
-
if (resourceRegistrations.find(rk => name.indexOf(rk) > -1)) {
|
|
358
|
+
if (resourceRegistrations.find(rk => name.indexOf(rk.toString()) > -1)) {
|
|
394
359
|
entriesToBuild[name] = entries[name];
|
|
395
360
|
}
|
|
396
361
|
// generate manifest metadata for wc
|
|
397
|
-
else if (wcRegistrations.find(rk => name.indexOf(rk) > -1)) {
|
|
362
|
+
else if (wcRegistrations.find(rk => name.indexOf(rk.manifest.resourceId.toString()) > -1)) {
|
|
398
363
|
const manifestPath = $.tooling.utils.root(outDirManifestMetadata + "/" + name + '.manifest.json');
|
|
399
364
|
const content = {
|
|
400
365
|
name: `omniaWebpackJsonp['${getServiceId()}']['${$.tooling.utils.getGuidValue(name)}']`,
|
|
@@ -424,7 +389,6 @@ function beforeBundleManifest(entries) {
|
|
|
424
389
|
});
|
|
425
390
|
}
|
|
426
391
|
function bundleManifest(entries) {
|
|
427
|
-
var startTime = new Date().getTime();
|
|
428
392
|
return new Promise(function (resolve, reject) {
|
|
429
393
|
try {
|
|
430
394
|
// Hacky solution to delete node_modules inside tiptap regarding miss match version prosemirror
|
|
@@ -466,14 +430,18 @@ function bundleManifest(entries) {
|
|
|
466
430
|
}
|
|
467
431
|
else {
|
|
468
432
|
let webpackConfigs = [];
|
|
433
|
+
var startTime = new Date().getTime();
|
|
434
|
+
// $.tooling.logTime('Build Webpack Config running', startTime);
|
|
469
435
|
Object.keys(entries).forEach((id) => {
|
|
470
436
|
var entry = {};
|
|
471
437
|
entry[id] = entries[id];
|
|
472
438
|
var vueWebpackConfig = createVueWebpackConfig(entry, entries, $.tooling.composer.OmniaOutput.OutputBundlePath);
|
|
473
439
|
webpackConfigs.push(vueWebpackConfig);
|
|
474
440
|
});
|
|
441
|
+
// $.tooling.logTime('Build Webpack Config - done', startTime);
|
|
475
442
|
let compiler = $.webpack(webpackConfigs);
|
|
476
443
|
compiler.run((err, stats) => {
|
|
444
|
+
//console.log("webpack run -done")
|
|
477
445
|
if (checkDuplicateBundle()) { // detect duplicated bundle
|
|
478
446
|
$.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
|
|
479
447
|
reject();
|
|
@@ -555,27 +523,35 @@ function minifyBundles() {
|
|
|
555
523
|
if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
|
|
556
524
|
let startTime = new Date().getTime();
|
|
557
525
|
$.tooling.log('Minify bundles running...');
|
|
558
|
-
const jsPaths =
|
|
526
|
+
const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`]);
|
|
559
527
|
let promises = [];
|
|
560
528
|
jsPaths.forEach(filePath => {
|
|
561
529
|
promises.push(new Promise(async (resolve, reject) => {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
530
|
+
try {
|
|
531
|
+
$.tooling.log(`Minify Js -> ${filePath}`);
|
|
532
|
+
// only minify for omnia.vendor.prod
|
|
533
|
+
if (filePath.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1) {
|
|
534
|
+
let content = await fsExtra.readFile(filePath, 'utf8');
|
|
535
|
+
let outFileName = `${filePath.substring(0, filePath.length - 3)}.min.js`;
|
|
536
|
+
if (filePath.indexOf(vendorProdId) > -1) {
|
|
537
|
+
content = content.replace(new RegExp(vendorProdId, "g"), fx_models_1.OmniaResourceManifests.Vendor.toString());
|
|
538
|
+
outFileName = `${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/omnia.vendor_6270b632-1f44-4146-bace-137131c0471b.min.js`;
|
|
539
|
+
}
|
|
540
|
+
let minified = await (0, terser_1.minify)(content, {
|
|
541
|
+
sourceMap: false,
|
|
542
|
+
ecma: 2020 // will remove es5 when not support IE 11
|
|
543
|
+
});
|
|
544
|
+
await fsExtra.writeFile(outFileName, minified.code, 'utf8');
|
|
545
|
+
$.tooling.log(`Minify Js Done -> ${filePath}`);
|
|
570
546
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
|
|
547
|
+
resolve();
|
|
548
|
+
}
|
|
549
|
+
catch (ex) {
|
|
550
|
+
tooling_1.utils.log(`Have a exception when minify the file -> ${filePath}`, tooling_1.utils.LogTypes.Error);
|
|
551
|
+
console.error(ex);
|
|
552
|
+
resolve();
|
|
553
|
+
throw new Error("Exit, have an exception.");
|
|
577
554
|
}
|
|
578
|
-
resolve();
|
|
579
555
|
}));
|
|
580
556
|
});
|
|
581
557
|
Promise.all(promises).then(() => {
|
|
@@ -588,7 +564,7 @@ function minifyBundles() {
|
|
|
588
564
|
}
|
|
589
565
|
});
|
|
590
566
|
}
|
|
591
|
-
function createVueWebpackConfig(currentEntry, entries, bundleOutputDir,
|
|
567
|
+
function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrOption) {
|
|
592
568
|
let buildOption = getBuildOption() || {};
|
|
593
569
|
let isBundleCommonChunk = buildOption.bundleOptions && buildOption.bundleOptions.commonsChunk && buildOption.bundleOptions.commonsChunk.name;
|
|
594
570
|
const extractCss = new MiniCssExtractPlugin({
|
|
@@ -629,7 +605,12 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
629
605
|
}
|
|
630
606
|
}));
|
|
631
607
|
}
|
|
632
|
-
let modifyContent = [
|
|
608
|
+
let modifyContent = [
|
|
609
|
+
{
|
|
610
|
+
pattern: /\.doc\$(.*\))/g,
|
|
611
|
+
replacement: ''
|
|
612
|
+
}
|
|
613
|
+
];
|
|
633
614
|
if (buildOption.bundleOptions && buildOption.bundleOptions.removeSourceMap) {
|
|
634
615
|
modifyContent.push({
|
|
635
616
|
pattern: /# sourceMappingURL=(.*\.map)/g,
|
|
@@ -688,7 +669,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
688
669
|
mangleExports: false,
|
|
689
670
|
concatenateModules: true,
|
|
690
671
|
//moduleIds: 'natural' as any
|
|
691
|
-
}, isBundleCommonChunk ? buildCommonChunk(entry) : {}),
|
|
672
|
+
}, isBundleCommonChunk && !viteHmrOption ? buildCommonChunk(entry) : {}),
|
|
692
673
|
resolve: {
|
|
693
674
|
modules: $.tooling.core.getWebpackResolveModules(),
|
|
694
675
|
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.html', '.vue', '.less', '.styl'],
|
|
@@ -722,9 +703,8 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
722
703
|
fullySpecified: false, // disable the behaviour
|
|
723
704
|
},
|
|
724
705
|
},
|
|
725
|
-
...(0, ts_loader_1.default)(
|
|
726
|
-
...(0, tsx_loader_1.default)(
|
|
727
|
-
// ...jsxLoader(getBuildOption().enableTreeShaking, wcDomProps, hotModuleReload),
|
|
706
|
+
...(0, ts_loader_1.default)(),
|
|
707
|
+
...(0, tsx_loader_1.default)(),
|
|
728
708
|
{
|
|
729
709
|
// remove vuetify locale
|
|
730
710
|
test: (path) => {
|
|
@@ -851,7 +831,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
851
831
|
exports.createVueWebpackConfig = createVueWebpackConfig;
|
|
852
832
|
function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
853
833
|
var entensionId = getServiceId();
|
|
854
|
-
return Object.assign({},
|
|
834
|
+
return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
|
|
855
835
|
plugins: [
|
|
856
836
|
...buildReferenceManifestFromConfig(),
|
|
857
837
|
new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
|
|
@@ -863,6 +843,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
|
863
843
|
]
|
|
864
844
|
});
|
|
865
845
|
}
|
|
846
|
+
function getBaseWebpackConfigForManifestMetadata(entry, bundleOutputDir) {
|
|
847
|
+
return {
|
|
848
|
+
devtool: false,
|
|
849
|
+
mode: 'development',
|
|
850
|
+
context: $.tooling.utils.root(""),
|
|
851
|
+
entry: entry,
|
|
852
|
+
optimization: Object.assign({
|
|
853
|
+
removeAvailableModules: false,
|
|
854
|
+
removeEmptyChunks: false,
|
|
855
|
+
splitChunks: false,
|
|
856
|
+
}),
|
|
857
|
+
resolve: {
|
|
858
|
+
modules: $.tooling.core.getWebpackResolveModules(),
|
|
859
|
+
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
|
|
860
|
+
//extensions: ['.js', '.jsx', '.ts', '.tsx', '.html', '.vue', '.less', '.styl'],
|
|
861
|
+
symlinks: false,
|
|
862
|
+
cacheWithContext: true,
|
|
863
|
+
descriptionFiles: ['package.json'],
|
|
864
|
+
alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), ($.composers.BuildConfigurationRegistry.getBuildOptions()?.moduleOptions?.alias || {}), {
|
|
865
|
+
'axios$': 'axios/dist/axios.js',
|
|
866
|
+
'typestyle$': 'typestyle/lib.es2015/index.js',
|
|
867
|
+
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
868
|
+
'@microsoft/signalr': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
869
|
+
}),
|
|
870
|
+
//mainFields: ['main', 'browser', 'module']
|
|
871
|
+
},
|
|
872
|
+
output: {
|
|
873
|
+
pathinfo: false,
|
|
874
|
+
path: $.tooling.utils.root(bundleOutputDir),
|
|
875
|
+
filename: '[name].js'
|
|
876
|
+
},
|
|
877
|
+
externals: [
|
|
878
|
+
function ({ context, request }, callback) {
|
|
879
|
+
if (request.indexOf("node_modules") > -1 || (/\.(sass|scss|styl|less|css)$/i).test(request)) {
|
|
880
|
+
return callback(null, 'commonjs ' + request);
|
|
881
|
+
}
|
|
882
|
+
callback();
|
|
883
|
+
}
|
|
884
|
+
],
|
|
885
|
+
module: {
|
|
886
|
+
noParse: /wwwroot(.*)/,
|
|
887
|
+
rules: [
|
|
888
|
+
{
|
|
889
|
+
test: /\.m?js$/,
|
|
890
|
+
resolve: {
|
|
891
|
+
fullySpecified: false, // disable the behaviour
|
|
892
|
+
},
|
|
893
|
+
},
|
|
894
|
+
...(0, ts_loader_1.default)(),
|
|
895
|
+
...(0, tsx_loader_1.default)(),
|
|
896
|
+
{
|
|
897
|
+
test: /\.styl$/,
|
|
898
|
+
use: [
|
|
899
|
+
//'style-loader',
|
|
900
|
+
//'css-loader',
|
|
901
|
+
'stylus-loader'
|
|
902
|
+
]
|
|
903
|
+
},
|
|
904
|
+
...($.isExtensionEnv ? [] : [{
|
|
905
|
+
test: /\.s(c|a)ss$/,
|
|
906
|
+
use: [
|
|
907
|
+
{
|
|
908
|
+
loader: 'sass-loader',
|
|
909
|
+
options: {
|
|
910
|
+
implementation: require('sass'),
|
|
911
|
+
sassOptions: {
|
|
912
|
+
//fiber: require('fibers'),
|
|
913
|
+
indentedSyntax: true
|
|
914
|
+
}
|
|
915
|
+
//fiber: require('fibers')
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
]
|
|
919
|
+
}]),
|
|
920
|
+
{
|
|
921
|
+
test: /\.less$/,
|
|
922
|
+
use: [
|
|
923
|
+
//'style-loader',
|
|
924
|
+
//'css-loader',
|
|
925
|
+
'less-loader'
|
|
926
|
+
]
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
test: /\.css$/,
|
|
930
|
+
use: [
|
|
931
|
+
//'style-loader',
|
|
932
|
+
{
|
|
933
|
+
loader: 'css-loader'
|
|
934
|
+
}
|
|
935
|
+
]
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
939
|
+
loader: 'url-loader'
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
test: /\.(ico|gif|png|jpe?g|svg)$/i,
|
|
943
|
+
use: [{
|
|
944
|
+
loader: 'file-loader',
|
|
945
|
+
options: {
|
|
946
|
+
name: '[name].[ext]',
|
|
947
|
+
outputPath: "../images/",
|
|
948
|
+
publicPath: '/omnia/images/'
|
|
949
|
+
}
|
|
950
|
+
}]
|
|
951
|
+
//loader: 'url-loader'
|
|
952
|
+
}
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
}
|
|
866
957
|
function buildCommonChunk(entry) {
|
|
867
958
|
let bundleOptions = getBuildOption().bundleOptions;
|
|
868
959
|
let minChunk = bundleOptions.commonsChunk.minChunks || 2;
|
|
@@ -898,7 +989,7 @@ function buildCommonChunk(entry) {
|
|
|
898
989
|
function processManifestGenerated(entries, outDir) {
|
|
899
990
|
var allowJsOutputExtensions = [".js", ".ts", ".tsx", ".jsx", ".vue"];
|
|
900
991
|
if (entries) {
|
|
901
|
-
var manifestsPaths =
|
|
992
|
+
var manifestsPaths = (0, globby_1.globbySync)(outDir.replace(/\/$/, '') + '/*.*', {});
|
|
902
993
|
if (manifestsPaths) {
|
|
903
994
|
for (let p of manifestsPaths) {
|
|
904
995
|
var manifestId = $.tooling.utils.getGuidValue($.tooling.utils.getFileName(p));
|
|
@@ -1169,7 +1260,8 @@ function buildModuleName() {
|
|
|
1169
1260
|
replace: function (modulePath) {
|
|
1170
1261
|
var buildOptions = getBuildOption();
|
|
1171
1262
|
if (buildOptions && buildOptions.moduleOptions && buildOptions.moduleOptions.enableTransformResourcePath) {
|
|
1172
|
-
if (modulePath.indexOf('./node_modules/') === -1 // ignore from npm package
|
|
1263
|
+
if (modulePath.indexOf('./node_modules/') === -1 // ignore from npm package and in wwwwroot .js file
|
|
1264
|
+
&& (modulePath.indexOf('./wwwroot/') === -1 || path_1.default.extname(modulePath) === ".js")
|
|
1173
1265
|
&& modulePath.indexOf('./omnia/fx/models/ConfigurationComposers') === -1 // ignore comment interface for special case here
|
|
1174
1266
|
&& $.fs.existsSync(modulePath)) {
|
|
1175
1267
|
let stream = $.fs.readFileSync(modulePath, 'utf8');
|
|
@@ -1228,89 +1320,18 @@ function getServiceId() {
|
|
|
1228
1320
|
return serviceId;
|
|
1229
1321
|
}
|
|
1230
1322
|
exports.getServiceId = getServiceId;
|
|
1231
|
-
function
|
|
1232
|
-
let foundTypes = {};
|
|
1233
|
-
componentRegistrations.forEach((comp) => {
|
|
1234
|
-
let defPaths = comp.componentOptions.typings;
|
|
1235
|
-
if (defPaths) {
|
|
1236
|
-
let isChildSpec = false;
|
|
1237
|
-
defPaths.forEach((defPath) => {
|
|
1238
|
-
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
|
|
1239
|
-
let contents = $.fs.readFileSync(entryPointPath, 'utf8');
|
|
1240
|
-
let wcEl = getWcElement(contents, isChildSpec);
|
|
1241
|
-
if (wcEl) {
|
|
1242
|
-
//Now lets find the interface mapped to element
|
|
1243
|
-
//example /*@WebComponentInterface("omfx-dialog")*/
|
|
1244
|
-
let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
|
|
1245
|
-
let interfaceIndex = contents.indexOf(interfaceToken);
|
|
1246
|
-
if (interfaceIndex > -1) {
|
|
1247
|
-
let wcProps = [];
|
|
1248
|
-
let intf = contents.substring(interfaceIndex);
|
|
1249
|
-
let nextIsDomProp = false;
|
|
1250
|
-
intf = intf
|
|
1251
|
-
.substring(intf.indexOf("{") + 1, intf.indexOf("}"))
|
|
1252
|
-
.replace(/\?/g, '')
|
|
1253
|
-
.trim()
|
|
1254
|
-
.split(/\r\n|\r|\n/g).forEach((group) => {
|
|
1255
|
-
/*@DomProperty*/
|
|
1256
|
-
let sub = group.trim();
|
|
1257
|
-
if (sub.indexOf("/*@DomProperty*/") > -1) {
|
|
1258
|
-
nextIsDomProp = true;
|
|
1259
|
-
return;
|
|
1260
|
-
}
|
|
1261
|
-
if (nextIsDomProp) {
|
|
1262
|
-
if (sub.indexOf(':')) {
|
|
1263
|
-
sub = sub.split(':')[0];
|
|
1264
|
-
}
|
|
1265
|
-
if (sub) {
|
|
1266
|
-
if (!foundTypes[wcEl]) {
|
|
1267
|
-
foundTypes[wcEl] = [];
|
|
1268
|
-
}
|
|
1269
|
-
foundTypes[wcEl].push(sub);
|
|
1270
|
-
}
|
|
1271
|
-
nextIsDomProp = false;
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
isChildSpec = true;
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
});
|
|
1280
|
-
return foundTypes;
|
|
1281
|
-
}
|
|
1282
|
-
var lastWcElement = "";
|
|
1283
|
-
function getWcElement(contents, isChildSpec) {
|
|
1284
|
-
if (isChildSpec) {
|
|
1285
|
-
if (lastWcElement === "") {
|
|
1286
|
-
new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
|
|
1287
|
-
}
|
|
1288
|
-
return lastWcElement;
|
|
1289
|
-
}
|
|
1290
|
-
else {
|
|
1291
|
-
lastWcElement = "";
|
|
1292
|
-
}
|
|
1293
|
-
let wcElToken = "/*@WebComponent*/";
|
|
1294
|
-
let wcElIndex = contents.indexOf(wcElToken);
|
|
1295
|
-
let wcEl = "";
|
|
1296
|
-
if (wcElIndex > -1) {
|
|
1297
|
-
wcEl = contents.substring(wcElIndex);
|
|
1298
|
-
wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
|
|
1299
|
-
wcEl = wcEl.substring(0, wcEl.indexOf('"'));
|
|
1300
|
-
lastWcElement = wcEl;
|
|
1301
|
-
}
|
|
1302
|
-
return lastWcElement;
|
|
1303
|
-
}
|
|
1304
|
-
function createVueEntryFormRegistrations(registrations) {
|
|
1323
|
+
function createVueEntryFormComponentRegistrations(registrations) {
|
|
1305
1324
|
let entryPaths = {};
|
|
1306
1325
|
for (let r of registrations) {
|
|
1307
|
-
if (r.componentOptions.entryPoint.endsWith('.
|
|
1326
|
+
if (r.componentOptions.entryPoint.endsWith('.tsx')
|
|
1327
|
+
|| r.componentOptions.entryPoint.endsWith('.vue')) {
|
|
1308
1328
|
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
|
|
1309
1329
|
let entryId = r.manifest.resourceId;
|
|
1310
1330
|
if (r.manifest.resourceName) {
|
|
1311
1331
|
entryId = `${r.manifest.resourceName}_${entryId}`;
|
|
1312
1332
|
}
|
|
1313
|
-
|
|
1333
|
+
r.componentOptions.entryPointPath = entryPointPath[0];
|
|
1334
|
+
entryPaths[entryId.toString()] = entryPointPath;
|
|
1314
1335
|
}
|
|
1315
1336
|
else {
|
|
1316
1337
|
$.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
|
|
@@ -1321,7 +1342,6 @@ function createVueEntryFormRegistrations(registrations) {
|
|
|
1321
1342
|
}
|
|
1322
1343
|
function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFilePath) {
|
|
1323
1344
|
let manifest = $.tooling.composer.getManifestById(currentManifestId);
|
|
1324
|
-
let hasChanged = false;
|
|
1325
1345
|
const content = fsExtra.readFileSync(manifestBundleFilePath, 'utf8');
|
|
1326
1346
|
const addDependency = (dependOnmanifestId, dependOnServiceId) => {
|
|
1327
1347
|
let hasNewDependency = false;
|
|
@@ -1345,7 +1365,7 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1345
1365
|
if (manifestObject && manifestObject.content) {
|
|
1346
1366
|
Object.keys(manifestObject.content).forEach((modulePath) => {
|
|
1347
1367
|
if (content.indexOf(modulePath) > -1) {
|
|
1348
|
-
|
|
1368
|
+
addDependency(manifest.resourceId, manifest.serviceId);
|
|
1349
1369
|
return;
|
|
1350
1370
|
}
|
|
1351
1371
|
});
|
|
@@ -1378,7 +1398,7 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1378
1398
|
hasDependency = true;
|
|
1379
1399
|
}
|
|
1380
1400
|
if (hasDependency) {
|
|
1381
|
-
|
|
1401
|
+
addDependency($.tooling.utils.getGuidValue(entryName));
|
|
1382
1402
|
break;
|
|
1383
1403
|
}
|
|
1384
1404
|
}
|
|
@@ -1386,10 +1406,6 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1386
1406
|
}
|
|
1387
1407
|
});
|
|
1388
1408
|
}
|
|
1389
|
-
if (hasChanged) {
|
|
1390
|
-
let manifestsData = $.tooling.composer.getManifestData();
|
|
1391
|
-
$.tooling.composer.updateManifestData(manifestsData);
|
|
1392
|
-
}
|
|
1393
1409
|
}
|
|
1394
1410
|
exports.ensureManifestDependencyInRuntime = ensureManifestDependencyInRuntime;
|
|
1395
1411
|
function buildManifestsDependency(entries, manifestId, manifestBundleContent) {
|
|
@@ -1480,15 +1496,12 @@ function chunkAsset(entries, compilation, fileName, viteHmrOption) {
|
|
|
1480
1496
|
/******/ }
|
|
1481
1497
|
/******/ omniaLoader['${omniaServiceId}'] = omniaLoader['${omniaServiceId}'] || {};
|
|
1482
1498
|
/******/
|
|
1483
|
-
/******/ function
|
|
1499
|
+
/******/ function hmrPreBundle() {
|
|
1484
1500
|
${content}
|
|
1485
1501
|
/******/ }
|
|
1486
1502
|
|
|
1487
|
-
if (omniaLoader['${omniaServiceId}']['${manifestId}']){
|
|
1488
|
-
omniaLoader['${omniaServiceId}']['${manifestId}']
|
|
1489
|
-
}
|
|
1490
|
-
else {
|
|
1491
|
-
omniaLoader['${omniaServiceId}']['${manifestId}'] = preBundle;
|
|
1503
|
+
if (!omniaLoader['${omniaServiceId}']['${manifestId}']){
|
|
1504
|
+
omniaLoader['${omniaServiceId}']['${manifestId}'] = hmrPreBundle;
|
|
1492
1505
|
}`;
|
|
1493
1506
|
}
|
|
1494
1507
|
else if (viteHmrOption == 'dynamic') {
|
|
@@ -1576,13 +1589,6 @@ function checkDuplicateWebpackEntryPoints(entries) {
|
|
|
1576
1589
|
});
|
|
1577
1590
|
return foundDuplicated;
|
|
1578
1591
|
}
|
|
1579
|
-
function isEnableMeasureBuild() {
|
|
1580
|
-
let enableMeasure = $.composers.DevelopmentBuildConfiguration.isEnableMeasureBuild;
|
|
1581
|
-
if (enableMeasure !== true && process.argv.length > 0) {
|
|
1582
|
-
enableMeasure = process.argv.find(argv => argv === "--measure") !== undefined;
|
|
1583
|
-
}
|
|
1584
|
-
return enableMeasure;
|
|
1585
|
-
}
|
|
1586
1592
|
function prefixCssSelector() {
|
|
1587
1593
|
//var applyToSelectors = ['input', '::before', '::after'];
|
|
1588
1594
|
//var applyToSelectors = ['select', 'textarea', 'button', 'input', '.btn', '.content', '.input-group', '.title', '.icon', '*'];
|
|
@@ -1639,45 +1645,9 @@ exports.registerManifestsReference = registerManifestsReference;
|
|
|
1639
1645
|
function getRegisteredReferenceManifests() {
|
|
1640
1646
|
return _registeredReferenceManifests;
|
|
1641
1647
|
}
|
|
1642
|
-
function registerWebComponentDefinitions(definitions) {
|
|
1643
|
-
if (definitions) {
|
|
1644
|
-
_wcDefinitions = $.merge(_wcDefinitions, definitions);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
|
|
1648
|
-
function getRegisteredWebComponentDefinitions() {
|
|
1649
|
-
return _wcDefinitions;
|
|
1650
|
-
}
|
|
1651
1648
|
function sortString(a, b) {
|
|
1652
1649
|
if (a >= b) {
|
|
1653
1650
|
return 1;
|
|
1654
1651
|
}
|
|
1655
1652
|
return -1;
|
|
1656
1653
|
}
|
|
1657
|
-
function generateWebComponentTypings(wc, template) {
|
|
1658
|
-
// export default defineVueWebComponent
|
|
1659
|
-
let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
1660
|
-
let content = fsExtra.readFileSync(wcPath, 'utf8');
|
|
1661
|
-
if (content.indexOf("defineVueWebComponent") > -1) {
|
|
1662
|
-
if (!new RegExp('export\\s+default\\s+').test(content)) {
|
|
1663
|
-
throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
|
|
1664
|
-
}
|
|
1665
|
-
let friendlyManifestId = `wc${wc.manifest.resourceId.replace(/-/g, '').toLowerCase()}`;
|
|
1666
|
-
let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
|
|
1667
|
-
if (importPath.indexOf("./") === 0) {
|
|
1668
|
-
importPath = importPath.replace("./", "");
|
|
1669
|
-
}
|
|
1670
|
-
if ($.isExtensionEnv) {
|
|
1671
|
-
importPath = `../../../../${importPath}`;
|
|
1672
|
-
}
|
|
1673
|
-
else {
|
|
1674
|
-
importPath = `../../../${importPath}`;
|
|
1675
|
-
}
|
|
1676
|
-
return template
|
|
1677
|
-
.replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
|
|
1678
|
-
//{{importWC}}`)
|
|
1679
|
-
.replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
|
|
1680
|
-
//{{elementName}}`);
|
|
1681
|
-
}
|
|
1682
|
-
return template;
|
|
1683
|
-
}
|