@omnia/tooling-vue 8.0.77-vnext → 8.0.78-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 (35) hide show
  1. package/internal-do-not-import-from-here/config/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json +1 -0
  2. package/internal-do-not-import-from-here/config/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json +1 -0
  3. package/internal-do-not-import-from-here/config/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json +1 -0
  4. package/internal-do-not-import-from-here/config/omnia.vendor.manifest.json +1 -1
  5. package/internal-do-not-import-from-here/config/tooling.output.json +1 -0
  6. package/internal-do-not-import-from-here/config/wctypings.d.ts +4446 -0
  7. package/internal-do-not-import-from-here/index.d.ts +3 -1
  8. package/internal-do-not-import-from-here/index.js +6 -2
  9. package/internal-do-not-import-from-here/shared.d.ts +31 -118
  10. package/internal-do-not-import-from-here/shared.js +98 -153
  11. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
  12. package/internal-do-not-import-from-here/tasks/bundle.d.ts +1 -2
  13. package/internal-do-not-import-from-here/tasks/bundle.js +179 -370
  14. package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
  15. package/internal-do-not-import-from-here/tasks/doc.js +330 -393
  16. package/internal-do-not-import-from-here/tasks/vendor.js +16 -12
  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 +4 -0
  20. package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +1 -1
  21. package/internal-do-not-import-from-here/wctypings.ts +0 -0
  22. package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
  23. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +3 -3
  24. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +3 -3
  25. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -0
  26. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +3 -0
  27. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
  28. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +11 -0
  29. package/package.json +5 -4
  30. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -495
  31. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
  32. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
  33. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
  34. /package/internal-do-not-import-from-here/{bb000000-0000-bbbb-0000-0000000000bb.wctypings.js → config/wctypings.js} +0 -0
  35. /package/internal-do-not-import-from-here/webpack-loaders/{esbuild-custom-loader.d.ts → doc-loader.d.ts} +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,19 @@
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
+ import { WebComponentOptions } from '@omnia/tooling-composers';
2
+ export interface WebComponentOptionsExtends extends WebComponentOptions {
3
+ entryPointPath: string;
4
+ }
5
+ export type OutputInfo = {
6
+ wc: {
7
+ namespaces: string[];
8
+ mappings: {
9
+ [element: string]: string;
20
10
  };
21
11
  };
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
12
  };
13
+ export declare const isExtensionEnv: boolean;
14
+ export declare function getBuildOption(): import("@omnia/tooling-composers").BuildOptions;
15
+ export declare function registerOutputInfo(info: OutputInfo): void;
16
+ export declare function modifyComponent(content: string, filePath: string): string;
122
17
  export declare function convertManifestPathToEntryPath(pathToManifest: any, pathsInManifest: Array<string>): string[];
