@omnia/tooling-vue 8.0.4-vnext → 8.0.5-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.
Files changed (60) hide show
  1. package/internal-do-not-import-from-here/config/omnia.vendor.manifest.json +1 -1
  2. package/internal-do-not-import-from-here/config/tooling.output.json +1 -0
  3. package/internal-do-not-import-from-here/config/wctypings.d.ts +2059 -0
  4. package/internal-do-not-import-from-here/index.d.ts +3 -1
  5. package/internal-do-not-import-from-here/index.js +6 -2
  6. package/internal-do-not-import-from-here/shared.d.ts +32 -127
  7. package/internal-do-not-import-from-here/shared.js +97 -207
  8. package/internal-do-not-import-from-here/swc/extract-doc-plugin/package.json +14 -0
  9. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.d.ts +1 -0
  10. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +9 -0
  11. package/internal-do-not-import-from-here/tasks/bundle.d.ts +3 -4
  12. package/internal-do-not-import-from-here/tasks/bundle.js +293 -347
  13. package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
  14. package/internal-do-not-import-from-here/tasks/doc.js +282 -395
  15. package/internal-do-not-import-from-here/tasks/tsc.js +1 -0
  16. package/internal-do-not-import-from-here/tasks/vendor.js +166 -19
  17. package/internal-do-not-import-from-here/variables.d.ts +1 -1
  18. package/internal-do-not-import-from-here/variables.js +2 -2
  19. package/internal-do-not-import-from-here/vite/hmr/graph.js +5 -1
  20. package/internal-do-not-import-from-here/vite/hmr/manifest.js +6 -7
  21. package/internal-do-not-import-from-here/vite/hmr/runtime.js +5 -5
  22. package/internal-do-not-import-from-here/vite/hmr/transformers/importPath.js +9 -5
  23. package/internal-do-not-import-from-here/vite/hmr/transformers/internal/dynamicBundle.js +64 -24
  24. package/internal-do-not-import-from-here/vite/hmr/transformers/vendorImportPath.d.ts +4 -0
  25. package/internal-do-not-import-from-here/vite/hmr/transformers/vendorImportPath.js +2 -1
  26. package/internal-do-not-import-from-here/vite/hmr/utils/manifest.js +3 -3
  27. package/internal-do-not-import-from-here/vite/hmr/utils/path.js +7 -6
  28. package/internal-do-not-import-from-here/vite/hmr/utils/webpack.js +8 -3
  29. package/internal-do-not-import-from-here/vite/hmr/vueJsx.js +1 -1
  30. package/internal-do-not-import-from-here/vite/index.js +4 -0
  31. package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +8 -14
  32. package/internal-do-not-import-from-here/vite/middlewares/OmniaMiddleware.js +55 -17
  33. package/internal-do-not-import-from-here/vite/middlewares/StaticFileMiddleware.js +31 -10
  34. package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.js +1 -1
  35. package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +38 -20
  36. package/internal-do-not-import-from-here/wctypings.ts +0 -0
  37. package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
  38. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +11 -4
  39. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +12 -12
  40. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +11 -1
  41. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +34 -29
  42. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
  43. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +11 -0
  44. package/package.json +14 -10
  45. package/internal-do-not-import-from-here/1cacb55c-202b-4cd7-819d-11bad92fa9cb.wcdefinitions.json +0 -1
  46. package/internal-do-not-import-from-here/1cacb55c-202b-4cd7-819d-11bad92fa9cb.wctypings.d.ts +0 -11
  47. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wcdefinitions.json +0 -1
  48. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -265
  49. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.js +0 -2
  50. package/internal-do-not-import-from-here/cc000000-0000-cccc-0000-0000000000cc.wcdefinitions.json +0 -1
  51. package/internal-do-not-import-from-here/config/tsconfig.es2015.json +0 -21
  52. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
  53. package/internal-do-not-import-from-here/webpack-loaders/jsx-loader.d.ts +0 -8
  54. package/internal-do-not-import-from-here/webpack-loaders/jsx-loader.js +0 -61
  55. package/internal-do-not-import-from-here/webpack-loaders/vue-tsx-hot-loader.d.ts +0 -1
  56. package/internal-do-not-import-from-here/webpack-loaders/vue-tsx-hot-loader.js +0 -44
  57. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
  58. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
  59. /package/internal-do-not-import-from-here/{1cacb55c-202b-4cd7-819d-11bad92fa9cb.wctypings.js → config/wctypings.js} +0 -0
  60. /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");
