@omnia/tooling-vue 8.0.79-vnext → 8.0.80-vnext

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 (25) hide show
  1. package/internal-do-not-import-from-here/config/output.info.json +1 -0
  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 +744 -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 +26 -118
  7. package/internal-do-not-import-from-here/shared.js +78 -153
  8. package/internal-do-not-import-from-here/tasks/bundle.d.ts +1 -2
  9. package/internal-do-not-import-from-here/tasks/bundle.js +157 -54
  10. package/internal-do-not-import-from-here/variables.d.ts +1 -1
  11. package/internal-do-not-import-from-here/variables.js +2 -2
  12. package/internal-do-not-import-from-here/vite/hmr/graph.js +2 -0
  13. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +2 -5
  14. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +0 -5
  15. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -0
  16. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +3 -0
  17. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
  18. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +7 -0
  19. package/package.json +3 -3
  20. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -744
  21. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.d.ts +0 -1
  22. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
  23. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
  24. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
  25. /package/internal-do-not-import-from-here/{bb000000-0000-bbbb-0000-0000000000bb.wctypings.js → config/wctypings.js} +0 -0
@@ -1 +1,3 @@
1
- export { registerManifestsReference, registerWebComponentDefinitions } from "./tasks/bundle";
1
+ export { registerManifestsReference } from "./tasks/bundle";
2
+ export { registerOutputInfo } from "./shared";
3
+ export declare function registerWebComponentDefinitions(): void;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerWebComponentDefinitions = exports.registerManifestsReference = void 0;
3
+ exports.registerWebComponentDefinitions = exports.registerOutputInfo = exports.registerManifestsReference = void 0;
4
4
  var bundle_1 = require("./tasks/bundle");
5
5
  Object.defineProperty(exports, "registerManifestsReference", { enumerable: true, get: function () { return bundle_1.registerManifestsReference; } });