123
18
  export declare const buildContext: {
124
19
  isManifestsChanged: boolean;
@@ -126,3 +21,21 @@ export declare const buildContext: {
126
21
  export declare var cacheKeys: {
127
22
  bundleManifests: string;
128
23
  };
24
+ export declare class ConfigurationManager {
25
+ private static _webComponentTypings;
26
+ private static _outputInfoManagaer;
27
+ static get webComponentTypings(): ImplementComponentTyping;
28
+ static get outputInfo(): OutputInfoManager;
29
+ }
30
+ declare class OutputInfoManager {
31
+ private filePath;
32
+ private _value;
33
+ update(value: OutputInfo): void;
34
+ get(): OutputInfo;
35
+ }
36
+ declare class ImplementComponentTyping {
37
+ private filePath;
38
+ update(value: string): void;
39
+ delete(): void;
40
+ }
41
+ export {};
@@ -1,167 +1,61 @@
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.modifyComponent = exports.registerOutputInfo = exports.getBuildOption = 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 tooling_composers_1 = require("@omnia/tooling-composers");
11
+ const _outputInfos = [];
12
+ const basePathProcess = process.cwd();
13
+ exports.isExtensionEnv = fs_1.default.existsSync(basePathProcess + "/node_modules/@omnia/tooling/package.json");
14
+ function getBuildOption() {
15
+ return tooling_composers_1.BuildConfigurationRegistry.getBuildOptions();
16
+ }
17
+ exports.getBuildOption = getBuildOption;
18
+ function registerOutputInfo(info) {
19
+ _outputInfos.push(info);
20
+ }
21
+ exports.registerOutputInfo = registerOutputInfo;
22
+ function modifyComponent(content, filePath) {
23
+ let result = content;
24
+ const ext = path_1.default.extname(filePath);
25
+ if (ext === ".tsx") {
26
+ result = replaceWebComponentNamespaceMapping(content);
27
+ const wcs = tooling_composers_1.ComponentRegistry.getComponentRegistrations();
28
+ if (wcs.find(wc => filePath.indexOf(wc.componentOptions.entryPointPath) > -1)) {
29
+ result = result.replace(/defineVueComponent/g, "defineVueWebComponent");
155
30
  }
156
- };
31
+ }
32
+ return result;
33
+ }
34
+ exports.modifyComponent = modifyComponent;
35
+ function replaceWebComponentNamespaceMapping(content) {
36
+ const infos = _outputInfos.concat(ConfigurationManager.outputInfo.get());
37
+ infos.forEach(info => {
38
+ if (info.wc?.namespaces) {
39
+ info.wc.namespaces.forEach(namespace => {
40
+ content = content.replace(new RegExp(`(<|<\/|\\s)${namespace}\\..*?(>|\\s)`, 'g'), function (match) {
41
+ return match.replace(new RegExp(`(${namespace}.*)(?=(>|\\s))`), function (token) {
42
+ return token.replace(/(\S+)/g, function (tag) {
43
+ // console.log("replaceWebComponentNamespaceMapping", tag)
44
+ return info.wc.mappings[tag] || tag;
45
+ });
46
+ });
47
+ });
48
+ });
49
+ }
50
+ });
51
+ return content;
157
52
  }
158
- exports.getBaseWebpackConfigForManifestMetadata = getBaseWebpackConfigForManifestMetadata;
159
53
  function convertManifestPathToEntryPath(pathToManifest, pathsInManifest) {
160
54
  if (!pathsInManifest)
161
55
  return [];
162
56
  let pathsToSearch = [];
163
57
  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, "/")
58
+ pathsToSearch.push((p[0] === '!' ? '!./' : './') + (p.indexOf("./") > -1 || p.indexOf(".\\") > -1 ? path_1.default.join(pathToManifest.substring(0, pathToManifest.lastIndexOf('/')), p.replace(/^!/, '')).replace(/\\/g, "/")
165
59
  : p.replace(/^!/, '').replace(/\\/g, "/")));
166
60
  });
167
61
  let result = (0, globby_1.globbySync)(pathsToSearch.concat(["!./**/*.manifest.+(js|ts)"]));
@@ -178,3 +72,54 @@ exports.cacheKeys = {
178
72
  //buildManifestMetadatas: "buildManifestMetadatas",
179
73
  bundleManifests: "bundleManifests"
180
74
  };
75
+ class ConfigurationManager {
76
+ static get webComponentTypings() {
77
+ if (!this._webComponentTypings) {
78
+ this._webComponentTypings = new ImplementComponentTyping();
79
+ }
80
+ return this._webComponentTypings;
81
+ }
82
+ static get outputInfo() {
83
+ if (!this._outputInfoManagaer) {
84
+ this._outputInfoManagaer = new OutputInfoManager();
85
+ }
86
+ return this._outputInfoManagaer;
87
+ }
88
+ }
89
+ exports.ConfigurationManager = ConfigurationManager;
90
+ ConfigurationManager._webComponentTypings = null;
91
+ ConfigurationManager._outputInfoManagaer = null;
92
+ class OutputInfoManager {
93
+ constructor() {
94
+ this.filePath = exports.isExtensionEnv ? path_1.default.resolve(__dirname, "tooling.output.json") : path_1.default.resolve(__dirname, "config/tooling.output.json");
95
+ this._value = null;
96
+ }
97
+ update(value) {
98
+ fsExtra.ensureFileSync(this.filePath);
99
+ fsExtra.writeJsonSync(this.filePath, value);
100
+ }
101
+ get() {
102
+ if (this._value === null) {
103
+ fsExtra.ensureFileSync(this.filePath);
104
+ const content = fsExtra.readFileSync(this.filePath).toString();
105
+ this._value = content ? JSON.parse(content) : {};
106
+ }
107
+ return this._value;
108
+ }
109
+ }
110
+ class ImplementComponentTyping {
111
+ constructor() {
112
+ this.filePath = exports.isExtensionEnv ? path_1.default.resolve(__dirname, "wctypings.ts") : path_1.default.resolve(__dirname, "config/wctypings.ts");
113
+ }
114
+ update(value) {
115
+ fsExtra.outputFileSync(this.filePath, value);
116
+ }
117
+ delete() {
118
+ del_1.default.sync(this.filePath);
119
+ }
120
+ }
121
+ // initial
122
+ if (exports.isExtensionEnv) {
123
+ //auto register output info from omnia
124
+ registerOutputInfo(fsExtra.readJSONSync(path_1.default.resolve(__dirname, "config/tooling.output.json")));
125
+ }