@@ -5,7 +5,6 @@ const $ = tslib_1.__importStar(require("../variables"));
5
5
  const ts_loader_1 = tslib_1.__importDefault(require("../webpack-loaders/ts-loader"));
6
6
  const ExtractTextPlugin = require('mini-css-extract-plugin');
7
7
  const fsExtra = require('fs-extra');
8
- fsExtra.copySync('wwwroot/scripts/vue-class-component/vue-class-component.esm.custom.js', 'node_modules/vue-class-component/dist/vue-class-component.esm.js');
9
8
  const extractCSS = new ExtractTextPlugin({
10
9
  filename: "omnia.vendor.css",
11
10
  });
@@ -123,7 +122,7 @@ $.webpack({
123
122
  $.tooling.log('omnia shared vendor generated');
124
123
  }
125
124
  });
126
- $.tooling.log('omnia vendor running...');
125
+ $.tooling.log('omnia vendor devlopment running...');
127
126
  $.webpack({
128
127
  mode: 'production',
129
128
  devtool: false,
@@ -132,11 +131,9 @@ $.webpack({
132
131
  extensions: ['.ts', '.js', '.css'],
133
132
  alias: {
134
133
  'typestyle$': 'typestyle/lib.es2015/index.js',
135
- //'vue$': 'vue/dist/vue.runtime.esm-browser.js', // vuetify have not working fully 100% with vue runtime browser only, so temp to full bundle vue now.
136
- 'vue$': 'vue/dist/vue.esm-bundler.js',
137
- 'rope-sequence$': 'rope-sequence/dist/index.js',
138
- 'w3c-keyname$': $.path.resolve($.tooling.utils.root(""), 'node_modules/w3c-keyname/index.es.js'),
139
- 'orderedmap$': 'orderedmap/index.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',
140
137
  },
141
138
  },
142
139
  optimization: {
@@ -149,7 +146,161 @@ $.webpack({
149
146
  },
150
147
  module: {
151
148
  rules: [
152
- ...(0, ts_loader_1.default)(false),
149
+ ...(0, ts_loader_1.default)(),
150
+ {
151
+ test: /\.css(\?|$)/,
152
+ use: [
153
+ {
154
+ loader: ExtractTextPlugin.loader,
155
+ options: {
156
+ publicPath: '../css'
157
+ }
158
+ },
159
+ 'css-loader',
160
+ ]
161
+ },
162
+ {
163
+ test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
164
+ use: [{
165
+ loader: 'file-loader',
166
+ options: {
167
+ name: '[name].[ext]',
168
+ outputPath: '../fonts/'
169
+ }
170
+ }]
171
+ }
172
+ ]
173
+ },
174
+ entry: {
175
+ vendor: [
176
+ "tslib",
177
+ "./client/fx/vue/VueBundler",
178
+ "typestyle",
179
+ "csx",
180
+ "zepto-webpack",
181
+ "mousetrap",
182
+ "mousetrap-global-bind",
183
+ "dayjs",
184
+ "dayjs/plugin/utc",
185
+ "dayjs/plugin/timezone",
186
+ 'dayjs/plugin/duration',
187
+ 'dayjs/plugin/relativeTime',
188
+ "dayjs/locale/da.js",
189
+ "dayjs/locale/de.js",
190
+ "dayjs/locale/et.js",
191
+ "dayjs/locale/fr.js",
192
+ "dayjs/locale/lt.js",
193
+ "dayjs/locale/lv.js",
194
+ "dayjs/locale/pl.js",
195
+ "dayjs/locale/sv.js",
196
+ "dayjs/locale/nb.js",
197
+ "dayjs/locale/fi.js",
198
+ "dayjs/locale/es.js",
199
+ "dayjs/locale/nl.js",
200
+ "./wwwroot/scripts/zepto.extras.js",
201
+ // "@material/material-color-utilities"
202
+ ]
203
+ },
204
+ output: {
205
+ path: $.path.join($.tooling.utils.root(""), outDir),
206
+ filename: 'omnia.[name].js',
207
+ library: {
208
+ name: 'omniaVendor',
209
+ type: 'window',
210
+ }
211
+ },
212
+ plugins: [
213
+ new $.webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /ignore/),
214
+ extractCSS,
215
+ new $.omniaWebpackPlugins.NamedModulesPlugin(),
216
+ new $.omniaWebpackPlugins.ModifyContent([
217
+ {
218
+ pattern: /var omniaVendor;omniaVendor/i,
219
+ replacement: "window['omniaVendor'] "
220
+ },
221
+ {
222
+ pattern: /# sourceMappingURL=\s*(\S+)/g,
223
+ replacement: '# ignore'
224
+ },
225
+ {
226
+ pattern: /__webpack_module_cache__/g,
227
+ replacement: '__omnia_webpack_module_cache__'
228
+ },
229
+ {
230
+ pattern: "const key = `f${stringHash(pid)}`;",
231
+ replacement: `
232
+ // <<omnia custom>> support prefix displayname in styleflow
233
+ ` + "const key = `f${stringHash(pid)}`;" +
234
+ ` if (!styles.$displayName)
235
+ return key;
236
+ ` + "return `${styles.$displayName}_${key}`;"
237
+ },
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');
277
+ }
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)(),
153
304
  {
154
305
  test: /\.css(\?|$)/,
155
306
  use: [
@@ -178,13 +329,6 @@ $.webpack({
178
329
  vendor: [
179
330
  "tslib",
180
331
  "./client/fx/vue/VueBundler",
181
- // "vue-class-component",
182
- // "vue-property-decorator",
183
- // "vue-tsx-support",
184
- // "vue-tsx-support/enable-check",
185
- // "vue-tsx-support/lib/vca",
186
- // "@vue/babel-helper-vue-jsx-merge-props",
187
- // "@vue/composition-api",
188
332
  "typestyle",
189
333
  "csx",
190
334
  "zepto-webpack",
@@ -209,7 +353,7 @@ $.webpack({
209
353
  },
210
354
  output: {
211
355
  path: $.path.join($.tooling.utils.root(""), outDir),
212
- filename: 'omnia.[name].js',
356
+ filename: 'omnia.[name].prod.js',
213
357
  library: {
214
358
  name: 'omniaVendor',
215
359
  type: 'window',
@@ -248,9 +392,12 @@ return key;
248
392
  entryOnly: false
249
393
  }),
250
394
  new $.webpack.DefinePlugin({
251
- //process: { env: { NODE_ENV: JSON.stringify('production') } }
395
+ //process: { env: { NODE_ENV: JSON.stringify('production') } },
252
396
  // temp bundle vue vendor in development mode for support HMR
253
- process: { env: { NODE_ENV: JSON.stringify('development') } }
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
254
401
  })
255
402
  ]
256
403
  })
@@ -276,7 +423,7 @@ return key;
276
423
  var manifestJson = require(manifestPath);
277
424
  manifestJson.content["./node_modules/webpack/buildin/module.js"] = undefined;
278
425
  $.fs.writeFileSync(manifestPath, JSON.stringify(manifestJson));
279
- $.tooling.log('omnia vendor generated');
426
+ $.tooling.log('omnia vendor prod generated');
280
427
  }
281
428
  });
282
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: 'es2022',
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
@@ -163,6 +166,7 @@ async function buildFileGraph(unknownId, 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 = tslib_1.__importDefault(require("globby"));
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.getManifestData();
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.default)(filePaths).then(result => {
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.getManifestData();
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.sync)(omniaPackagesPathPattern).map(p => p.replace((0, vite_1.normalizePath)(path_1.default.join(utils_1.envUtils.getRootDirPath(), 'node_modules/')), ''));
48
- const { dependencies, devDependencies } = require(path_1.default.join(utils_1.envUtils.getRootDirPath(), 'package.json'));
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
  },
@@ -32,12 +32,16 @@ exports.importPath = (0, base_1.defineTransformer)("omnia-import-path", (replace
32
32
  if (!replacer) {
33
33
  throw new utils_1.ErrorHMR(`Unexpected: replacer not found during code transform for module : ${moduleName}`);
34
34
  }
35
+ const fileGraph = ctx.getFileGraph(replacer.from);
36
+ if (fileGraph && fileGraph.bareImport && fileGraph.js && !fileGraph.js.bareImportVariable) {
37
+ fileGraph.js.bareImportVariable = 'ignored';
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
- fileGraph.js.bareImportVariable = 'ignored';
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
- // console.log(original, transformedStatement);
81
+ //console.log(original, transformedStatement);
78
82
  return transformedStatement.trim();
79
83
  });
80
84
  if (hasDefaultImports) {
@@ -6,11 +6,23 @@ const path_1 = tslib_1.__importDefault(require("path"));
6
6
  const fs_1 = tslib_1.__importDefault(require("fs"));
7
7
  const vite_1 = require("vite");
8
8
  const webpack_1 = require("webpack");
9
- const enhanced_resolve_1 = tslib_1.__importDefault(require("enhanced-resolve"));
10
9
  const fx_models_1 = require("@omnia/fx-models");
11
10
  const base_1 = require("../base");
12
11
  const utils_1 = require("../../utils");
13
12
  const $ = tslib_1.__importStar(require("../../../../variables"));
13
+ function getWebpackResolveModulePath(stats, requestModulePath) {
14
+ let result = "";
15
+ stats.forEach(s => {
16
+ s.modules?.forEach(m => {
17
+ const foundReason = m.reasons?.find(r => r.userRequest === requestModulePath);
18
+ if (foundReason) {
19
+ result = m.id.toString();
20
+ return result;
21
+ }
22
+ });
23
+ });
24
+ return result;
25
+ }
14
26
  exports.dynamicBundle = (0, base_1.defineTransformer)("omnia-bundle", () => {
15
27
  const moduleMaps = {}; // bare import / relative path => module id
16
28
  const bundleMaps = {}; // module id => resource id
@@ -20,6 +32,7 @@ exports.dynamicBundle = (0, base_1.defineTransformer)("omnia-bundle", () => {
20
32
  return utils_1.pathUtils.isJavaScriptSuperset(id);
21
33
  },
22
34
  async transform(code, id, fileGraph, ctx, fromWorker) {
35
+ //id.indexOf("wwwroot/docs/") === -1 &&
23
36
  const dynamicModules = filterDynamicModules(fileGraph, ctx);
24
37
  const bundledModules = dynamicModules.filter(item => item.resolved);
25
38
  const unBundledModules = dynamicModules.filter(item => !item.resolved);
@@ -27,7 +40,7 @@ exports.dynamicBundle = (0, base_1.defineTransformer)("omnia-bundle", () => {
27
40
  code = item.inject(code);
28
41
  });
29
42
  const nonResolvingModules = unBundledModules.filter(item => !moduleMaps[item.path]).map(item => ({ path: item.path, inject: item.inject }));
30
- const nonResolvingModulePaths = nonResolvingModules.map(item => item.path);
43
+ const nonResolvingModulePaths = Array.from(new Set(nonResolvingModules.map(item => item.path)));
31
44
  const resolvingModules = unBundledModules.filter(item => !!moduleMaps[item.path]).map(item => moduleMaps[item.path].then(_ => {
32
45
  code = item.inject(code);
33
46
  }));
@@ -52,35 +65,57 @@ exports.dynamicBundle = (0, base_1.defineTransformer)("omnia-bundle", () => {
52
65
  await new Promise(function (resolve, reject) {
53
66
  const configs = utils_1.webpackUtils.createWebpackConfig(entryPoint, 'dynamic');
54
67
  const compiler = (0, webpack_1.webpack)(configs);
55
- compiler.run((err, result) => {
68
+ compiler.run((err, stats) => {
69
+ //console.log("compiler.run", err, stats)
70
+ if (stats.hasErrors()) {
71
+ $.tooling.log('HMR pre-bundle error : \r\n', $.tooling.LogTypes.Error);
72
+ let errors = stats.toJson().errors;
73
+ errors.forEach((err) => {
74
+ $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
75
+ });
76
+ reject();
77
+ return;
78
+ }
56
79
  if (err) {
57
- $.tooling.log(err);
80
+ $.tooling.log(err, $.tooling.LogTypes.Error);
58
81
  reject();
59
82
  return;
60
83
  }
61
84
  nonResolvingModulePaths.forEach(modulePath => {
62
- const bareImport = modulePath.startsWith('.') ? false : true;
63
- const relativePath = bareImport ? enhanced_resolve_1.default.sync(utils_1.envUtils.getRootDirPath(), modulePath) : modulePath;
64
- const moduleId = bareImport ?
65
- ('./' + (0, vite_1.normalizePath)(relativePath.replace(utils_1.envUtils.getRootDirPath(), '.'))).toLowerCase() :
66
- ('./' + (0, vite_1.normalizePath)(path_1.default.dirname(relativePath)) + '/' + path_1.default.basename(relativePath, path_1.default.extname(relativePath)) + '.js').toLowerCase();
67
- if (!bundleMaps[moduleId]) {
68
- bundleMaps[moduleId] = dynamicBundleResourceId;
69
- }
70
- const depFileGraph = ctx.getFileGraph(modulePath);
71
- if (!depFileGraph.js.bareImportVariable) {
72
- depFileGraph.js.bareImportVariable = toRuntimeVariable(ctx.serviceId, bundleMaps[moduleId], moduleId);
73
- depFileGraph.js.bareImportDynamicResourceId = bundleMaps[moduleId];
74
- }
75
- if (moduleMapResolvers[modulePath] && moduleMapResolvers[modulePath].resolved == false) {
76
- moduleMapResolvers[modulePath].resolved = true;
77
- moduleMapResolvers[modulePath].resolve(moduleId);
85
+ try {
86
+ const bareImport = modulePath.startsWith('.') ? false : true;
87
+ let relativePath = modulePath;
88
+ if (bareImport) {
89
+ relativePath = getWebpackResolveModulePath(stats.toJson().children, modulePath);
90
+ if (relativePath === "") {
91
+ throw new Error(`HMR pre-bundle error : can't resolve module path for ${modulePath}`);
92
+ }
93
+ }
94
+ const moduleId = bareImport ?
95
+ ('./' + (0, vite_1.normalizePath)(relativePath.replace(utils_1.envUtils.getRootDirPath(), '.'))).toLowerCase() :
96
+ ('./' + (0, vite_1.normalizePath)(path_1.default.dirname(relativePath)) + '/' + path_1.default.basename(relativePath, path_1.default.extname(relativePath)) + '.js').toLowerCase();
97
+ if (!bundleMaps[moduleId]) {
98
+ bundleMaps[moduleId] = dynamicBundleResourceId;
99
+ }
100
+ const depFileGraph = ctx.getFileGraph(modulePath);
101
+ if (!depFileGraph.js.bareImportVariable) {
102
+ depFileGraph.js.bareImportVariable = toRuntimeVariable(ctx.serviceId, bundleMaps[moduleId], moduleId);
103
+ depFileGraph.js.bareImportDynamicResourceId = bundleMaps[moduleId];
104
+ }
105
+ if (moduleMapResolvers[modulePath] && moduleMapResolvers[modulePath].resolved == false) {
106
+ moduleMapResolvers[modulePath].resolved = true;
107
+ moduleMapResolvers[modulePath].resolve(moduleId);
108
+ }
109
+ else if (!moduleMaps[modulePath]) {
110
+ moduleMaps[modulePath] = Promise.resolve(moduleId);
111
+ }
78
112
  }
79
- else if (!moduleMaps[modulePath]) {
80
- moduleMaps[modulePath] = Promise.resolve(moduleId);
113
+ catch (err) {
114
+ console.error(`HMR pre-bundle error : module path ${modulePath} -> ${err}`);
81
115
  }
82
116
  });
83
- resolve();
117
+ Promise.all(resolvingModules).then(() => resolve());
118
+ //resolve();
84
119
  });
85
120
  });
86
121
  nonResolvingModules.forEach(resolvedModule => {
@@ -189,7 +224,12 @@ function ensureBundleInjection(code, resourceId) {
189
224
  function filterBareImport(item, ctx) {
190
225
  const depFileGraph = ctx.getFileGraph(item.path);
191
226
  // skip omnia packages since they only contain typing files
192
- return depFileGraph && depFileGraph.id.startsWith('@omnia') == false && !ctx.alias[depFileGraph.id] && depFileGraph.bareImport && depFileGraph.js;
227
+ return depFileGraph
228
+ && depFileGraph.id.startsWith('./wwwroot/docs/') == false
229
+ && depFileGraph.id.startsWith('@omnia') == false
230
+ && !ctx.alias[depFileGraph.id]
231
+ && depFileGraph.bareImport
232
+ && depFileGraph.js;
193
233
  }
194
234
  function isBareImportResolved(item, ctx) {
195
235
  const depFileGraph = ctx.getFileGraph(item.path);
@@ -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.sync)(externalManifestRefPathPattern);
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;
@@ -143,21 +143,22 @@ function modify(value) {
143
143
  exports.modify = modify;
144
144
  function resolveModulePath(modulePath, external) {
145
145
  let pattern = null;
146
+ const path = modulePath.replace(/\\/g, '/');
146
147
  if (external) {
147
- pattern = [modulePath + '.js', modulePath + '/index.js', modulePath + '.ts', modulePath + '.tsx', modulePath + '/index.ts'];
148
+ pattern = [path + '.js', path + '/index.js', path + '.ts', path + '.tsx', path + '/index.ts'];
148
149
  }
149
- else if (modulePath.endsWith('.css')) {
150
- pattern = [modulePath + '.ts', modulePath];
150
+ else if (path.endsWith('.css')) {
151
+ pattern = [path + '.ts', path];
151
152
  }
152
153
  else {
153
- pattern = [modulePath + '.ts', modulePath + '.tsx', modulePath + '/index.ts'];
154
+ pattern = [path + '.ts', path + '.tsx', path + '/index.ts'];
154
155
  }
155
- const result = (0, globby_1.sync)(pattern);
156
+ const result = (0, globby_1.globbySync)(pattern);
156
157
  if (result.length == 1) {
157
158
  return result[0];
158
159
  }
159
160
  if (result.length > 1) {
160
- if (modulePath.endsWith('.css')) {
161
+ if (path.endsWith('.css')) {
161
162
  // priority typestyle
162
163
  let filePath = result.find(p => p.endsWith('.css.ts'));
163
164
  // then raw css
@@ -10,8 +10,13 @@ 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, false, option);
14
- config.stats = 'errors-only';
13
+ let config = bundler.createVueWebpackConfig(null, entries, outputDir, option);
14
+ config.stats = {
15
+ entrypoints: false,
16
+ chunks: false,
17
+ modules: true,
18
+ children: true
19
+ };
15
20
  config.watchOptions = {
16
21
  aggregateTimeout: 200
17
22
  };
@@ -21,7 +26,7 @@ function createWebpackConfig(entries, option) {
21
26
  configs = Object.keys(entries).map(key => {
22
27
  var entry = {};
23
28
  entry[key] = entries[key];
24
- let config = bundler.createVueWebpackConfig(entry, entries, outputDir, false, option);
29
+ let config = bundler.createVueWebpackConfig(entry, entries, outputDir, option);
25
30
  config.stats = 'errors-only';
26
31
  config.watchOptions = {
27
32
  aggregateTimeout: 200