6
- Object.defineProperty(exports, "registerWebComponentDefinitions", { enumerable: true, get: function () { return bundle_1.registerWebComponentDefinitions; } });
6
+ var shared_1 = require("./shared");
7
+ Object.defineProperty(exports, "registerOutputInfo", { enumerable: true, get: function () { return shared_1.registerOutputInfo; } });
8
+ // will remove legacy function when update all core extension packages
9
+ function registerWebComponentDefinitions() { }
10
+ exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
@@ -1,124 +1,14 @@
1
- export declare function getBaseWebpackConfigForManifestMetadata(entry: any, bundleOutputDir: any): {
2
- devtool: boolean;
3
- mode: string;
4
- context: any;
5
- entry: any;
6
- optimization: any;
7
- resolve: {
8
- modules: string[];
9
- extensions: string[];
10
- symlinks: boolean;
11
- cacheWithContext: boolean;
12
- descriptionFiles: string[];
13
- alias: Object & {
14
- [name: string]: string;
15
- } & {
16
- axios$: string;
17
- typestyle$: string;
18
- vue$: string;
19
- '@microsoft/signalr': string;
1
+ export type OutputInfo = {
2
+ wc: {
3
+ namespace: string;
4
+ mappings: {
5
+ [element: string]: string;
20
6
  };
21
7
  };
22
- output: {
23
- pathinfo: boolean;
24
- path: any;
25
- filename: string;
26
- };
27
- externals: (({ context, request }: {
28
- context: any;
29
- request: any;
30
- }, callback: any) => any)[];
31
- module: {
32
- noParse: RegExp;
33
- rules: ({
34
- test: RegExp;
35
- use: ({
36
- loader: any;
37
- options?: undefined;
38
- } | {
39
- loader: string;
40
- options: {
41
- loader: string;
42
- target: string;
43
- tsconfigRaw: {
44
- compilerOptions: {
45
- jsx: string;
46
- target: string;
47
- useDefineForClassFields: boolean;
48
- };
49
- };
50
- };
51
- })[];
52
- } | {
53
- test: RegExp;
54
- exclude: RegExp;
55
- use: ({
56
- loader: string;
57
- options: {
58
- cacheDirectory: boolean;
59
- plugins: any[];
60
- presets: string[][];
61
- };
62
- } | {
63
- loader: string;
64
- options: {
65
- loader: string;
66
- target: string;
67
- jsx: string;
68
- tsconfigRaw: {
69
- compilerOptions: {
70
- jsx: string;
71
- target: string;
72
- useDefineForClassFields: boolean;
73
- };
74
- };
75
- };
76
- })[];
77
- } | {
78
- test: RegExp;
79
- resolve: {
80
- fullySpecified: boolean;
81
- };
82
- use?: undefined;
83
- loader?: undefined;
84
- } | {
85
- test: RegExp;
86
- use: string[];
87
- resolve?: undefined;
88
- loader?: undefined;
89
- } | {
90
- test: RegExp;
91
- use: {
92
- loader: string;
93
- options: {
94
- implementation: any;
95
- sassOptions: {
96
- indentedSyntax: boolean;
97
- };
98
- };
99
- }[];
100
- resolve?: undefined;
101
- loader?: undefined;
102
- } | {
103
- test: RegExp;
104
- loader: string;
105
- resolve?: undefined;
106
- use?: undefined;
107
- } | {
108
- test: RegExp;
109
- use: {
110
- loader: string;
111
- options: {
112
- name: string;
113
- outputPath: string;
114
- publicPath: string;
115
- };
116
- }[];
117
- resolve?: undefined;
118
- loader?: undefined;
119
- })[];
120
- };
121
8
  };
9
+ export declare const isExtensionEnv: boolean;
10
+ export declare function registerOutputInfo(info: OutputInfo): void;
11
+ export declare function replaceWebComponentNamespaceMapping(content: string): string;
122
12
  export declare function convertManifestPathToEntryPath(pathToManifest: any, pathsInManifest: Array<string>): string[];
123
13
  export declare const buildContext: {
124
14
  isManifestsChanged: boolean;
@@ -126,3 +16,21 @@ export declare const buildContext: {
126
16
  export declare var cacheKeys: {
127
17
  bundleManifests: string;
128
18
  };
19
+ export declare class ConfigurationManager {
20
+ private static _webComponentTypings;
21
+ private static _outputInfoManagaer;
22
+ static get webComponentTypings(): WebComponentTypingsManagaer;
23
+ static get outputInfo(): OutputInfoManagaer;
24
+ }
25
+ declare class OutputInfoManagaer {
26
+ private filePath;
27
+ private _value;
28
+ update(value: OutputInfo): void;
29
+ get(): OutputInfo;
30
+ }
31
+ declare class WebComponentTypingsManagaer {
32
+ private filePath;
33
+ update(value: string): void;
34
+ delete(): void;
35
+ }
36
+ export {};
@@ -1,167 +1,41 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cacheKeys = exports.buildContext = exports.convertManifestPathToEntryPath = exports.getBaseWebpackConfigForManifestMetadata = void 0;
3
+ exports.ConfigurationManager = exports.cacheKeys = exports.buildContext = exports.convertManifestPathToEntryPath = exports.replaceWebComponentNamespaceMapping = exports.registerOutputInfo = exports.isExtensionEnv = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const globby_1 = require("globby");
6
- const $ = tslib_1.__importStar(require("./variables"));
7
- const ts_loader_1 = tslib_1.__importDefault(require("./webpack-loaders/ts-loader"));
8
- const tsx_loader_1 = tslib_1.__importDefault(require("./webpack-loaders/tsx-loader"));
9
- function getBaseWebpackConfigForManifestMetadata(entry, bundleOutputDir) {
10
- return {
11
- devtool: false,
12
- mode: 'development',
13
- context: $.tooling.utils.root(""),
14
- entry: entry,
15
- //cache: {
16
- // type: "filesystem"
17
- //},
18
- //performance: {
19
- // hints: 'error',
20
- // maxEntrypointSize: 10000000,
21
- // maxAssetSize: 10000000 // ~ 10Mb
22
- //},
23
- //stats: 'errors-only',
24
- //stats: {
25
- // //all: false,
26
- // ////modules: true,
27
- // //maxModules: 0,
28
- // //errors: true,
29
- // warnings: false,
30
- // //moduleTrace: true,
31
- // //errorDetails: true
32
- //},
33
- //ignoreWarnings: [
34
- // {
35
- // module: /DEP_WEBPACK_MODULE_ID/ // A RegExp
36
- // },
37
- // {
38
- // module: /[DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS]/ // A RegExp
39
- // },
40
- // (warning) => { console.log('marning', warning); return true;}
41
- //],
42
- optimization: Object.assign({
43
- removeAvailableModules: false,
44
- removeEmptyChunks: false,
45
- splitChunks: false,
46
- }),
47
- resolve: {
48
- modules: $.tooling.core.getWebpackResolveModules(),
49
- extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
50
- //extensions: ['.js', '.jsx', '.ts', '.tsx', '.html', '.vue', '.less', '.styl'],
51
- symlinks: false,
52
- cacheWithContext: true,
53
- descriptionFiles: ['package.json'],
54
- alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), ($.composers.BuildConfigurationRegistry.getBuildOptions()?.moduleOptions?.alias || {}), {
55
- 'axios$': 'axios/dist/axios.js',
56
- 'typestyle$': 'typestyle/lib.es2015/index.js',
57
- 'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
58
- '@microsoft/signalr': '@microsoft/signalr/dist/webworker/signalr.js',
59
- }),
60
- //mainFields: ['main', 'browser', 'module']
61
- },
62
- output: {
63
- pathinfo: false,
64
- path: $.tooling.utils.root(bundleOutputDir),
65
- filename: '[name].js'
66
- },
67
- externals: [
68
- function ({ context, request }, callback) {
69
- if (request.indexOf("node_modules") > -1 || (/\.(sass|scss|styl|less|css)$/i).test(request)) {
70
- return callback(null, 'commonjs ' + request);
71
- }
72
- callback();
73
- }
74
- ],
75
- //optimization: {
76
- // removeAvailableModules: false,
77
- // removeEmptyChunks: false,
78
- // splitChunks: false,
79
- //},
80
- module: {
81
- noParse: /wwwroot(.*)/,
82
- rules: [
83
- //{
84
- // parser: {
85
- // amd: false,
86
- // harmony: false
87
- // }
88
- //},
89
- {
90
- test: /\.m?js$/,
91
- resolve: {
92
- fullySpecified: false, // disable the behaviour
93
- },
94
- },
95
- ...(0, ts_loader_1.default)(),
96
- ...(0, tsx_loader_1.default)(),
97
- {
98
- test: /\.styl$/,
99
- use: [
100
- //'style-loader',
101
- //'css-loader',
102
- 'stylus-loader'
103
- ]
104
- },
105
- ...($.isExtensionEnv ? [] : [{
106
- test: /\.s(c|a)ss$/,
107
- use: [
108
- {
109
- loader: 'sass-loader',
110
- options: {
111
- implementation: require('sass'),
112
- sassOptions: {
113
- //fiber: require('fibers'),
114
- indentedSyntax: true
115
- }
116
- //fiber: require('fibers')
117
- }
118
- }
119
- ]
120
- }]),
121
- {
122
- test: /\.less$/,
123
- use: [
124
- //'style-loader',
125
- //'css-loader',
126
- 'less-loader'
127
- ]
128
- },
129
- {
130
- test: /\.css$/,
131
- use: [
132
- //'style-loader',
133
- {
134
- loader: 'css-loader'
135
- }
136
- ]
137
- },
138
- {
139
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
140
- loader: 'url-loader'
141
- },
142
- {
143
- test: /\.(ico|gif|png|jpe?g|svg)$/i,
144
- use: [{
145
- loader: 'file-loader',
146
- options: {
147
- name: '[name].[ext]',
148
- outputPath: "../images/",
149
- publicPath: '/omnia/images/'
150
- }
151
- }]
152
- //loader: 'url-loader'
153
- }
154
- ]
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
+ const fsExtra = tslib_1.__importStar(require("fs-extra"));
8
+ const del_1 = tslib_1.__importDefault(require("del"));
9
+ const fs_1 = tslib_1.__importDefault(require("fs"));
10
+ const _outputInfos = [];
11
+ const basePathProcess = process.cwd();
12
+ exports.isExtensionEnv = fs_1.default.existsSync(basePathProcess + "/node_modules/@omnia/tooling/package.json");
13
+ function registerOutputInfo(info) {
14
+ _outputInfos.push(info);
15
+ }
16
+ exports.registerOutputInfo = registerOutputInfo;
17
+ function replaceWebComponentNamespaceMapping(content) {
18
+ const infos = _outputInfos.concat(ConfigurationManager.outputInfo.get());
19
+ infos.forEach(info => {
20
+ if (info.wc?.namespace) {
21
+ content = content.replace(new RegExp(`(<|<\/|\\s)${info.wc.namespace}\\..*?(>|\\s)`, 'g'), function (match) {
22
+ return match.replace(new RegExp(`(${info.wc.namespace}.*)(?=(>|\\s))`), function (token) {
23
+ return token.replace(/(\S+)/g, function (tag) {
24
+ return info.wc.mappings[tag.replace(`${info.wc.namespace}.`, "")] || tag;
25
+ });
26
+ });
27
+ });
155
28
  }
156
- };
29
+ });
30
+ return content;
157
31
  }
158
- exports.getBaseWebpackConfigForManifestMetadata = getBaseWebpackConfigForManifestMetadata;
32
+ exports.replaceWebComponentNamespaceMapping = replaceWebComponentNamespaceMapping;
159
33
  function convertManifestPathToEntryPath(pathToManifest, pathsInManifest) {
160
34
  if (!pathsInManifest)
161
35
  return [];
162
36
  let pathsToSearch = [];
163
37
  pathsInManifest.forEach(p => {
164
- pathsToSearch.push((p[0] === '!' ? '!./' : './') + (p.indexOf("./") > -1 || p.indexOf(".\\") > -1 ? $.path.join(pathToManifest.substring(0, pathToManifest.lastIndexOf('/')), p.replace(/^!/, '')).replace(/\\/g, "/")
38
+ pathsToSearch.push((p[0] === '!' ? '!./' : './') + (p.indexOf("./") > -1 || p.indexOf(".\\") > -1 ? path_1.default.join(pathToManifest.substring(0, pathToManifest.lastIndexOf('/')), p.replace(/^!/, '')).replace(/\\/g, "/")
165
39
  : p.replace(/^!/, '').replace(/\\/g, "/")));
166
40
  });
167
41
  let result = (0, globby_1.globbySync)(pathsToSearch.concat(["!./**/*.manifest.+(js|ts)"]));
@@ -178,3 +52,54 @@ exports.cacheKeys = {
178
52
  //buildManifestMetadatas: "buildManifestMetadatas",
179
53
  bundleManifests: "bundleManifests"
180
54
  };
55
+ class ConfigurationManager {
56
+ static get webComponentTypings() {
57
+ if (!this._webComponentTypings) {
58
+ this._webComponentTypings = new WebComponentTypingsManagaer();
59
+ }
60
+ return this._webComponentTypings;
61
+ }
62
+ static get outputInfo() {
63
+ if (!this._outputInfoManagaer) {
64
+ this._outputInfoManagaer = new OutputInfoManagaer();
65
+ }
66
+ return this._outputInfoManagaer;
67
+ }
68
+ }
69
+ ConfigurationManager._webComponentTypings = null;
70
+ ConfigurationManager._outputInfoManagaer = null;
71
+ exports.ConfigurationManager = ConfigurationManager;
72
+ class OutputInfoManagaer {
73
+ constructor() {
74
+ this.filePath = exports.isExtensionEnv ? path_1.default.resolve(__dirname, "tooling.output.json") : path_1.default.resolve(__dirname, "config/tooling.output.json");
75
+ this._value = null;
76
+ }
77
+ update(value) {
78
+ fsExtra.ensureFileSync(this.filePath);
79
+ fsExtra.writeJsonSync(this.filePath, value);
80
+ }
81
+ get() {
82
+ if (this._value === null) {
83
+ fsExtra.ensureFileSync(this.filePath);
84
+ const content = fsExtra.readFileSync(this.filePath).toString();
85
+ this._value = content ? JSON.parse(content) : {};
86
+ }
87
+ return this._value;
88
+ }
89
+ }
90
+ class WebComponentTypingsManagaer {
91
+ constructor() {
92
+ this.filePath = path_1.default.resolve(__dirname, "config/wctypings.ts");
93
+ }
94
+ update(value) {
95
+ fsExtra.outputFileSync(this.filePath, value);
96
+ }
97
+ delete() {
98
+ del_1.default.sync(this.filePath);
99
+ }
100
+ }
101
+ // initial
102
+ if (exports.isExtensionEnv) {
103
+ //auto register output info from omnia
104
+ registerOutputInfo(fsExtra.readJSONSync(path_1.default.resolve(__dirname, "config/tooling.output.json")));
105
+ }
@@ -16,5 +16,4 @@ declare function registerManifestsReference(manifests: Array<{
16
16
  serviceId?: string;
17
17
  resourceId?: string;
18
18
  }>): void;
19
- declare function registerWebComponentDefinitions(definitions: Object): void;
20
- export { ensureManifestDependencyInRuntime, bundleManifest, getServiceId, getBuildOption, cleanUpComposer, createVueWebpackConfig, createCombinedManfest, registerManifestsReference, registerWebComponentDefinitions, checkDuplicateBundle, processManifestGenerated, addDependency };
19
+ export { ensureManifestDependencyInRuntime, bundleManifest, getServiceId, getBuildOption, cleanUpComposer, createVueWebpackConfig, createCombinedManfest, registerManifestsReference, checkDuplicateBundle, processManifestGenerated, addDependency };