@omnia/tooling-vue 7.5.75-dev → 8.0.0-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/babel/preset-jsx.d.ts +2 -8
- package/internal-do-not-import-from-here/babel/preset-jsx.js +7 -105
- 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 +2038 -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 -100
- package/internal-do-not-import-from-here/shared.js +97 -208
- 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 +304 -353
- 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/tsc.js +1 -0
- package/internal-do-not-import-from-here/tasks/vendor.js +163 -40
- 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 +6 -2
- package/internal-do-not-import-from-here/vite/hmr/manifest.js +6 -7
- package/internal-do-not-import-from-here/vite/hmr/runtime.js +8 -6
- package/internal-do-not-import-from-here/vite/hmr/transformers/importPath.js +10 -6
- package/internal-do-not-import-from-here/vite/hmr/transformers/internal/dynamicBundle.js +14 -3
- package/internal-do-not-import-from-here/vite/hmr/transformers/internal/omniaRuntime.js +8 -8
- package/internal-do-not-import-from-here/vite/hmr/transformers/vendorImportPath.d.ts +4 -0
- package/internal-do-not-import-from-here/vite/hmr/transformers/vendorImportPath.js +2 -1
- 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 +12 -8
- package/internal-do-not-import-from-here/vite/hmr/utils/webpack.js +2 -2
- package/internal-do-not-import-from-here/vite/hmr/vueJsx.d.ts +4 -3
- package/internal-do-not-import-from-here/vite/hmr/vueJsx.js +160 -54
- package/internal-do-not-import-from-here/vite/index.js +4 -0
- package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +22 -18
- package/internal-do-not-import-from-here/vite/middlewares/OmniaMiddleware.js +55 -17
- package/internal-do-not-import-from-here/vite/middlewares/StaticFileMiddleware.js +32 -11
- package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.js +1 -1
- package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +44 -26
- 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/ingore-vuetify-locale.js +1 -1
- 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 +25 -4
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +33 -32
- 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 +14 -11
- 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 -322
- 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
|
|
12
|
+
const tooling_composers_1 = require("@omnia/tooling-composers");
|
|
13
13
|
const fx_models_1 = require("@omnia/fx-models");
|
|
14
14
|
const $ = tslib_1.__importStar(require("../variables"));
|
|
15
15
|
const shared_1 = require("../shared");
|
|
16
16
|
const tooling_1 = require("@omnia/tooling");
|
|
17
|
+
const doc_1 = require("./doc");
|
|
17
18
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
18
19
|
const ConcatSource = require('webpack-core/lib/ConcatSource');
|
|
19
20
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
20
21
|
const isEqual = require('lodash/isEqual');
|
|
21
|
-
|
|
22
|
+
const vendorProdId = "aaf89b2d-5ea8-4b79-946a-8c1e89f713a3";
|
|
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,8 +38,27 @@ $.tooling.core.registerBuildTask({
|
|
|
36
38
|
order: 2,
|
|
37
39
|
task: function () {
|
|
38
40
|
return new Promise(function (resolve, reject) {
|
|
39
|
-
|
|
40
|
-
.then(
|
|
41
|
+
buildEntries()
|
|
42
|
+
.then((result) => {
|
|
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
|
+
}
|
|
61
|
+
}, reject);
|
|
41
62
|
});
|
|
42
63
|
}
|
|
43
64
|
});
|
|
@@ -51,7 +72,7 @@ $.tooling.core.registerServeTask({
|
|
|
51
72
|
fsExtra.removeSync("node_modules/tiptap-commands/node_modules");
|
|
52
73
|
fsExtra.removeSync("node_modules/tiptap-utils/node_modules");
|
|
53
74
|
}
|
|
54
|
-
|
|
75
|
+
buildEntries(true)
|
|
55
76
|
.then(resolve, reject);
|
|
56
77
|
});
|
|
57
78
|
}
|
|
@@ -170,80 +191,38 @@ function clean() {
|
|
|
170
191
|
return new Promise(function (resolve, reject) {
|
|
171
192
|
del_1.default.sync("node_modules/.cache");
|
|
172
193
|
del_1.default.sync($.tooling.utils.root(outDirManifestMetadata + "/manifest.entries.cached.json"));
|
|
173
|
-
|
|
174
|
-
del_1.default.sync($.path.resolve(__dirname, "../wctypings.ts"));
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
del_1.default.sync($.path.resolve(__dirname, `../bb000000-0000-bbbb-0000-0000000000bb.wctypings.ts`));
|
|
178
|
-
}
|
|
194
|
+
shared_1.ConfigurationManager.webComponentTypings.delete();
|
|
179
195
|
resolve();
|
|
180
196
|
});
|
|
181
197
|
}
|
|
182
|
-
function
|
|
183
|
-
return new Promise(function (resolve, reject) {
|
|
198
|
+
function buildEntries(serve = false) {
|
|
199
|
+
return new Promise(async function (resolve, reject) {
|
|
184
200
|
try {
|
|
185
|
-
|
|
201
|
+
let startTime = new Date().getTime();
|
|
186
202
|
var componentRegistry = $.composers.ComponentRegistry;
|
|
187
203
|
let componentRegistrations = componentRegistry.getRegistrations();
|
|
204
|
+
const serviceInfo = $.composers.ServiceManifestRegistry.getServiceInfo();
|
|
205
|
+
startTime = new Date().getTime();
|
|
188
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
|
+
}
|
|
189
211
|
var resourceRegistry = $.composers.ResourceRegistry;
|
|
190
212
|
let resourceBundlesWithBuildOptions = resourceRegistry.getRegisteredResourceBundles(shared_1.convertManifestPathToEntryPath);
|
|
191
|
-
$.tooling.logTime("Found [" +
|
|
213
|
+
$.tooling.logTime("Found [" + resourceBundlesWithBuildOptions?.size + "] resource bundles", startTime);
|
|
192
214
|
let resourceEntries = {};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
let
|
|
196
|
-
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]);
|
|
197
218
|
if (!resource.buildOptions) {
|
|
198
|
-
resourceEntries[`${manifest.resourceName ? manifest.resourceName + "_" : ""}${
|
|
219
|
+
resourceEntries[`${manifest.resourceName ? manifest.resourceName + "_" : ""}${res[0]}`] = resource.paths;
|
|
199
220
|
}
|
|
200
221
|
else {
|
|
201
222
|
//Some special handling of buildoptions
|
|
202
|
-
console.log("debug " +
|
|
223
|
+
console.log("debug " + res[0] + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
|
|
203
224
|
}
|
|
204
225
|
}
|
|
205
|
-
//We only support typings for registered web components
|
|
206
|
-
wcDomProps = extractTypingsForComponents(componentRegistrations);
|
|
207
|
-
if (Object.keys(wcDomProps).length > 0) {
|
|
208
|
-
let wcDomPropsDesc = `Extracted web component typings for ${Object.keys(wcDomProps).length} component(s)`;
|
|
209
|
-
$.tooling.logTime(wcDomPropsDesc, startTime);
|
|
210
|
-
}
|
|
211
|
-
if ($.isExtensionEnv) {
|
|
212
|
-
wcDefinitionsPath = $.path.resolve(__dirname, "../wcdefinitions.json");
|
|
213
|
-
wcTypingsPath = $.path.resolve(__dirname, "../wctypings.ts");
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
wcDefinitionsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wcdefinitions.json`);
|
|
217
|
-
wcTypingsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wctypings.ts`);
|
|
218
|
-
}
|
|
219
|
-
fsExtra.writeJsonSync(wcDefinitionsPath, wcDomProps);
|
|
220
|
-
let wcTypings = `import * as base from "vue-tsx-support/types/base";
|
|
221
|
-
//{{importWC}}
|
|
222
|
-
declare global {
|
|
223
|
-
namespace VueTsxSupport.JSX {
|
|
224
|
-
interface Element { }
|
|
225
|
-
interface ElementClass { }
|
|
226
|
-
|
|
227
|
-
interface IntrinsicElements {
|
|
228
|
-
//{{elementName}}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
`;
|
|
233
|
-
if ($.isExtensionEnv) {
|
|
234
|
-
wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
|
|
235
|
-
${wcTypings}`;
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
|
|
239
|
-
${wcTypings}`;
|
|
240
|
-
}
|
|
241
|
-
componentRegistrations.forEach(wc => {
|
|
242
|
-
wcTypings = generateWebComponentTypings(wc, wcTypings);
|
|
243
|
-
});
|
|
244
|
-
fsExtra.outputFileSync(wcTypingsPath, wcTypings);
|
|
245
|
-
wcDomProps = $.merge(wcDomProps, getRegisteredWebComponentDefinitions());
|
|
246
|
-
let componentEntries = createVueEntryFormRegistrations(componentRegistrations);
|
|
247
226
|
var entries = $.merge(componentEntries, resourceEntries);
|
|
248
227
|
if (checkDuplicateWebpackEntryPoints(entries)) {
|
|
249
228
|
$.tooling.log('Build manifests metadata have error that found duplicated resource path', $.tooling.LogTypes.Error);
|
|
@@ -294,7 +273,15 @@ function buildManifestMetadatas(entries) {
|
|
|
294
273
|
return;
|
|
295
274
|
}
|
|
296
275
|
$.tooling.log('Build manifests metadata running...', $.tooling.LogTypes.HeadLine);
|
|
297
|
-
let
|
|
276
|
+
let webpackConfigs = [];
|
|
277
|
+
Object.keys(entries).forEach((id) => {
|
|
278
|
+
var entry = {};
|
|
279
|
+
entry[id] = entries[id];
|
|
280
|
+
var vueWebpackConfig = createWebpackConfigForManifestMetadata(entry, outputDir);
|
|
281
|
+
webpackConfigs.push(vueWebpackConfig);
|
|
282
|
+
});
|
|
283
|
+
let compiler = $.webpack(webpackConfigs);
|
|
284
|
+
compiler.run((err, stats) => {
|
|
298
285
|
Object.keys(entries).forEach((entry) => {
|
|
299
286
|
let manifestPath = outputDir + "/" + entry + '.manifest.json';
|
|
300
287
|
if ($.fs.existsSync($.tooling.utils.root(manifestPath))) {
|
|
@@ -308,17 +295,6 @@ function buildManifestMetadatas(entries) {
|
|
|
308
295
|
$.fs.writeFileSync(manifestPath, JSON.stringify(manifestJson));
|
|
309
296
|
}
|
|
310
297
|
});
|
|
311
|
-
};
|
|
312
|
-
let webpackConfigs = [];
|
|
313
|
-
Object.keys(entries).forEach((id) => {
|
|
314
|
-
var entry = {};
|
|
315
|
-
entry[id] = entries[id];
|
|
316
|
-
var vueWebpackConfig = createWebpackConfigForManifestMetadata(entry, outputDir);
|
|
317
|
-
webpackConfigs.push(vueWebpackConfig);
|
|
318
|
-
});
|
|
319
|
-
let compiler = $.webpack(webpackConfigs);
|
|
320
|
-
compiler.run((err, stats) => {
|
|
321
|
-
updateMetadataFiles();
|
|
322
298
|
$.del.sync([outputDir + '/*.js']);
|
|
323
299
|
if (err) {
|
|
324
300
|
$.tooling.logTime(`Build manifests metadata have an exception`, startTime);
|
|
@@ -373,16 +349,33 @@ function beforeBundleManifest(entries) {
|
|
|
373
349
|
isRunBuildMetadata = !isEqual(entries, cachedEntries);
|
|
374
350
|
}
|
|
375
351
|
if (isRunBuildMetadata) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
|
|
352
|
+
// cleanup before generate
|
|
353
|
+
del_1.default.sync(outDirManifestMetadata);
|
|
354
|
+
const entriesToBuild = {};
|
|
355
|
+
const resourceRegistrations = Array.from($.composers.ResourceRegistry.getResourceRegistrations().keys());
|
|
356
|
+
const wcRegistrations = $.composers.ComponentRegistry.getComponentRegistrations();
|
|
357
|
+
Object.keys(entries).forEach(name => {
|
|
358
|
+
if (resourceRegistrations.find(rk => name.indexOf(rk.toString()) > -1)) {
|
|
359
|
+
entriesToBuild[name] = entries[name];
|
|
360
|
+
}
|
|
361
|
+
// generate manifest metadata for wc
|
|
362
|
+
else if (wcRegistrations.find(rk => name.indexOf(rk.manifest.resourceId.toString()) > -1)) {
|
|
363
|
+
const manifestPath = $.tooling.utils.root(outDirManifestMetadata + "/" + name + '.manifest.json');
|
|
364
|
+
const content = {
|
|
365
|
+
name: `omniaWebpackJsonp['${getServiceId()}']['${$.tooling.utils.getGuidValue(name)}']`,
|
|
366
|
+
content: {
|
|
367
|
+
[entries[name][0]]: {
|
|
368
|
+
id: entries[name][0].toLowerCase(),
|
|
369
|
+
buildMeta: {
|
|
370
|
+
exportsType: "namespace"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
fsExtra.ensureFileSync(manifestPath);
|
|
376
|
+
fsExtra.writeJsonSync(manifestPath, content);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
386
379
|
buildManifestMetadatas(entriesToBuild).then(() => {
|
|
387
380
|
fsExtra.ensureFileSync(cachedEntriesPath);
|
|
388
381
|
fsExtra.writeJsonSync(cachedEntriesPath, entries);
|
|
@@ -396,7 +389,6 @@ function beforeBundleManifest(entries) {
|
|
|
396
389
|
});
|
|
397
390
|
}
|
|
398
391
|
function bundleManifest(entries) {
|
|
399
|
-
var startTime = new Date().getTime();
|
|
400
392
|
return new Promise(function (resolve, reject) {
|
|
401
393
|
try {
|
|
402
394
|
// Hacky solution to delete node_modules inside tiptap regarding miss match version prosemirror
|
|
@@ -438,14 +430,18 @@ function bundleManifest(entries) {
|
|
|
438
430
|
}
|
|
439
431
|
else {
|
|
440
432
|
let webpackConfigs = [];
|
|
433
|
+
var startTime = new Date().getTime();
|
|
434
|
+
// $.tooling.logTime('Build Webpack Config running', startTime);
|
|
441
435
|
Object.keys(entries).forEach((id) => {
|
|
442
436
|
var entry = {};
|
|
443
437
|
entry[id] = entries[id];
|
|
444
438
|
var vueWebpackConfig = createVueWebpackConfig(entry, entries, $.tooling.composer.OmniaOutput.OutputBundlePath);
|
|
445
439
|
webpackConfigs.push(vueWebpackConfig);
|
|
446
440
|
});
|
|
441
|
+
// $.tooling.logTime('Build Webpack Config - done', startTime);
|
|
447
442
|
let compiler = $.webpack(webpackConfigs);
|
|
448
443
|
compiler.run((err, stats) => {
|
|
444
|
+
//console.log("webpack run -done")
|
|
449
445
|
if (checkDuplicateBundle()) { // detect duplicated bundle
|
|
450
446
|
$.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
|
|
451
447
|
reject();
|
|
@@ -527,68 +523,48 @@ function minifyBundles() {
|
|
|
527
523
|
if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
|
|
528
524
|
let startTime = new Date().getTime();
|
|
529
525
|
$.tooling.log('Minify bundles running...');
|
|
530
|
-
const jsPaths =
|
|
526
|
+
const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`]);
|
|
531
527
|
let promises = [];
|
|
532
528
|
jsPaths.forEach(filePath => {
|
|
533
529
|
promises.push(new Promise(async (resolve, reject) => {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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}`);
|
|
546
|
+
}
|
|
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.");
|
|
554
|
+
}
|
|
543
555
|
}));
|
|
544
556
|
});
|
|
545
557
|
Promise.all(promises).then(() => {
|
|
546
558
|
$.tooling.logTime('Done - Minify Js bundles', startTime);
|
|
547
559
|
resolve();
|
|
548
560
|
});
|
|
549
|
-
//const debug = require('gulp-debug');
|
|
550
|
-
//const cleanCSS = require('gulp-clean-css');
|
|
551
|
-
//let processing = 2;
|
|
552
|
-
//let complete = () => {
|
|
553
|
-
// --processing;
|
|
554
|
-
// if (processing === 0) {
|
|
555
|
-
// resolve();
|
|
556
|
-
// }
|
|
557
|
-
//}
|
|
558
|
-
//$.gulp
|
|
559
|
-
// .src(`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`)
|
|
560
|
-
// .pipe(debug({ title: 'Minify Js ->' }))
|
|
561
|
-
// .pipe(terser({
|
|
562
|
-
// ecma: 5 // will remove es5 when not support IE 11
|
|
563
|
-
// }))
|
|
564
|
-
// .pipe(rename(function (path) {
|
|
565
|
-
// path.basename += ".min";
|
|
566
|
-
// }))
|
|
567
|
-
// .pipe(debug({ title: 'Minify Js Done ->' }))
|
|
568
|
-
// .pipe($.gulp.dest($.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)))
|
|
569
|
-
// .on('end', () => {
|
|
570
|
-
// $.tooling.logTime('Done - Minify Js bundles', startTime);
|
|
571
|
-
// complete();
|
|
572
|
-
// })
|
|
573
|
-
//$.gulp.src(`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.css`)
|
|
574
|
-
// .pipe(debug({ title: 'Minify Css ->' }))
|
|
575
|
-
// .pipe(cleanCSS())
|
|
576
|
-
// .pipe(rename(function (path) {
|
|
577
|
-
// path.basename += ".min";
|
|
578
|
-
// }))
|
|
579
|
-
// .pipe(debug({ title: 'Minify Css Done ->' }))
|
|
580
|
-
// .pipe($.gulp.dest($.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)))
|
|
581
|
-
// .on('end', () => {
|
|
582
|
-
// $.tooling.logTime('Done - Minify Css bundles', startTime);
|
|
583
|
-
// complete();
|
|
584
|
-
// })
|
|
585
561
|
}
|
|
586
562
|
else {
|
|
587
563
|
resolve();
|
|
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,
|
|
@@ -651,15 +632,18 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
651
632
|
transform(data, opts) {
|
|
652
633
|
// build manifets stats to detect duplicate bundle
|
|
653
634
|
let entryName = Object.keys(data.assetsByChunkName)[0];
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
635
|
+
// ignore omnia.vendor.prod
|
|
636
|
+
if (entryName.indexOf(vendorProdId) === -1) {
|
|
637
|
+
_manifestsStats[entryName] = [];
|
|
638
|
+
data.modules.filter(m => typeof m.id === 'string'
|
|
639
|
+
&& m.id.trim().length > 0
|
|
640
|
+
&& m.id.indexOf('dll-reference') === -1
|
|
641
|
+
&& m.identifier.indexOf('from dll-reference') === -1).forEach(module => {
|
|
642
|
+
_manifestsStats[entryName].push(module.id);
|
|
643
|
+
_modulesStats[module.id] = _modulesStats[module.id] || new Set();
|
|
644
|
+
_modulesStats[module.id].add(entryName);
|
|
645
|
+
});
|
|
646
|
+
}
|
|
663
647
|
}
|
|
664
648
|
}));
|
|
665
649
|
}
|
|
@@ -685,26 +669,18 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
685
669
|
mangleExports: false,
|
|
686
670
|
concatenateModules: true,
|
|
687
671
|
//moduleIds: 'natural' as any
|
|
688
|
-
}, isBundleCommonChunk ? buildCommonChunk(entry) : {}),
|
|
672
|
+
}, isBundleCommonChunk && !viteHmrOption ? buildCommonChunk(entry) : {}),
|
|
689
673
|
resolve: {
|
|
690
674
|
modules: $.tooling.core.getWebpackResolveModules(),
|
|
691
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx', '.html', '.vue', '.less', '.styl'],
|
|
675
|
+
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.html', '.vue', '.less', '.styl'],
|
|
692
676
|
symlinks: false,
|
|
693
677
|
cacheWithContext: true,
|
|
694
678
|
descriptionFiles: ['package.json'],
|
|
695
|
-
alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), {
|
|
696
|
-
'tiptap$': 'tiptap/dist/tiptap.esm.js',
|
|
697
|
-
'tiptap-utils$': 'tiptap-utils/dist/utils.esm.js',
|
|
698
|
-
'tiptap-extensions$': 'tiptap-extensions/dist/extensions.esm.js',
|
|
699
|
-
'tiptap-commands$': 'tiptap-commands/dist/commands.esm.js',
|
|
700
|
-
'w3c-keyname$': $.path.resolve($.tooling.utils.root(""), 'node_modules/w3c-keyname/index.es.js'),
|
|
679
|
+
alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), (getBuildOption()?.moduleOptions?.alias || {}), {
|
|
701
680
|
'axios$': 'axios/dist/axios.js',
|
|
702
681
|
'typestyle$': 'typestyle/lib.es2015/index.js',
|
|
703
|
-
'vue$': 'vue/dist/vue.esm.js',
|
|
704
|
-
'
|
|
705
|
-
'orderedmap$': 'orderedmap/index.js',
|
|
706
|
-
'@microsoft/signalr': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
707
|
-
"vue-tsx-support/enable-check": $.isExtensionEnv ? $.path.resolve($.tooling.utils.root(""), "node_modules/@omnia/tooling-vue/internal-do-not-import-from-here/tasks/materials//dummy-vue-tsx-support-enable-check.js") : $.path.resolve($.tooling.utils.root(""), "client/tooling/vue/tasks/materials/dummy-vue-tsx-support-enable-check.js")
|
|
682
|
+
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
683
|
+
'@microsoft/signalr$': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
708
684
|
}),
|
|
709
685
|
},
|
|
710
686
|
target: ['web', 'es2022'],
|
|
@@ -727,21 +703,27 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
727
703
|
fullySpecified: false, // disable the behaviour
|
|
728
704
|
},
|
|
729
705
|
},
|
|
730
|
-
...(0, ts_loader_1.default)(
|
|
731
|
-
...(0, tsx_loader_1.default)(
|
|
732
|
-
...(0, jsx_loader_1.default)(getBuildOption().enableTreeShaking, wcDomProps, hotModuleReload),
|
|
706
|
+
...(0, ts_loader_1.default)(),
|
|
707
|
+
...(0, tsx_loader_1.default)(),
|
|
733
708
|
{
|
|
734
709
|
// remove vuetify locale
|
|
735
710
|
test: (path) => {
|
|
736
711
|
const pathInUnixStyle = path.replace(/\\/g, "/");
|
|
737
712
|
if (pathInUnixStyle.indexOf("/vuetify/lib/locale/") > -1
|
|
738
|
-
&& pathInUnixStyle.indexOf("/vuetify/lib/locale/
|
|
739
|
-
&& pathInUnixStyle.indexOf("/vuetify/lib/locale/
|
|
713
|
+
&& pathInUnixStyle.indexOf("/vuetify/lib/locale/adapters") === -1
|
|
714
|
+
&& pathInUnixStyle.indexOf("/vuetify/lib/locale/index.mjs") === -1
|
|
715
|
+
&& pathInUnixStyle.indexOf("/vuetify/lib/locale/en.mjs") === -1) {
|
|
716
|
+
//console.log(pathInUnixStyle)
|
|
740
717
|
return true;
|
|
741
718
|
}
|
|
742
719
|
return false;
|
|
743
720
|
},
|
|
744
|
-
use: 'null-loader',
|
|
721
|
+
// use: 'null-loader',
|
|
722
|
+
use: [
|
|
723
|
+
{
|
|
724
|
+
loader: path_1.default.resolve(__dirname, $.isExtensionEnv ? '../webpack-loaders/ingore-vuetify-locale.js' : '../webpack-loaders/ingore-vuetify-locale.ts'),
|
|
725
|
+
}
|
|
726
|
+
]
|
|
745
727
|
},
|
|
746
728
|
...($.isExtensionEnv ? [] : [{
|
|
747
729
|
test: /\.s(c|a)ss$/,
|
|
@@ -849,7 +831,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
849
831
|
exports.createVueWebpackConfig = createVueWebpackConfig;
|
|
850
832
|
function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
851
833
|
var entensionId = getServiceId();
|
|
852
|
-
return Object.assign({},
|
|
834
|
+
return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
|
|
853
835
|
plugins: [
|
|
854
836
|
...buildReferenceManifestFromConfig(),
|
|
855
837
|
new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
|
|
@@ -861,6 +843,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
|
861
843
|
]
|
|
862
844
|
});
|
|
863
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
|
+
}
|
|
864
957
|
function buildCommonChunk(entry) {
|
|
865
958
|
let bundleOptions = getBuildOption().bundleOptions;
|
|
866
959
|
let minChunk = bundleOptions.commonsChunk.minChunks || 2;
|
|
@@ -896,7 +989,7 @@ function buildCommonChunk(entry) {
|
|
|
896
989
|
function processManifestGenerated(entries, outDir) {
|
|
897
990
|
var allowJsOutputExtensions = [".js", ".ts", ".tsx", ".jsx", ".vue"];
|
|
898
991
|
if (entries) {
|
|
899
|
-
var manifestsPaths =
|
|
992
|
+
var manifestsPaths = (0, globby_1.globbySync)(outDir.replace(/\/$/, '') + '/*.*', {});
|
|
900
993
|
if (manifestsPaths) {
|
|
901
994
|
for (let p of manifestsPaths) {
|
|
902
995
|
var manifestId = $.tooling.utils.getGuidValue($.tooling.utils.getFileName(p));
|
|
@@ -1114,7 +1207,8 @@ function buildReferenceManifest(currentEntry, entries) {
|
|
|
1114
1207
|
return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig());
|
|
1115
1208
|
var currentEntryName = Object.keys(currentEntry)[0];
|
|
1116
1209
|
// exclude omnia vendor
|
|
1117
|
-
if (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1210
|
+
if (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1211
|
+
&& currentEntryName.indexOf(vendorProdId) === -1) {
|
|
1118
1212
|
Object.keys(entries).forEach((entryName) => {
|
|
1119
1213
|
if (entryName !== currentEntryName) {
|
|
1120
1214
|
if ($.fs.existsSync($.tooling.utils.root(outDirManifestMetadata + "/" + entryName + ".manifest.json"))) {
|
|
@@ -1166,7 +1260,8 @@ function buildModuleName() {
|
|
|
1166
1260
|
replace: function (modulePath) {
|
|
1167
1261
|
var buildOptions = getBuildOption();
|
|
1168
1262
|
if (buildOptions && buildOptions.moduleOptions && buildOptions.moduleOptions.enableTransformResourcePath) {
|
|
1169
|
-
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")
|
|
1170
1265
|
&& modulePath.indexOf('./omnia/fx/models/ConfigurationComposers') === -1 // ignore comment interface for special case here
|
|
1171
1266
|
&& $.fs.existsSync(modulePath)) {
|
|
1172
1267
|
let stream = $.fs.readFileSync(modulePath, 'utf8');
|
|
@@ -1225,89 +1320,18 @@ function getServiceId() {
|
|
|
1225
1320
|
return serviceId;
|
|
1226
1321
|
}
|
|
1227
1322
|
exports.getServiceId = getServiceId;
|
|
1228
|
-
function
|
|
1229
|
-
let foundTypes = {};
|
|
1230
|
-
componentRegistrations.forEach((comp) => {
|
|
1231
|
-
let defPaths = comp.componentOptions.typings;
|
|
1232
|
-
if (defPaths) {
|
|
1233
|
-
let isChildSpec = false;
|
|
1234
|
-
defPaths.forEach((defPath) => {
|
|
1235
|
-
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
|
|
1236
|
-
let contents = $.fs.readFileSync(entryPointPath, 'utf8');
|
|
1237
|
-
let wcEl = getWcElement(contents, isChildSpec);
|
|
1238
|
-
if (wcEl) {
|
|
1239
|
-
//Now lets find the interface mapped to element
|
|
1240
|
-
//example /*@WebComponentInterface("omfx-dialog")*/
|
|
1241
|
-
let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
|
|
1242
|
-
let interfaceIndex = contents.indexOf(interfaceToken);
|
|
1243
|
-
if (interfaceIndex > -1) {
|
|
1244
|
-
let wcProps = [];
|
|
1245
|
-
let intf = contents.substring(interfaceIndex);
|
|
1246
|
-
let nextIsDomProp = false;
|
|
1247
|
-
intf = intf
|
|
1248
|
-
.substring(intf.indexOf("{") + 1, intf.indexOf("}"))
|
|
1249
|
-
.replace(/\?/g, '')
|
|
1250
|
-
.trim()
|
|
1251
|
-
.split(/\r\n|\r|\n/g).forEach((group) => {
|
|
1252
|
-
/*@DomProperty*/
|
|
1253
|
-
let sub = group.trim();
|
|
1254
|
-
if (sub.indexOf("/*@DomProperty*/") > -1) {
|
|
1255
|
-
nextIsDomProp = true;
|
|
1256
|
-
return;
|
|
1257
|
-
}
|
|
1258
|
-
if (nextIsDomProp) {
|
|
1259
|
-
if (sub.indexOf(':')) {
|
|
1260
|
-
sub = sub.split(':')[0];
|
|
1261
|
-
}
|
|
1262
|
-
if (sub) {
|
|
1263
|
-
if (!foundTypes[wcEl]) {
|
|
1264
|
-
foundTypes[wcEl] = [];
|
|
1265
|
-
}
|
|
1266
|
-
foundTypes[wcEl].push(sub);
|
|
1267
|
-
}
|
|
1268
|
-
nextIsDomProp = false;
|
|
1269
|
-
}
|
|
1270
|
-
});
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
isChildSpec = true;
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
});
|
|
1277
|
-
return foundTypes;
|
|
1278
|
-
}
|
|
1279
|
-
var lastWcElement = "";
|
|
1280
|
-
function getWcElement(contents, isChildSpec) {
|
|
1281
|
-
if (isChildSpec) {
|
|
1282
|
-
if (lastWcElement === "") {
|
|
1283
|
-
new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
|
|
1284
|
-
}
|
|
1285
|
-
return lastWcElement;
|
|
1286
|
-
}
|
|
1287
|
-
else {
|
|
1288
|
-
lastWcElement = "";
|
|
1289
|
-
}
|
|
1290
|
-
let wcElToken = "/*@WebComponent*/";
|
|
1291
|
-
let wcElIndex = contents.indexOf(wcElToken);
|
|
1292
|
-
let wcEl = "";
|
|
1293
|
-
if (wcElIndex > -1) {
|
|
1294
|
-
wcEl = contents.substring(wcElIndex);
|
|
1295
|
-
wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
|
|
1296
|
-
wcEl = wcEl.substring(0, wcEl.indexOf('"'));
|
|
1297
|
-
lastWcElement = wcEl;
|
|
1298
|
-
}
|
|
1299
|
-
return lastWcElement;
|
|
1300
|
-
}
|
|
1301
|
-
function createVueEntryFormRegistrations(registrations) {
|
|
1323
|
+
function createVueEntryFormComponentRegistrations(registrations) {
|
|
1302
1324
|
let entryPaths = {};
|
|
1303
1325
|
for (let r of registrations) {
|
|
1304
|
-
if (r.componentOptions.entryPoint.endsWith('.
|
|
1326
|
+
if (r.componentOptions.entryPoint.endsWith('.tsx')
|
|
1327
|
+
|| r.componentOptions.entryPoint.endsWith('.vue')) {
|
|
1305
1328
|
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
|
|
1306
1329
|
let entryId = r.manifest.resourceId;
|
|
1307
1330
|
if (r.manifest.resourceName) {
|
|
1308
1331
|
entryId = `${r.manifest.resourceName}_${entryId}`;
|
|
1309
1332
|
}
|
|
1310
|
-
|
|
1333
|
+
r.componentOptions.entryPointPath = entryPointPath[0];
|
|
1334
|
+
entryPaths[entryId.toString()] = entryPointPath;
|
|
1311
1335
|
}
|
|
1312
1336
|
else {
|
|
1313
1337
|
$.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
|
|
@@ -1318,7 +1342,6 @@ function createVueEntryFormRegistrations(registrations) {
|
|
|
1318
1342
|
}
|
|
1319
1343
|
function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFilePath) {
|
|
1320
1344
|
let manifest = $.tooling.composer.getManifestById(currentManifestId);
|
|
1321
|
-
let hasChanged = false;
|
|
1322
1345
|
const content = fsExtra.readFileSync(manifestBundleFilePath, 'utf8');
|
|
1323
1346
|
const addDependency = (dependOnmanifestId, dependOnServiceId) => {
|
|
1324
1347
|
let hasNewDependency = false;
|
|
@@ -1342,7 +1365,7 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1342
1365
|
if (manifestObject && manifestObject.content) {
|
|
1343
1366
|
Object.keys(manifestObject.content).forEach((modulePath) => {
|
|
1344
1367
|
if (content.indexOf(modulePath) > -1) {
|
|
1345
|
-
|
|
1368
|
+
addDependency(manifest.resourceId, manifest.serviceId);
|
|
1346
1369
|
return;
|
|
1347
1370
|
}
|
|
1348
1371
|
});
|
|
@@ -1362,7 +1385,8 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1362
1385
|
if (entryName.toLowerCase() !== currentManifestId.toString().toLowerCase()
|
|
1363
1386
|
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.FxWorkers.toString()) === -1
|
|
1364
1387
|
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.FxCore.toString()) === -1 /* ignore omnia.fx.core, omnia.fx.workers and vendor manifest because ith not loaded by our resource loader */
|
|
1365
|
-
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1388
|
+
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1389
|
+
&& entryName.indexOf(vendorProdId) === -1) {
|
|
1366
1390
|
for (let entryPointPath of _manifestsEntry[entryName]) {
|
|
1367
1391
|
if (!hasDependency) {
|
|
1368
1392
|
var transformresourcePath = _transformResourcepaths.find(resource => resource.original === entryPointPath);
|
|
@@ -1374,7 +1398,7 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1374
1398
|
hasDependency = true;
|
|
1375
1399
|
}
|
|
1376
1400
|
if (hasDependency) {
|
|
1377
|
-
|
|
1401
|
+
addDependency($.tooling.utils.getGuidValue(entryName));
|
|
1378
1402
|
break;
|
|
1379
1403
|
}
|
|
1380
1404
|
}
|
|
@@ -1382,10 +1406,6 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
|
|
|
1382
1406
|
}
|
|
1383
1407
|
});
|
|
1384
1408
|
}
|
|
1385
|
-
if (hasChanged) {
|
|
1386
|
-
let manifestsData = $.tooling.composer.getManifestData();
|
|
1387
|
-
$.tooling.composer.updateManifestData(manifestsData);
|
|
1388
|
-
}
|
|
1389
1409
|
}
|
|
1390
1410
|
exports.ensureManifestDependencyInRuntime = ensureManifestDependencyInRuntime;
|
|
1391
1411
|
function buildManifestsDependency(entries, manifestId, manifestBundleContent) {
|
|
@@ -1416,7 +1436,8 @@ function buildManifestsDependency(entries, manifestId, manifestBundleContent) {
|
|
|
1416
1436
|
if (entryName.toLowerCase() !== manifestId.toLowerCase()
|
|
1417
1437
|
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.FxWorkers.toString()) === -1
|
|
1418
1438
|
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.FxCore.toString()) === -1 /* ignore omnia.fx.core, omnia.fx.workers and vendor manifest because ith not loaded by our resource loader */
|
|
1419
|
-
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1439
|
+
&& entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1440
|
+
&& entryName.indexOf(vendorProdId) === -1) {
|
|
1420
1441
|
for (let entryPointPath of entries[entryName]) {
|
|
1421
1442
|
if (!hasDependency) {
|
|
1422
1443
|
var transformresourcePath = _transformResourcepaths.find(resource => resource.original === entryPointPath);
|
|
@@ -1475,15 +1496,12 @@ function chunkAsset(entries, compilation, fileName, viteHmrOption) {
|
|
|
1475
1496
|
/******/ }
|
|
1476
1497
|
/******/ omniaLoader['${omniaServiceId}'] = omniaLoader['${omniaServiceId}'] || {};
|
|
1477
1498
|
/******/
|
|
1478
|
-
/******/ function
|
|
1499
|
+
/******/ function hmrPreBundle() {
|
|
1479
1500
|
${content}
|
|
1480
1501
|
/******/ }
|
|
1481
1502
|
|
|
1482
|
-
if (omniaLoader['${omniaServiceId}']['${manifestId}']){
|
|
1483
|
-
omniaLoader['${omniaServiceId}']['${manifestId}']
|
|
1484
|
-
}
|
|
1485
|
-
else {
|
|
1486
|
-
omniaLoader['${omniaServiceId}']['${manifestId}'] = preBundle;
|
|
1503
|
+
if (!omniaLoader['${omniaServiceId}']['${manifestId}']){
|
|
1504
|
+
omniaLoader['${omniaServiceId}']['${manifestId}'] = hmrPreBundle;
|
|
1487
1505
|
}`;
|
|
1488
1506
|
}
|
|
1489
1507
|
else if (viteHmrOption == 'dynamic') {
|
|
@@ -1555,7 +1573,8 @@ function checkDuplicateWebpackEntryPoints(entries) {
|
|
|
1555
1573
|
let foundDuplicated = false;
|
|
1556
1574
|
let entryPathInfos = {};
|
|
1557
1575
|
Object.keys(entries).forEach(key => {
|
|
1558
|
-
|
|
1576
|
+
// skip omnia.vendor.prod
|
|
1577
|
+
if (entries[key] && key.indexOf(vendorProdId) === -1) {
|
|
1559
1578
|
entries[key].forEach(path => {
|
|
1560
1579
|
entryPathInfos[path] = entryPathInfos[path] || [];
|
|
1561
1580
|
entryPathInfos[path].push(key);
|
|
@@ -1570,13 +1589,6 @@ function checkDuplicateWebpackEntryPoints(entries) {
|
|
|
1570
1589
|
});
|
|
1571
1590
|
return foundDuplicated;
|
|
1572
1591
|
}
|
|
1573
|
-
function isEnableMeasureBuild() {
|
|
1574
|
-
let enableMeasure = $.composers.DevelopmentBuildConfiguration.isEnableMeasureBuild;
|
|
1575
|
-
if (enableMeasure !== true && process.argv.length > 0) {
|
|
1576
|
-
enableMeasure = process.argv.find(argv => argv === "--measure") !== undefined;
|
|
1577
|
-
}
|
|
1578
|
-
return enableMeasure;
|
|
1579
|
-
}
|
|
1580
1592
|
function prefixCssSelector() {
|
|
1581
1593
|
//var applyToSelectors = ['input', '::before', '::after'];
|
|
1582
1594
|
//var applyToSelectors = ['select', 'textarea', 'button', 'input', '.btn', '.content', '.input-group', '.title', '.icon', '*'];
|
|
@@ -1595,56 +1607,31 @@ function prefixCssSelector() {
|
|
|
1595
1607
|
//exclude: [/.v-tooltip__content/, /.v-menu__content/],
|
|
1596
1608
|
//exclude: [/.v-select/],
|
|
1597
1609
|
transform: function (prefix, selector, prefixedSelector) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
//
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
//
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
//
|
|
1622
|
-
//
|
|
1623
|
-
//}
|
|
1624
|
-
//// Try to prevent warpper to some special preset like html, body,...etc.
|
|
1625
|
-
////if (selector === "html" || selector === "body") {
|
|
1626
|
-
//// return selector;
|
|
1627
|
-
////}
|
|
1628
|
-
////return `[data-omfx] ${selector}, .v-menu__content ${selector}, .v-tooltip__content ${selector}, .v-dialog__content ${selector}`
|
|
1629
|
-
//let match = false;
|
|
1630
|
-
//applyToSelectors.forEach(value => {
|
|
1631
|
-
// if (selector === value) {
|
|
1632
|
-
// match = true;
|
|
1633
|
-
// return;
|
|
1634
|
-
// }
|
|
1635
|
-
//})
|
|
1636
|
-
//if (match) {
|
|
1637
|
-
// return prefixedSelector;
|
|
1638
|
-
//}
|
|
1639
|
-
//// Need to wrapper to .v-tooltip__content, .v-menu__content and .v-dialog__content also because they render at the level below body.
|
|
1640
|
-
//let prefixedClassSelectoreResult = selector;
|
|
1641
|
-
//applyToClassSelector.forEach(value => {
|
|
1642
|
-
// if (selector === value || (selector.lastIndexOf(value) > -1 && selector.lastIndexOf(value) === selector.length - value.length)) {
|
|
1643
|
-
// prefixedClassSelectoreResult = `.v-application ${selector}, .v-menu__content ${selector}, .v-tooltip__content ${selector}, .v-dialog__content ${selector}`
|
|
1644
|
-
// return prefixedClassSelectoreResult;
|
|
1645
|
-
// }
|
|
1646
|
-
//})
|
|
1647
|
-
//return prefixedClassSelectoreResult;
|
|
1610
|
+
return selector;
|
|
1611
|
+
// temp comment out prefix rule below to testing with vuetify 3 in omnia page first.
|
|
1612
|
+
// // Only apply html/body rule in omnia page.
|
|
1613
|
+
// if (selector === "html" || selector === "body") {
|
|
1614
|
+
// return `${selector}[data-omfx]`;
|
|
1615
|
+
// }
|
|
1616
|
+
// // exclude rule .v-application for web component
|
|
1617
|
+
// if (selector === '.v-application') {
|
|
1618
|
+
// return 'html .v-application:not([data-omwc])'
|
|
1619
|
+
// }
|
|
1620
|
+
// // fix issue <v-menu content-class="v-application"
|
|
1621
|
+
// if (selector === '.v-menu__content') {
|
|
1622
|
+
// return 'html div.v-menu__content:not([data-omwc])'
|
|
1623
|
+
// }
|
|
1624
|
+
// if (selector.indexOf('.theme--light') === 0
|
|
1625
|
+
// || selector.indexOf('.theme--dark') === 0
|
|
1626
|
+
// || selector.indexOf('.v-application--is') > -1
|
|
1627
|
+
// || selector.indexOf('.v-tooltip__content') > -1
|
|
1628
|
+
// || selector.indexOf('.v-overlay-container') > -1
|
|
1629
|
+
// || selector.indexOf('.v-menu__content') > -1
|
|
1630
|
+
// || selector.indexOf('.v-dialog__content') > -1) {
|
|
1631
|
+
// //console.log(selector)
|
|
1632
|
+
// return `html ${selector}`;
|
|
1633
|
+
// }
|
|
1634
|
+
// return `[data-omfx] ${selector}, .v-menu__content ${selector}, .v-overlay-container ${selector}, .v-tooltip__content ${selector}, .v-dialog__content ${selector}`
|
|
1648
1635
|
}
|
|
1649
1636
|
});
|
|
1650
1637
|
}
|
|
@@ -1658,45 +1645,9 @@ exports.registerManifestsReference = registerManifestsReference;
|
|
|
1658
1645
|
function getRegisteredReferenceManifests() {
|
|
1659
1646
|
return _registeredReferenceManifests;
|
|
1660
1647
|
}
|
|
1661
|
-
function registerWebComponentDefinitions(definitions) {
|
|
1662
|
-
if (definitions) {
|
|
1663
|
-
_wcDefinitions = $.merge(_wcDefinitions, definitions);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
|
|
1667
|
-
function getRegisteredWebComponentDefinitions() {
|
|
1668
|
-
return _wcDefinitions;
|
|
1669
|
-
}
|
|
1670
1648
|
function sortString(a, b) {
|
|
1671
1649
|
if (a >= b) {
|
|
1672
1650
|
return 1;
|
|
1673
1651
|
}
|
|
1674
1652
|
return -1;
|
|
1675
1653
|
}
|
|
1676
|
-
function generateWebComponentTypings(wc, template) {
|
|
1677
|
-
// export default defineVueWebComponent
|
|
1678
|
-
let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
1679
|
-
let content = fsExtra.readFileSync(wcPath, 'utf8');
|
|
1680
|
-
if (content.indexOf("defineVueWebComponent") > -1) {
|
|
1681
|
-
if (!new RegExp('export\\s+default\\s+').test(content)) {
|
|
1682
|
-
throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
|
|
1683
|
-
}
|
|
1684
|
-
let friendlyManifestId = `wc${wc.manifest.resourceId.replace(/-/g, '').toLowerCase()}`;
|
|
1685
|
-
let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
|
|
1686
|
-
if (importPath.indexOf("./") === 0) {
|
|
1687
|
-
importPath = importPath.replace("./", "");
|
|
1688
|
-
}
|
|
1689
|
-
if ($.isExtensionEnv) {
|
|
1690
|
-
importPath = `../../../../${importPath}`;
|
|
1691
|
-
}
|
|
1692
|
-
else {
|
|
1693
|
-
importPath = `../../../${importPath}`;
|
|
1694
|
-
}
|
|
1695
|
-
return template
|
|
1696
|
-
.replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
|
|
1697
|
-
//{{importWC}}`)
|
|
1698
|
-
.replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": base.CombinedTsxComponentAttrs<typeof ${friendlyManifestId}.propsDefinition, {}, {}, {}, {}, true> & VueComponentBaseProps
|
|
1699
|
-
//{{elementName}}`);
|
|
1700
|
-
}
|
|
1701
|
-
return template;
|
|
1702
|
-
}
|