@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("typescript/lib/tsc");
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const $ = tslib_1.__importStar(require("../variables"));
|
|
5
|
+
const ts_loader_1 = tslib_1.__importDefault(require("../webpack-loaders/ts-loader"));
|
|
5
6
|
const ExtractTextPlugin = require('mini-css-extract-plugin');
|
|
6
7
|
const fsExtra = require('fs-extra');
|
|
7
|
-
fsExtra.copySync('wwwroot/scripts/vue-class-component/vue-class-component.esm.custom.js', 'node_modules/vue-class-component/dist/vue-class-component.esm.js');
|
|
8
8
|
const extractCSS = new ExtractTextPlugin({
|
|
9
9
|
filename: "omnia.vendor.css",
|
|
10
10
|
});
|
|
@@ -122,20 +122,18 @@ $.webpack({
|
|
|
122
122
|
$.tooling.log('omnia shared vendor generated');
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
-
$.tooling.log('omnia vendor running...');
|
|
125
|
+
$.tooling.log('omnia vendor devlopment running...');
|
|
126
126
|
$.webpack({
|
|
127
127
|
mode: 'production',
|
|
128
128
|
devtool: false,
|
|
129
129
|
context: $.tooling.utils.root(""),
|
|
130
130
|
resolve: {
|
|
131
|
-
extensions: ['.js', '.css'],
|
|
131
|
+
extensions: ['.ts', '.js', '.css'],
|
|
132
132
|
alias: {
|
|
133
133
|
'typestyle$': 'typestyle/lib.es2015/index.js',
|
|
134
|
-
|
|
135
|
-
'
|
|
136
|
-
'
|
|
137
|
-
'orderedmap$': 'orderedmap/index.js',
|
|
138
|
-
"vue-tsx-support/enable-check": "./client/tooling/vue/tasks/materials/dummy-vue-tsx-support-enable-check.js"
|
|
134
|
+
// vuetify have not working fully 100% with vue runtime browser only, so temp to full bundle vue now.
|
|
135
|
+
//'vue$': 'vue/dist/vue.runtime.esm-browser.js',
|
|
136
|
+
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
139
137
|
},
|
|
140
138
|
},
|
|
141
139
|
optimization: {
|
|
@@ -148,6 +146,7 @@ $.webpack({
|
|
|
148
146
|
},
|
|
149
147
|
module: {
|
|
150
148
|
rules: [
|
|
149
|
+
...(0, ts_loader_1.default)(),
|
|
151
150
|
{
|
|
152
151
|
test: /\.css(\?|$)/,
|
|
153
152
|
use: [
|
|
@@ -175,14 +174,7 @@ $.webpack({
|
|
|
175
174
|
entry: {
|
|
176
175
|
vendor: [
|
|
177
176
|
"tslib",
|
|
178
|
-
"vue",
|
|
179
|
-
"vue-class-component",
|
|
180
|
-
"vue-property-decorator",
|
|
181
|
-
"vue-tsx-support",
|
|
182
|
-
"vue-tsx-support/enable-check",
|
|
183
|
-
// "vue-tsx-support/lib/vca",
|
|
184
|
-
"@vue/babel-helper-vue-jsx-merge-props",
|
|
185
|
-
// "@vue/composition-api",
|
|
177
|
+
"./client/fx/vue/VueBundler",
|
|
186
178
|
"typestyle",
|
|
187
179
|
"csx",
|
|
188
180
|
"zepto-webpack",
|
|
@@ -243,30 +235,156 @@ $.webpack({
|
|
|
243
235
|
return key;
|
|
244
236
|
` + "return `${styles.$displayName}_${key}`;"
|
|
245
237
|
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (
|
|
264
|
-
|
|
238
|
+
]),
|
|
239
|
+
new $.webpack.DllPlugin({
|
|
240
|
+
path: $.path.resolve(__dirname, "../config/omnia.[name].manifest.json"),
|
|
241
|
+
name: 'omniaVendor',
|
|
242
|
+
entryOnly: false
|
|
243
|
+
}),
|
|
244
|
+
new $.webpack.DefinePlugin({
|
|
245
|
+
//process: { env: { NODE_ENV: JSON.stringify('production') } }
|
|
246
|
+
// temp bundle vue vendor in development mode for support HMR
|
|
247
|
+
// process: { env: { NODE_ENV: JSON.stringify('development') } },
|
|
248
|
+
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
249
|
+
__VUE_OPTIONS_API__: true,
|
|
250
|
+
__VUE_PROD_DEVTOOLS__: true
|
|
251
|
+
})
|
|
252
|
+
]
|
|
253
|
+
})
|
|
254
|
+
.run((err, stats) => {
|
|
255
|
+
if (err || stats.hasErrors()) {
|
|
256
|
+
//console.log(stats.toJson({
|
|
257
|
+
// assets: false,
|
|
258
|
+
// hash: true
|
|
259
|
+
//}))
|
|
260
|
+
$.tooling.log('Omnia vendor have error : \r\n', $.tooling.LogTypes.Error);
|
|
261
|
+
if (err) {
|
|
262
|
+
$.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
stats.toJson().errors.forEach(err => {
|
|
266
|
+
$.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
// generate omnia vendor metadata
|
|
272
|
+
var manifestPath = $.path.resolve(__dirname, "../config/omnia.vendor.manifest.json");
|
|
273
|
+
var manifestJson = require(manifestPath);
|
|
274
|
+
manifestJson.content["./node_modules/webpack/buildin/module.js"] = undefined;
|
|
275
|
+
$.fs.writeFileSync(manifestPath, JSON.stringify(manifestJson));
|
|
276
|
+
$.tooling.log('omnia vendor devlopment generated');
|
|
265
277
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
278
|
+
});
|
|
279
|
+
$.tooling.log('omnia vendor prod running...');
|
|
280
|
+
$.webpack({
|
|
281
|
+
mode: 'production',
|
|
282
|
+
devtool: false,
|
|
283
|
+
context: $.tooling.utils.root(""),
|
|
284
|
+
resolve: {
|
|
285
|
+
extensions: ['.ts', '.js', '.css'],
|
|
286
|
+
alias: {
|
|
287
|
+
'typestyle$': 'typestyle/lib.es2015/index.js',
|
|
288
|
+
// vuetify have not working fully 100% with vue runtime browser only, so temp to full bundle vue now.
|
|
289
|
+
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
290
|
+
//'vue$': 'vue/dist/vue.esm-bundler.js',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
optimization: {
|
|
294
|
+
minimize: false,
|
|
295
|
+
usedExports: false,
|
|
296
|
+
providedExports: true,
|
|
297
|
+
removeAvailableModules: false,
|
|
298
|
+
mangleExports: false,
|
|
299
|
+
concatenateModules: true,
|
|
300
|
+
},
|
|
301
|
+
module: {
|
|
302
|
+
rules: [
|
|
303
|
+
...(0, ts_loader_1.default)(),
|
|
304
|
+
{
|
|
305
|
+
test: /\.css(\?|$)/,
|
|
306
|
+
use: [
|
|
307
|
+
{
|
|
308
|
+
loader: ExtractTextPlugin.loader,
|
|
309
|
+
options: {
|
|
310
|
+
publicPath: '../css'
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
'css-loader',
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
|
|
318
|
+
use: [{
|
|
319
|
+
loader: 'file-loader',
|
|
320
|
+
options: {
|
|
321
|
+
name: '[name].[ext]',
|
|
322
|
+
outputPath: '../fonts/'
|
|
323
|
+
}
|
|
324
|
+
}]
|
|
269
325
|
}
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
entry: {
|
|
329
|
+
vendor: [
|
|
330
|
+
"tslib",
|
|
331
|
+
"./client/fx/vue/VueBundler",
|
|
332
|
+
"typestyle",
|
|
333
|
+
"csx",
|
|
334
|
+
"zepto-webpack",
|
|
335
|
+
"mousetrap",
|
|
336
|
+
"mousetrap-global-bind",
|
|
337
|
+
"dayjs",
|
|
338
|
+
"dayjs/plugin/utc",
|
|
339
|
+
"dayjs/plugin/timezone",
|
|
340
|
+
'dayjs/plugin/duration',
|
|
341
|
+
'dayjs/plugin/relativeTime',
|
|
342
|
+
"dayjs/locale/da.js",
|
|
343
|
+
"dayjs/locale/pl.js",
|
|
344
|
+
"dayjs/locale/fr.js",
|
|
345
|
+
"dayjs/locale/de.js",
|
|
346
|
+
"dayjs/locale/et.js",
|
|
347
|
+
"dayjs/locale/lv.js",
|
|
348
|
+
"dayjs/locale/lt.js",
|
|
349
|
+
"dayjs/locale/sv.js",
|
|
350
|
+
"./wwwroot/scripts/zepto.extras.js",
|
|
351
|
+
// "@material/material-color-utilities"
|
|
352
|
+
]
|
|
353
|
+
},
|
|
354
|
+
output: {
|
|
355
|
+
path: $.path.join($.tooling.utils.root(""), outDir),
|
|
356
|
+
filename: 'omnia.[name].prod.js',
|
|
357
|
+
library: {
|
|
358
|
+
name: 'omniaVendor',
|
|
359
|
+
type: 'window',
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
plugins: [
|
|
363
|
+
new $.webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /ignore/),
|
|
364
|
+
extractCSS,
|
|
365
|
+
new $.omniaWebpackPlugins.NamedModulesPlugin(),
|
|
366
|
+
new $.omniaWebpackPlugins.ModifyContent([
|
|
367
|
+
{
|
|
368
|
+
pattern: /var omniaVendor;omniaVendor/i,
|
|
369
|
+
replacement: "window['omniaVendor'] "
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
pattern: /# sourceMappingURL=\s*(\S+)/g,
|
|
373
|
+
replacement: '# ignore'
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
pattern: /__webpack_module_cache__/g,
|
|
377
|
+
replacement: '__omnia_webpack_module_cache__'
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
pattern: "const key = `f${stringHash(pid)}`;",
|
|
381
|
+
replacement: `
|
|
382
|
+
// <<omnia custom>> support prefix displayname in styleflow
|
|
383
|
+
` + "const key = `f${stringHash(pid)}`;" +
|
|
384
|
+
` if (!styles.$displayName)
|
|
385
|
+
return key;
|
|
386
|
+
` + "return `${styles.$displayName}_${key}`;"
|
|
387
|
+
},
|
|
270
388
|
]),
|
|
271
389
|
new $.webpack.DllPlugin({
|
|
272
390
|
path: $.path.resolve(__dirname, "../config/omnia.[name].manifest.json"),
|
|
@@ -274,7 +392,12 @@ function h(type, props, children) {
|
|
|
274
392
|
entryOnly: false
|
|
275
393
|
}),
|
|
276
394
|
new $.webpack.DefinePlugin({
|
|
277
|
-
process: { env: { NODE_ENV: JSON.stringify('production') } }
|
|
395
|
+
//process: { env: { NODE_ENV: JSON.stringify('production') } },
|
|
396
|
+
// temp bundle vue vendor in development mode for support HMR
|
|
397
|
+
// process: { env: { NODE_ENV: JSON.stringify('development') } },
|
|
398
|
+
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
399
|
+
__VUE_OPTIONS_API__: true,
|
|
400
|
+
__VUE_PROD_DEVTOOLS__: false
|
|
278
401
|
})
|
|
279
402
|
]
|
|
280
403
|
})
|
|
@@ -300,7 +423,7 @@ function h(type, props, children) {
|
|
|
300
423
|
var manifestJson = require(manifestPath);
|
|
301
424
|
manifestJson.content["./node_modules/webpack/buildin/module.js"] = undefined;
|
|
302
425
|
$.fs.writeFileSync(manifestPath, JSON.stringify(manifestJson));
|
|
303
|
-
$.tooling.log('omnia vendor generated');
|
|
426
|
+
$.tooling.log('omnia vendor prod generated');
|
|
304
427
|
}
|
|
305
428
|
});
|
|
306
429
|
// bundle omnia worker vendor
|
|
@@ -5,6 +5,7 @@ import * as composers from "@omnia/tooling-composers";
|
|
|
5
5
|
import * as enums from "../composers/models/Enums";
|
|
6
6
|
import * as composer from '../composers/task';
|
|
7
7
|
import { core, utils } from '@omnia/tooling';
|
|
8
|
+
import { isExtensionEnv } from "./shared";
|
|
8
9
|
import merge from 'webpack-merge';
|
|
9
10
|
import webpack from 'webpack';
|
|
10
11
|
declare var tooling: {
|
|
@@ -16,5 +17,4 @@ declare var tooling: {
|
|
|
16
17
|
LogTypes: typeof utils.LogTypes;
|
|
17
18
|
};
|
|
18
19
|
declare var basePathProcess: string;
|
|
19
|
-
declare var isExtensionEnv: boolean;
|
|
20
20
|
export { omniaWebpackPlugins, basePathProcess, isExtensionEnv, tooling, webpack, chalk, timestamp, path, fs, extend, merge, del, md5File, composers, enums };
|
|
@@ -28,6 +28,8 @@ const enums = tslib_1.__importStar(require("@omnia/tooling-composers/internal-do
|
|
|
28
28
|
exports.enums = enums;
|
|
29
29
|
const composer = tslib_1.__importStar(require("@omnia/tooling-composers/internal-do-not-import-from-here/task"));
|
|
30
30
|
const tooling_1 = require("@omnia/tooling");
|
|
31
|
+
const shared_1 = require("./shared");
|
|
32
|
+
Object.defineProperty(exports, "isExtensionEnv", { enumerable: true, get: function () { return shared_1.isExtensionEnv; } });
|
|
31
33
|
const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
|
|
32
34
|
exports.merge = webpack_merge_1.default;
|
|
33
35
|
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
@@ -36,5 +38,3 @@ var tooling = { composer, core: tooling_1.core, utils: tooling_1.utils, log: too
|
|
|
36
38
|
exports.tooling = tooling;
|
|
37
39
|
var basePathProcess = process.cwd();
|
|
38
40
|
exports.basePathProcess = basePathProcess;
|
|
39
|
-
var isExtensionEnv = fs.existsSync(basePathProcess + "/node_modules/@omnia/tooling-vue/package.json");
|
|
40
|
-
exports.isExtensionEnv = isExtensionEnv;
|
|
@@ -10,6 +10,8 @@ const utils_1 = require("./utils");
|
|
|
10
10
|
const manifest_1 = require("./manifest");
|
|
11
11
|
const vueJsx_1 = require("./vueJsx");
|
|
12
12
|
const $ = tslib_1.__importStar(require("../../variables"));
|
|
13
|
+
const shared_1 = require("../../shared");
|
|
14
|
+
const doc_1 = require("../../tasks/doc");
|
|
13
15
|
let fileGraphs = {};
|
|
14
16
|
let manifests = {};
|
|
15
17
|
const initialManifests = [
|
|
@@ -18,7 +20,7 @@ const initialManifests = [
|
|
|
18
20
|
fx_models_1.OmniaResourceManifests.FxWorkers.toString()
|
|
19
21
|
];
|
|
20
22
|
const esbuildTransformOptions = {
|
|
21
|
-
target: '
|
|
23
|
+
target: 'es2020',
|
|
22
24
|
jsx: 'preserve',
|
|
23
25
|
sourcemap: false,
|
|
24
26
|
legalComments: 'inline'
|
|
@@ -151,6 +153,7 @@ async function buildFileGraph(unknownId, code) {
|
|
|
151
153
|
return { fileGraph, code };
|
|
152
154
|
}
|
|
153
155
|
fileGraph.js.scanned = true;
|
|
156
|
+
code = (0, shared_1.modifyComponent)(code, fileGraph.id);
|
|
154
157
|
const esbuildTransformResult = await (0, vite_1.transformWithEsbuild)(code, id, esbuildTransformOptions);
|
|
155
158
|
code = esbuildTransformResult.code;
|
|
156
159
|
// d.ts or interface only
|
|
@@ -159,10 +162,11 @@ async function buildFileGraph(unknownId, code) {
|
|
|
159
162
|
return { fileGraph, code, esbuildTransformResult };
|
|
160
163
|
}
|
|
161
164
|
if (id.endsWith('.tsx')) {
|
|
162
|
-
code =
|
|
165
|
+
code = (0, vueJsx_1.transformVueJsx)(code, id).code;
|
|
163
166
|
}
|
|
164
167
|
fileGraph.js.metadata = utils_1.moduleAnalysis.analyze(code, id);
|
|
165
168
|
ensureDependencies(id, fileGraph.js.metadata);
|
|
169
|
+
code = (0, doc_1.importSnippetCode)(code, fileGraph.id);
|
|
166
170
|
return { fileGraph, code, esbuildTransformResult };
|
|
167
171
|
}
|
|
168
172
|
exports.buildFileGraph = buildFileGraph;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPreBundleInfo = exports.validatePreBundles = exports.getManifest = exports.clearManifestCollection = exports.getManifestCollection = exports.entriesResolver = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
const globby_1 =
|
|
6
|
+
const globby_1 = require("globby");
|
|
7
7
|
const $ = tslib_1.__importStar(require("../../variables"));
|
|
8
8
|
const fx_models_1 = require("@omnia/fx-models");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
@@ -24,8 +24,7 @@ class ManifestBuildEntriesResolver {
|
|
|
24
24
|
this.preBundle = Object.keys(entries).reduce((preBundleEntries, resourceIdentifier) => {
|
|
25
25
|
const filePaths = entries[resourceIdentifier];
|
|
26
26
|
const resourceId = utils_1.manifestUtils.getResourceIdFromEntryKey(resourceIdentifier);
|
|
27
|
-
if (resourceId == fx_models_1.OmniaResourceManifests.Vendor.toString()
|
|
28
|
-
resourceId == fx_models_1.OmniaResourceManifests.HMR.toString()) {
|
|
27
|
+
if (resourceId == fx_models_1.OmniaResourceManifests.Vendor.toString()) {
|
|
29
28
|
return Object.assign(preBundleEntries, {
|
|
30
29
|
[resourceIdentifier]: filePaths
|
|
31
30
|
});
|
|
@@ -62,7 +61,7 @@ exports.entriesResolver = new ManifestBuildEntriesResolver();
|
|
|
62
61
|
let _manifestCollection;
|
|
63
62
|
function getManifestCollection() {
|
|
64
63
|
if (!_manifestCollection) {
|
|
65
|
-
_manifestCollection = $.tooling.composer.
|
|
64
|
+
_manifestCollection = $.tooling.composer.getManifestsJson();
|
|
66
65
|
}
|
|
67
66
|
return _manifestCollection;
|
|
68
67
|
}
|
|
@@ -85,9 +84,9 @@ function getManifest(resourceId) {
|
|
|
85
84
|
exports.getManifest = getManifest;
|
|
86
85
|
async function validatePreBundles(fileNames) {
|
|
87
86
|
const preBundleDir = utils_1.envUtils.getBundleOutputDirPath();
|
|
88
|
-
const filePaths = fileNames.map(fileName => path_1.default.join(preBundleDir, fileName));
|
|
87
|
+
const filePaths = fileNames.map(fileName => path_1.default.join(preBundleDir, fileName).replace(/\\/g, '/'));
|
|
89
88
|
return new Promise((resolve, reject) => {
|
|
90
|
-
(0, globby_1.
|
|
89
|
+
(0, globby_1.globby)(filePaths).then(result => {
|
|
91
90
|
resolve(result);
|
|
92
91
|
}).catch(reject);
|
|
93
92
|
});
|
|
@@ -96,7 +95,7 @@ exports.validatePreBundles = validatePreBundles;
|
|
|
96
95
|
function getPreBundleInfo() {
|
|
97
96
|
return exports.entriesResolver.getPreBundleEntries().then(entries => {
|
|
98
97
|
const serviceId = $.tooling.composer.getServiceId();
|
|
99
|
-
const manifests = $.tooling.composer.
|
|
98
|
+
const manifests = $.tooling.composer.getManifestsJson();
|
|
100
99
|
return Object.keys(entries).reduce((array, fileName) => {
|
|
101
100
|
const resourceId = utils_1.manifestUtils.getResourceIdFromEntryKey(fileName);
|
|
102
101
|
const filePaths = entries[fileName];
|
|
@@ -43,9 +43,9 @@ function setupHmrPlugin(options, config) {
|
|
|
43
43
|
};
|
|
44
44
|
_runtimeContext = runtimeContext;
|
|
45
45
|
const resolvers = config.resolvers.filter(item => !!item);
|
|
46
|
-
const omniaPackagesPathPattern = (0, vite_1.normalizePath)(path_1.default.join(utils_1.envUtils.getRootDirPath(), 'node_modules/@omnia/*/*'));
|
|
47
|
-
const omniaPackagesDeepImports = (0, globby_1.
|
|
48
|
-
const
|
|
46
|
+
const omniaPackagesPathPattern = (0, vite_1.normalizePath)(path_1.default.join(utils_1.envUtils.getRootDirPath(), 'node_modules/@omnia/*/*').replace(/\\/g, '/'));
|
|
47
|
+
const omniaPackagesDeepImports = (0, globby_1.globbySync)(omniaPackagesPathPattern).map(p => p.replace((0, vite_1.normalizePath)(path_1.default.join(utils_1.envUtils.getRootDirPath(), 'node_modules/')), ''));
|
|
48
|
+
const dep = require(path_1.default.join(utils_1.envUtils.getRootDirPath(), 'package.json'));
|
|
49
49
|
clearCacheAssets();
|
|
50
50
|
// Manifests changed
|
|
51
51
|
// entriesResolver.registerManifestEventHandler(() => {
|
|
@@ -55,8 +55,8 @@ function setupHmrPlugin(options, config) {
|
|
|
55
55
|
config: () => ({
|
|
56
56
|
optimizeDeps: {
|
|
57
57
|
exclude: [
|
|
58
|
-
...Object.keys(dependencies),
|
|
59
|
-
...Object.keys(devDependencies),
|
|
58
|
+
...Object.keys(dep.dependencies || {}),
|
|
59
|
+
...Object.keys(dep.devDependencies || {}),
|
|
60
60
|
...omniaPackagesDeepImports
|
|
61
61
|
]
|
|
62
62
|
},
|
|
@@ -129,7 +129,9 @@ function setupHmrPlugin(options, config) {
|
|
|
129
129
|
]);
|
|
130
130
|
transformerInstanceCache.postInternal.resolved = true;
|
|
131
131
|
}
|
|
132
|
-
if (pathname.includes('/node_modules/')
|
|
132
|
+
if (pathname.includes('/node_modules/')
|
|
133
|
+
// temp hard code add mjs support for vuetify
|
|
134
|
+
&& pathname.indexOf("/vuetify/")) {
|
|
133
135
|
return code;
|
|
134
136
|
}
|
|
135
137
|
const { fileGraph, code: transformedCode, esbuildTransformResult } = await graph.buildFileGraph(pathname, code);
|
|
@@ -30,14 +30,18 @@ exports.importPath = (0, base_1.defineTransformer)("omnia-import-path", (replace
|
|
|
30
30
|
return r.from === moduleName;
|
|
31
31
|
});
|
|
32
32
|
if (!replacer) {
|
|
33
|
-
throw new utils_1.ErrorHMR(
|
|
33
|
+
throw new utils_1.ErrorHMR(`Unexpected: replacer not found during code transform for module : ${moduleName}`);
|
|
34
|
+
}
|
|
35
|
+
const fileGraph = ctx.getFileGraph(replacer.from);
|
|
36
|
+
if (fileGraph && fileGraph.bareImport && fileGraph.js && !fileGraph.js.bareImportVariable) {
|
|
37
|
+
fileGraph.js.bareImportVariable = 'ignored';
|
|
34
38
|
}
|
|
35
39
|
if (replacer.ignore) {
|
|
36
40
|
// allow ignored vendor to register bareImportVariable so dynamicBundle will skip this
|
|
37
|
-
const fileGraph = ctx.getFileGraph(replacer.from);
|
|
38
|
-
if (fileGraph && fileGraph.bareImport && fileGraph.js && !fileGraph.js.bareImportVariable) {
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
+
// const fileGraph = ctx.getFileGraph(replacer.from as string);
|
|
42
|
+
// if (fileGraph && fileGraph.bareImport && fileGraph.js && !fileGraph.js.bareImportVariable) {
|
|
43
|
+
// fileGraph.js.bareImportVariable = 'ignored';
|
|
44
|
+
// }
|
|
41
45
|
return '';
|
|
42
46
|
}
|
|
43
47
|
let importedVariablesStatement = original.substr(0, startIndex + 1);
|
|
@@ -74,7 +78,7 @@ exports.importPath = (0, base_1.defineTransformer)("omnia-import-path", (replace
|
|
|
74
78
|
hasDefaultImports = true;
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
|
-
//
|
|
81
|
+
//console.log(original, transformedStatement);
|
|
78
82
|
return transformedStatement.trim();
|
|
79
83
|
});
|
|
80
84
|
if (hasDefaultImports) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dynamicBundle = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
7
|
const vite_1 = require("vite");
|
|
7
8
|
const webpack_1 = require("webpack");
|
|
8
9
|
const fx_models_1 = require("@omnia/fx-models");
|
|
@@ -204,9 +205,19 @@ function filterDynamicModules(fileGraph, ctx) {
|
|
|
204
205
|
];
|
|
205
206
|
}
|
|
206
207
|
function ensureBundleInjection(code, resourceId) {
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
const injectionJs = `import '${utils_1.pathUtils.HMR_DYNAMIC_BUNDLE_REQUEST}/${resourceId}.js'`;
|
|
209
|
+
const injectionCss = `import '${utils_1.pathUtils.HMR_DYNAMIC_BUNDLE_REQUEST}/${resourceId}.css'`;
|
|
210
|
+
if (code.includes(injectionJs) == false) {
|
|
211
|
+
code = '\n' + injectionJs + '\n' + code;
|
|
212
|
+
}
|
|
213
|
+
if (code.includes(injectionCss) == false) {
|
|
214
|
+
// inject css also if exist
|
|
215
|
+
const bundleDirPath = utils_1.envUtils.getBundleOutputDirPath();
|
|
216
|
+
const bundleFileName = `dynamicbundle_${resourceId}.css`;
|
|
217
|
+
const bundlePath = path_1.default.join(bundleDirPath, bundleFileName);
|
|
218
|
+
if (fs_1.default.existsSync(bundlePath)) {
|
|
219
|
+
code = '\n' + injectionCss + '\n' + code;
|
|
220
|
+
}
|
|
210
221
|
}
|
|
211
222
|
return code;
|
|
212
223
|
}
|
|
@@ -13,14 +13,14 @@ exports.omniaRuntime = (0, base_1.defineTransformer)("omnia-runtime", () => {
|
|
|
13
13
|
transform(code, id, fileGraph, ctx, fromWorker) {
|
|
14
14
|
const transformedResourcePathResult = transformResourcePathRegex.exec(code);
|
|
15
15
|
const webpackModulePath = transformedResourcePathResult?.length > 1 ? transformedResourcePathResult[1] : fileGraph.id;
|
|
16
|
-
if (fromWorker == false) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import.meta.hot.accept();`;
|
|
23
|
-
}
|
|
16
|
+
// if (fromWorker == false) {
|
|
17
|
+
// code = code + "\n" +
|
|
18
|
+
// `
|
|
19
|
+
// /**
|
|
20
|
+
// * Omnia Hot Module Reload
|
|
21
|
+
// */
|
|
22
|
+
// import.meta.hot.accept();`;
|
|
23
|
+
// }
|
|
24
24
|
return '\n' + injectWebpackModuleExports(code, ctx.serviceId, fileGraph, webpackModulePath);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
@@ -13,4 +13,8 @@ export declare const sharedVendorImportPath: import("../typings").Transformer<"o
|
|
|
13
13
|
test: (code: string, id: string, fileGraph: import("../typings").FileGraph, ctx: import("../typings").RuntimeContext, fromWorker: boolean) => boolean;
|
|
14
14
|
transform: (code: string, id: string, fileGraph: import("../typings").FileGraph, ctx: import("../typings").RuntimeContext, fromWorker: boolean) => string | Promise<string>;
|
|
15
15
|
}>;
|
|
16
|
+
export declare function createTransformer(replacers: Array<OmniaVendorPathReplacer | string>, runtimeVariable: string): {
|
|
17
|
+
test: (code: string, id: string, fileGraph: import("../typings").FileGraph, ctx: import("../typings").RuntimeContext, fromWorker: boolean) => boolean;
|
|
18
|
+
transform: (code: string, id: string, fileGraph: import("../typings").FileGraph, ctx: import("../typings").RuntimeContext, fromWorker: boolean) => string | Promise<string>;
|
|
19
|
+
};
|
|
16
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sharedVendorImportPath = exports.vendorImportPath = void 0;
|
|
3
|
+
exports.createTransformer = exports.sharedVendorImportPath = exports.vendorImportPath = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const vite_1 = require("vite");
|
|
@@ -44,3 +44,4 @@ function createTransformer(replacers, runtimeVariable) {
|
|
|
44
44
|
transform: instance.transform
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
exports.createTransformer = createTransformer;
|
|
@@ -15,8 +15,8 @@ const vendors = [
|
|
|
15
15
|
];
|
|
16
16
|
let internalManifestReferences;
|
|
17
17
|
const externalManifestReferences = (function () {
|
|
18
|
-
const externalManifestRefPathPattern = (0, vite_1.normalizePath)(path_1.default.join(envUtils.getRootDirPath(), 'node_modules/@omnia/*/internal-do-not-import-from-here/manifests/*.json'));
|
|
19
|
-
const manifestFilePaths = (0, globby_1.
|
|
18
|
+
const externalManifestRefPathPattern = (0, vite_1.normalizePath)(path_1.default.join(envUtils.getRootDirPath(), 'node_modules/@omnia/*/internal-do-not-import-from-here/manifests/*.json').replace(/\\/g, '/'));
|
|
19
|
+
const manifestFilePaths = (0, globby_1.globbySync)(externalManifestRefPathPattern);
|
|
20
20
|
if (manifestFilePaths.length == 0) {
|
|
21
21
|
return [];
|
|
22
22
|
}
|
|
@@ -73,6 +73,6 @@ function getEntryKeyFromManifest(manifest) {
|
|
|
73
73
|
if (!!manifest.resourceName) {
|
|
74
74
|
return `${manifest.resourceName}_${manifest.resourceId}`;
|
|
75
75
|
}
|
|
76
|
-
return manifest.resourceId;
|
|
76
|
+
return manifest.resourceId.toString();
|
|
77
77
|
}
|
|
78
78
|
exports.getEntryKeyFromManifest = getEntryKeyFromManifest;
|
|
@@ -38,7 +38,9 @@ function isSourceCodePath(value) {
|
|
|
38
38
|
}
|
|
39
39
|
exports.isSourceCodePath = isSourceCodePath;
|
|
40
40
|
function isJavaScriptSuperset(value) {
|
|
41
|
-
return value.endsWith('.ts')
|
|
41
|
+
return value.endsWith('.ts')
|
|
42
|
+
|| value.endsWith('.tsx')
|
|
43
|
+
|| value.endsWith('.mjs');
|
|
42
44
|
}
|
|
43
45
|
exports.isJavaScriptSuperset = isJavaScriptSuperset;
|
|
44
46
|
function isTsPath(importPath) {
|
|
@@ -96,7 +98,8 @@ function parseHmrDynamicBundlePath(value) {
|
|
|
96
98
|
value = value.substr(1);
|
|
97
99
|
}
|
|
98
100
|
const [pathName, queryParams] = value.split('?');
|
|
99
|
-
|
|
101
|
+
let [resourceId] = pathName.split('/');
|
|
102
|
+
resourceId = resourceId.replace(".js", "").replace(".css", "");
|
|
100
103
|
const fromWorker = queryParams ? queryParams.split('&').some(q => q.startsWith(exports.WORKER_IDENTIFIER)) : false;
|
|
101
104
|
return {
|
|
102
105
|
resourceId,
|
|
@@ -140,21 +143,22 @@ function modify(value) {
|
|
|
140
143
|
exports.modify = modify;
|
|
141
144
|
function resolveModulePath(modulePath, external) {
|
|
142
145
|
let pattern = null;
|
|
146
|
+
const path = modulePath.replace(/\\/g, '/');
|
|
143
147
|
if (external) {
|
|
144
|
-
pattern = [
|
|
148
|
+
pattern = [path + '.js', path + '/index.js', path + '.ts', path + '.tsx', path + '/index.ts'];
|
|
145
149
|
}
|
|
146
|
-
else if (
|
|
147
|
-
pattern = [
|
|
150
|
+
else if (path.endsWith('.css')) {
|
|
151
|
+
pattern = [path + '.ts', path];
|
|
148
152
|
}
|
|
149
153
|
else {
|
|
150
|
-
pattern = [
|
|
154
|
+
pattern = [path + '.ts', path + '.tsx', path + '/index.ts'];
|
|
151
155
|
}
|
|
152
|
-
const result = (0, globby_1.
|
|
156
|
+
const result = (0, globby_1.globbySync)(pattern);
|
|
153
157
|
if (result.length == 1) {
|
|
154
158
|
return result[0];
|
|
155
159
|
}
|
|
156
160
|
if (result.length > 1) {
|
|
157
|
-
if (
|
|
161
|
+
if (path.endsWith('.css')) {
|
|
158
162
|
// priority typestyle
|
|
159
163
|
let filePath = result.find(p => p.endsWith('.css.ts'));
|
|
160
164
|
// then raw css
|
|
@@ -10,7 +10,7 @@ function createWebpackConfig(entries, option) {
|
|
|
10
10
|
let bundleOptions = bundler.getBuildOption().bundleOptions;
|
|
11
11
|
let outputDir = envUtils.getBundleOutputDirPath().replace(envUtils.getRootDirPath(), '');
|
|
12
12
|
if (bundleOptions && bundleOptions.commonsChunk) {
|
|
13
|
-
let config = bundler.createVueWebpackConfig(null, entries, outputDir,
|
|
13
|
+
let config = bundler.createVueWebpackConfig(null, entries, outputDir, option);
|
|
14
14
|
config.stats = {
|
|
15
15
|
entrypoints: false,
|
|
16
16
|
chunks: false,
|
|
@@ -26,7 +26,7 @@ function createWebpackConfig(entries, option) {
|
|
|
26
26
|
configs = Object.keys(entries).map(key => {
|
|
27
27
|
var entry = {};
|
|
28
28
|
entry[key] = entries[key];
|
|
29
|
-
let config = bundler.createVueWebpackConfig(entry, entries, outputDir,
|
|
29
|
+
let config = bundler.createVueWebpackConfig(entry, entries, outputDir, option);
|
|
30
30
|
config.stats = 'errors-only';
|
|
31
31
|
config.watchOptions = {
|
|
32
32
|
aggregateTimeout: 200
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare function transformVueJsx(code: string, id: string): {
|
|
2
|
+
code: any;
|
|
3
|
+
map: any;
|
|
4
|
+
};
|