@omnia/tooling-vue 8.0.21-vnext → 8.0.22-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/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 +2213 -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 -122
- package/internal-do-not-import-from-here/shared.js +97 -192
- 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 +208 -238
- 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/vendor.js +9 -5
- 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 +5 -1
- package/internal-do-not-import-from-here/vite/hmr/manifest.js +5 -5
- package/internal-do-not-import-from-here/vite/hmr/runtime.js +5 -5
- 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 +7 -6
- package/internal-do-not-import-from-here/vite/hmr/utils/webpack.js +2 -2
- package/internal-do-not-import-from-here/vite/index.js +4 -0
- package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +8 -13
- package/internal-do-not-import-from-here/vite/middlewares/OmniaMiddleware.js +55 -17
- package/internal-do-not-import-from-here/vite/middlewares/StaticFileMiddleware.js +31 -10
- package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.js +1 -1
- package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +9 -1
- 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/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 +11 -1
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +34 -29
- 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 +12 -8
- 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 -365
- 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
|
@@ -146,7 +146,7 @@ $.webpack({
|
|
|
146
146
|
},
|
|
147
147
|
module: {
|
|
148
148
|
rules: [
|
|
149
|
-
...(0, ts_loader_1.default)(
|
|
149
|
+
...(0, ts_loader_1.default)(),
|
|
150
150
|
{
|
|
151
151
|
test: /\.css(\?|$)/,
|
|
152
152
|
use: [
|
|
@@ -186,13 +186,17 @@ $.webpack({
|
|
|
186
186
|
'dayjs/plugin/duration',
|
|
187
187
|
'dayjs/plugin/relativeTime',
|
|
188
188
|
"dayjs/locale/da.js",
|
|
189
|
-
"dayjs/locale/pl.js",
|
|
190
|
-
"dayjs/locale/fr.js",
|
|
191
189
|
"dayjs/locale/de.js",
|
|
192
190
|
"dayjs/locale/et.js",
|
|
193
|
-
"dayjs/locale/
|
|
191
|
+
"dayjs/locale/fr.js",
|
|
194
192
|
"dayjs/locale/lt.js",
|
|
193
|
+
"dayjs/locale/lv.js",
|
|
194
|
+
"dayjs/locale/pl.js",
|
|
195
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",
|
|
196
200
|
"./wwwroot/scripts/zepto.extras.js",
|
|
197
201
|
// "@material/material-color-utilities"
|
|
198
202
|
]
|
|
@@ -296,7 +300,7 @@ $.webpack({
|
|
|
296
300
|
},
|
|
297
301
|
module: {
|
|
298
302
|
rules: [
|
|
299
|
-
...(0, ts_loader_1.default)(
|
|
303
|
+
...(0, ts_loader_1.default)(),
|
|
300
304
|
{
|
|
301
305
|
test: /\.css(\?|$)/,
|
|
302
306
|
use: [
|
|
@@ -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
|
|
@@ -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 =
|
|
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");
|
|
@@ -61,7 +61,7 @@ exports.entriesResolver = new ManifestBuildEntriesResolver();
|
|
|
61
61
|
let _manifestCollection;
|
|
62
62
|
function getManifestCollection() {
|
|
63
63
|
if (!_manifestCollection) {
|
|
64
|
-
_manifestCollection = $.tooling.composer.
|
|
64
|
+
_manifestCollection = $.tooling.composer.getManifestsJson();
|
|
65
65
|
}
|
|
66
66
|
return _manifestCollection;
|
|
67
67
|
}
|
|
@@ -84,9 +84,9 @@ function getManifest(resourceId) {
|
|
|
84
84
|
exports.getManifest = getManifest;
|
|
85
85
|
async function validatePreBundles(fileNames) {
|
|
86
86
|
const preBundleDir = utils_1.envUtils.getBundleOutputDirPath();
|
|
87
|
-
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, '/'));
|
|
88
88
|
return new Promise((resolve, reject) => {
|
|
89
|
-
(0, globby_1.
|
|
89
|
+
(0, globby_1.globby)(filePaths).then(result => {
|
|
90
90
|
resolve(result);
|
|
91
91
|
}).catch(reject);
|
|
92
92
|
});
|
|
@@ -95,7 +95,7 @@ exports.validatePreBundles = validatePreBundles;
|
|
|
95
95
|
function getPreBundleInfo() {
|
|
96
96
|
return exports.entriesResolver.getPreBundleEntries().then(entries => {
|
|
97
97
|
const serviceId = $.tooling.composer.getServiceId();
|
|
98
|
-
const manifests = $.tooling.composer.
|
|
98
|
+
const manifests = $.tooling.composer.getManifestsJson();
|
|
99
99
|
return Object.keys(entries).reduce((array, fileName) => {
|
|
100
100
|
const resourceId = utils_1.manifestUtils.getResourceIdFromEntryKey(fileName);
|
|
101
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
|
},
|
|
@@ -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;
|
|
@@ -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 = [
|
|
148
|
+
pattern = [path + '.js', path + '/index.js', path + '.ts', path + '.tsx', path + '/index.ts'];
|
|
148
149
|
}
|
|
149
|
-
else if (
|
|
150
|
-
pattern = [
|
|
150
|
+
else if (path.endsWith('.css')) {
|
|
151
|
+
pattern = [path + '.ts', path];
|
|
151
152
|
}
|
|
152
153
|
else {
|
|
153
|
-
pattern = [
|
|
154
|
+
pattern = [path + '.ts', path + '.tsx', path + '/index.ts'];
|
|
154
155
|
}
|
|
155
|
-
const result = (0, globby_1.
|
|
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 (
|
|
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,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
|
|
@@ -10,6 +10,7 @@ const del_1 = tslib_1.__importDefault(require("del"));
|
|
|
10
10
|
const tooling_composers_1 = require("@omnia/tooling-composers");
|
|
11
11
|
const tooling_1 = require("@omnia/tooling");
|
|
12
12
|
const plugins_1 = require("./plugins");
|
|
13
|
+
const vite_plugin_inspect_1 = tslib_1.__importDefault(require("vite-plugin-inspect"));
|
|
13
14
|
async function createViteServer() {
|
|
14
15
|
const hosting = (0, tooling_composers_1.getHosting)();
|
|
15
16
|
let plugins = [
|
|
@@ -17,6 +18,9 @@ async function createViteServer() {
|
|
|
17
18
|
hosting: hosting
|
|
18
19
|
})
|
|
19
20
|
];
|
|
21
|
+
if (hosting.enableProfiling) {
|
|
22
|
+
plugins.push((0, vite_plugin_inspect_1.default)());
|
|
23
|
+
}
|
|
20
24
|
let https = hosting.https || await getCert();
|
|
21
25
|
let serverConfig = {
|
|
22
26
|
configFile: false,
|
|
@@ -119,7 +119,9 @@ function registerHmrMiddleware(server) {
|
|
|
119
119
|
//res.end(content);
|
|
120
120
|
}
|
|
121
121
|
else if (ext === "css") {
|
|
122
|
-
content = `import { updateStyle as __vite__updateStyle} from "/@vite/client";
|
|
122
|
+
content = `import { updateStyle as __vite__updateStyle} from "/@vite/client";
|
|
123
|
+
const __vite__css = ${JSON.stringify(content)}
|
|
124
|
+
__vite__updateStyle("${bundleFileName}", __vite__css)`;
|
|
123
125
|
// req.url = `/omnia/dist/hmr/bundles/${bundleFileName}`;
|
|
124
126
|
// console.log("Hmr middleware", req.url)
|
|
125
127
|
// next();
|
|
@@ -290,12 +292,7 @@ const manifestResolvePromise = new Promise(function (resolve) {
|
|
|
290
292
|
resolveManifest = resolve;
|
|
291
293
|
});
|
|
292
294
|
|
|
293
|
-
omniaLoader['${serviceId}']['${resourceId}'] = function (
|
|
294
|
-
if (preBundle && !preBundleLoader) {
|
|
295
|
-
preBundleLoader = preBundle;
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
|
|
295
|
+
omniaLoader['${serviceId}']['${resourceId}'] = function () {
|
|
299
296
|
if (triggered) {
|
|
300
297
|
return manifestResolvePromise;
|
|
301
298
|
}
|
|
@@ -323,8 +320,8 @@ omniaLoader['${serviceId}']['${resourceId}'] = function (preBundle) {
|
|
|
323
320
|
|
|
324
321
|
// pre-bundle exports
|
|
325
322
|
let preBundleWebpackRequire;
|
|
326
|
-
if (
|
|
327
|
-
|
|
323
|
+
if (typeof hmrPreBundle === "function") {
|
|
324
|
+
hmrPreBundle();
|
|
328
325
|
}
|
|
329
326
|
|
|
330
327
|
function require(moduleId) {
|
|
@@ -342,7 +339,7 @@ omniaLoader['${serviceId}']['${resourceId}'] = function (preBundle) {
|
|
|
342
339
|
}
|
|
343
340
|
|
|
344
341
|
${fromWorker ?
|
|
345
|
-
`const { href } = new URL('${host}${utils_1.pathUtils.HMR_ESM_REQUEST}/${resourceId}
|
|
342
|
+
`const { href } = new URL('${host}${utils_1.pathUtils.HMR_ESM_REQUEST}/${resourceId}?${utils_1.pathUtils.WORKER_IDENTIFIER}', location.href);
|
|
346
343
|
__shimport__.load(href).then(function () {
|
|
347
344
|
if (omniaWebpackJsonp['${serviceId}']['${resourceId}']) {
|
|
348
345
|
preBundleWebpackRequire = omniaWebpackJsonp['${serviceId}']['${resourceId}'];
|
|
@@ -351,7 +348,7 @@ omniaLoader['${serviceId}']['${resourceId}'] = function (preBundle) {
|
|
|
351
348
|
omniaWebpackJsonp['${serviceId}']['${resourceId}'] = require;
|
|
352
349
|
resolveManifest();
|
|
353
350
|
});` :
|
|
354
|
-
`import('${
|
|
351
|
+
`import('${utils_1.pathUtils.HMR_ESM_REQUEST}/${resourceId}').then(function () {
|
|
355
352
|
if (omniaWebpackJsonp['${serviceId}']['${resourceId}']) {
|
|
356
353
|
preBundleWebpackRequire = omniaWebpackJsonp['${serviceId}']['${resourceId}'];
|
|
357
354
|
}
|
|
@@ -362,9 +359,7 @@ omniaLoader['${serviceId}']['${resourceId}'] = function (preBundle) {
|
|
|
362
359
|
|
|
363
360
|
return manifestResolvePromise;
|
|
364
361
|
}
|
|
365
|
-
|
|
366
362
|
${preBundleContent}
|
|
367
|
-
|
|
368
363
|
${forGroupManifest ? 'return manifestResolvePromise;' : `${$.composers.LoadableManifestRegistry.isDefineWithNoDependency(resourceId) ? `omniaLoader['${serviceId}']['${resourceId}']();` : ''}`}
|
|
369
364
|
`;
|
|
370
365
|
return template.trim();
|
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registerOmniaMiddleware = exports.ManifestChangedMessage = exports.resolvableManifest = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
6
|
+
const url_1 = tslib_1.__importDefault(require("url"));
|
|
6
7
|
const tooling_1 = require("@omnia/tooling");
|
|
7
8
|
const tooling_2 = require("@omnia/tooling");
|
|
8
9
|
const $ = tslib_1.__importStar(require("../../variables"));
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const fx_models_1 = require("@omnia/fx-models");
|
|
11
|
+
const fsExtra = tslib_1.__importStar(require("fs-extra"));
|
|
12
|
+
let _middlewares = null;
|
|
13
|
+
let _server = null;
|
|
11
14
|
class ImplementManifestChangedMessage {
|
|
12
15
|
constructor() {
|
|
13
16
|
this._subcribers = [];
|
|
@@ -22,7 +25,8 @@ class ImplementManifestChangedMessage {
|
|
|
22
25
|
exports.resolvableManifest = null;
|
|
23
26
|
exports.ManifestChangedMessage = new ImplementManifestChangedMessage();
|
|
24
27
|
function registerOmniaMiddleware(server, hmr) {
|
|
25
|
-
|
|
28
|
+
_server = server;
|
|
29
|
+
_middlewares = server.middlewares;
|
|
26
30
|
server.middlewares.use('/omnia', function (req, res, next) {
|
|
27
31
|
ensureLoadManifest();
|
|
28
32
|
exports.resolvableManifest.promise.then(() => {
|
|
@@ -33,12 +37,9 @@ function registerOmniaMiddleware(server, hmr) {
|
|
|
33
37
|
res.setHeader('Content-Type', 'application/json');
|
|
34
38
|
res.end(JSON.stringify({ id: $.composers.ServiceManifestRegistry.getServiceInfo().id, hmr: hmr }));
|
|
35
39
|
});
|
|
36
|
-
server.middlewares.use('/omnia/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
//if (server.config.server.hmr) {
|
|
40
|
-
// manifestJson.groupedResouresAndComponents = [];
|
|
41
|
-
//}
|
|
40
|
+
server.middlewares.use('/omnia/manifest.json', function (req, res, next) {
|
|
41
|
+
const target = url_1.default.parse(req.url, true).query.target;
|
|
42
|
+
let manifestJson = JSON.parse(JSON.stringify($.tooling.composer.getManifestJsonByTarget(target)));
|
|
42
43
|
res.setHeader('Cache-Control', 'no-cache');
|
|
43
44
|
res.setHeader('Content-Type', 'application/json');
|
|
44
45
|
res.end(JSON.stringify({
|
|
@@ -46,6 +47,13 @@ function registerOmniaMiddleware(server, hmr) {
|
|
|
46
47
|
manifest: manifestJson
|
|
47
48
|
}));
|
|
48
49
|
});
|
|
50
|
+
server.middlewares.use('/omnia/localization', function (req, res, next) {
|
|
51
|
+
const target = url_1.default.parse(req.url, true).query.target;
|
|
52
|
+
let localizeObject = $.composers.getLocalizations();
|
|
53
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
54
|
+
res.setHeader('Content-Type', 'application/json');
|
|
55
|
+
res.end(JSON.stringify(localizeObject[target] || ""));
|
|
56
|
+
});
|
|
49
57
|
let watchManifests = chokidar_1.default.watch(["**/*.manifest.ts", "omnia.service.ts"], {
|
|
50
58
|
ignored: [/[\/\\]\./, '**/node_modules/**'],
|
|
51
59
|
persistent: true
|
|
@@ -53,12 +61,24 @@ function registerOmniaMiddleware(server, hmr) {
|
|
|
53
61
|
watchManifests.on('ready', function () {
|
|
54
62
|
watchManifests
|
|
55
63
|
.on('add', path => {
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
if (isLocalizeManifestFile(path)) {
|
|
65
|
+
$.tooling.utils.log(`Found localize manifest file added -> ${path}`);
|
|
66
|
+
rebuildLocalization(path);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
$.tooling.utils.log(`Found manifest added -> ${path}`);
|
|
70
|
+
rebuildManifests();
|
|
71
|
+
}
|
|
58
72
|
})
|
|
59
73
|
.on('change', path => {
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
if (isLocalizeManifestFile(path)) {
|
|
75
|
+
$.tooling.utils.log(`Found localize manifest file changed -> ${path}`);
|
|
76
|
+
rebuildLocalization(path);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
$.tooling.utils.log(`Found manifest changed -> ${path}`);
|
|
80
|
+
rebuildManifests();
|
|
81
|
+
}
|
|
62
82
|
})
|
|
63
83
|
.on('unlink', path => {
|
|
64
84
|
$.tooling.utils.log(`Found manifest removed -> ${path}`);
|
|
@@ -70,6 +90,24 @@ function registerOmniaMiddleware(server, hmr) {
|
|
|
70
90
|
// setTimeout(ensureLoadManifest, 100);
|
|
71
91
|
}
|
|
72
92
|
exports.registerOmniaMiddleware = registerOmniaMiddleware;
|
|
93
|
+
function isLocalizeManifestFile(filePath) {
|
|
94
|
+
const content = fsExtra.readFileSync(filePath, 'utf8');
|
|
95
|
+
return content.indexOf(".registerLocalization") > -1;
|
|
96
|
+
}
|
|
97
|
+
function rebuildLocalization(filePath) {
|
|
98
|
+
try {
|
|
99
|
+
$.tooling.composer.processManifests([filePath]);
|
|
100
|
+
let localizeObject = $.composers.getLocalizations();
|
|
101
|
+
const payLoad = {
|
|
102
|
+
type: fx_models_1.LocalServingMessageType.LocalizeChanged,
|
|
103
|
+
data: localizeObject
|
|
104
|
+
};
|
|
105
|
+
_server.ws.send(payLoad);
|
|
106
|
+
}
|
|
107
|
+
catch (ex) {
|
|
108
|
+
// ignore ex because that already log error inside $.tooling.composer.processManifests
|
|
109
|
+
}
|
|
110
|
+
}
|
|
73
111
|
function rebuildManifests() {
|
|
74
112
|
tooling_1.utils.timeWatch("omniamiddleware_watchmanifest", () => {
|
|
75
113
|
if (exports.resolvableManifest) {
|
|
@@ -91,14 +129,14 @@ function rebuildManifests() {
|
|
|
91
129
|
tooling_1.utils.log(e, tooling_2.LogTypes.Error);
|
|
92
130
|
}
|
|
93
131
|
}
|
|
94
|
-
},
|
|
132
|
+
}, 100);
|
|
95
133
|
}
|
|
96
134
|
function ensureLoadManifest() {
|
|
97
|
-
if (
|
|
135
|
+
if (_middlewares && !exports.resolvableManifest) {
|
|
98
136
|
exports.resolvableManifest = new tooling_2.ResolvablePromise();
|
|
99
|
-
|
|
137
|
+
// ManifestChangedMessage.publish();
|
|
100
138
|
var tasks = tooling_1.core.getRegisteredServeTasks().filter(function (task) { return task.stage === tooling_1.core.TaskStage.AfterCreateServer; }).sort(sortTask) || [];
|
|
101
|
-
executeTasks(tasks,
|
|
139
|
+
executeTasks(tasks, _middlewares, () => {
|
|
102
140
|
exports.resolvableManifest.resolve();
|
|
103
141
|
}, err => {
|
|
104
142
|
exports.resolvableManifest.resolve();
|
|
@@ -6,9 +6,29 @@ const tooling_1 = require("@omnia/tooling");
|
|
|
6
6
|
const $ = tslib_1.__importStar(require("../../variables"));
|
|
7
7
|
const fx_models_1 = require("@omnia/fx-models");
|
|
8
8
|
const shared_1 = require("./shared");
|
|
9
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
9
10
|
function registerStaticFileMiddleware(server) {
|
|
10
|
-
server.middlewares.use(function (req, res, next) {
|
|
11
|
-
if (req.url.indexOf('/
|
|
11
|
+
server.middlewares.use(async function (req, res, next) {
|
|
12
|
+
if (req.url.indexOf('/api/uxdocs') === 0) {
|
|
13
|
+
if (req.method === "OPTIONS") {
|
|
14
|
+
res.end("OK");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const rawReqToString = async (req) => {
|
|
18
|
+
const buffers = [];
|
|
19
|
+
for await (const chunk of req) {
|
|
20
|
+
buffers.push(chunk);
|
|
21
|
+
}
|
|
22
|
+
return Buffer.concat(buffers).toString();
|
|
23
|
+
};
|
|
24
|
+
const jsonString = await rawReqToString(req);
|
|
25
|
+
const jsonObject = JSON.parse(jsonString);
|
|
26
|
+
const fileUrl = `wwwroot/docs/${jsonObject.relativePath}`;
|
|
27
|
+
console.log(fileUrl);
|
|
28
|
+
const content = fs_1.default.readFileSync(fileUrl, 'utf8');
|
|
29
|
+
res.end(content);
|
|
30
|
+
}
|
|
31
|
+
else if (req.url.indexOf('/omnia/fonts/') === 0 || req.url.indexOf('/omnia/images/') === 0) {
|
|
12
32
|
res.setHeader('Cache-Control', 'public, max-age=31536000');
|
|
13
33
|
req.url = req.url.replace("/omnia/", "/omnia/dist/");
|
|
14
34
|
next();
|
|
@@ -28,15 +48,16 @@ function registerStaticFileMiddleware(server) {
|
|
|
28
48
|
res.setHeader('content-type', 'application/x-javascript');
|
|
29
49
|
let localizeObject = $.composers.getLocalizations();
|
|
30
50
|
res.end(`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
const OmniaContext = omniaWebpackJsonp["bb000000-0000-bbbb-0000-0000000000bb"]["a1602121-3070-4304-b4d8-0859e50c482b"]("5326a8ef-4e3c-49d6-b415-1ddf7fdcc830").OmniaContext;
|
|
52
|
+
const container = omniaWebpackJsonp["bb000000-0000-bbbb-0000-0000000000bb"]["` + fx_models_1.OmniaResourceManifests.FxCore.toString() + `"]("97786ea9-4861-48bd-8a57-eae9bbdb4892").ServiceContainer;
|
|
53
|
+
const omniaCtx = container.createInstance(OmniaContext);
|
|
54
|
+
const useLocalizationStore = omniaWebpackJsonp["bb000000-0000-bbbb-0000-0000000000bb"]["` + fx_models_1.OmniaResourceManifests.Fx.toString() + `"]("5e618f4d-d014-414e-a681-89e34cbeda0f").useLocalizationStore;
|
|
55
|
+
const localizeStore = container.createInstance(useLocalizationStore);
|
|
56
|
+
const currentCulture = omniaCtx.language.toLowerCase();
|
|
57
|
+
const loc = JSON.parse('${JSON.stringify(localizeObject).replace(/'/g, "\\'").replace(/\\"/g, "\\\\\"")}');
|
|
37
58
|
|
|
38
|
-
|
|
39
|
-
|
|
59
|
+
localizeStore.actions.merge(loc['en-us'] || {}); // add default english
|
|
60
|
+
localizeStore.actions.merge(loc[currentCulture] || {});
|
|
40
61
|
`);
|
|
41
62
|
}
|
|
42
63
|
else {
|
|
@@ -94,7 +94,7 @@ function registerWebpackMiddleWareBundle(entries) {
|
|
|
94
94
|
if (manifestId) {
|
|
95
95
|
let manifest = $.tooling.composer.getManifestById(manifestId);
|
|
96
96
|
if (manifest) {
|
|
97
|
-
let manifestsData = $.tooling.composer.
|
|
97
|
+
let manifestsData = $.tooling.composer.getManifestsJson();
|
|
98
98
|
let bundleType = path_1.default.extname(filePath).replace('.', '');
|
|
99
99
|
manifest.version = manifest.version || {};
|
|
100
100
|
manifest.version[bundleType] = $.tooling.utils.generateGuid().replace(/-/g, '');
|
|
@@ -20,7 +20,7 @@ function omniaPlugin(options) {
|
|
|
20
20
|
'vue': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
21
21
|
// 'vue-class-component': 'vue-class-component/dist/vue-class-component.esm.js',
|
|
22
22
|
// 'vue-property-decorator': 'vue-property-decorator/lib/vue-property-decorator.js',
|
|
23
|
-
'vue-virtual-scroller': 'vue-virtual-scroller/dist/vue-virtual-scroller.esm.js',
|
|
23
|
+
// 'vue-virtual-scroller': 'vue-virtual-scroller/dist/vue-virtual-scroller.esm.js',
|
|
24
24
|
'typestyle': 'typestyle/lib.es2015/index.js',
|
|
25
25
|
'dayjs': 'dayjs/dayjs.min.js',
|
|
26
26
|
// '@tiptap/core': '@tiptap/core/dist/index.js',
|
|
@@ -67,7 +67,15 @@ function omniaPlugin(options) {
|
|
|
67
67
|
server.middlewares.use(async (req, res, next) => {
|
|
68
68
|
res.setHeader('Access-Control-Allow-Origin', req.headers['origin'] || '*');
|
|
69
69
|
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
70
|
+
res.setHeader('Access-Control-Request-Private-Network', 'true');
|
|
71
|
+
res.setHeader('Access-Control-Request-Method', '*');
|
|
70
72
|
res.setHeader('Access-Control-Allow-Headers', '*');
|
|
73
|
+
if (req.method === "OPTIONS") {
|
|
74
|
+
res.setHeader('Access-Control-Max-Age', 31536000);
|
|
75
|
+
// res.setHeader('Cache-Control', 'public, max-age=31536000');
|
|
76
|
+
res.end("OK");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
71
79
|
next();
|
|
72
80
|
});
|
|
73
81
|
(0, middlewares_1.registerOmniaMiddleware)(server, hosting.hmr);
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const doc_1 = require("../tasks/doc");
|
|
6
|
+
function default_1(content, context) {
|
|
7
|
+
const filePath = "./" + path_1.default.relative(process.cwd(), this.resourcePath).replace(/\\/g, "/");
|
|
8
|
+
content = (0, doc_1.importSnippetCode)(content, filePath);
|
|
9
|
+
return content;
|
|
10
|
+
}
|
|
11
|
+
exports.default = default_1;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
export default function (
|
|
1
|
+
export default function (): {
|
|
2
2
|
test: RegExp;
|
|
3
3
|
use: ({
|
|
4
|
-
loader: any;
|
|
5
|
-
options?: undefined;
|
|
6
|
-
} | {
|
|
7
4
|
loader: string;
|
|
8
5
|
options: {
|
|
9
6
|
loader: string;
|
|
10
7
|
target: string;
|
|
8
|
+
tsconfigRaw: {
|
|
9
|
+
compilerOptions: {
|
|
10
|
+
jsx: string;
|
|
11
|
+
target: string;
|
|
12
|
+
useDefineForClassFields: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
11
15
|
};
|
|
16
|
+
} | {
|
|
17
|
+
loader: any;
|
|
18
|
+
options?: undefined;
|
|
12
19
|
})[];
|
|
13
20
|
}[];
|
|
@@ -3,26 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const $ = tslib_1.__importStar(require("../variables"));
|
|
5
5
|
var path = require('path');
|
|
6
|
-
function default_1(
|
|
7
|
-
var tsLoaderOptions = {
|
|
8
|
-
happyPackMode: true,
|
|
9
|
-
transpileOnly: true
|
|
10
|
-
};
|
|
11
|
-
if (treeshaking) {
|
|
12
|
-
tsLoaderOptions.configFile = path.resolve(__dirname, "../config/tsconfig.es2015.json");
|
|
13
|
-
}
|
|
6
|
+
function default_1() {
|
|
14
7
|
return [{
|
|
15
8
|
test: /\.ts$/,
|
|
16
9
|
use: [
|
|
17
|
-
{
|
|
18
|
-
loader: path.resolve(__dirname, $.isExtensionEnv ? './esbuild-custom-loader.js' : './esbuild-custom-loader.ts'),
|
|
19
|
-
},
|
|
20
10
|
{
|
|
21
11
|
loader: 'esbuild-loader',
|
|
22
12
|
options: {
|
|
23
13
|
loader: 'ts',
|
|
24
|
-
target: '
|
|
14
|
+
target: 'es2020',
|
|
15
|
+
tsconfigRaw: {
|
|
16
|
+
compilerOptions: {
|
|
17
|
+
jsx: "preserve",
|
|
18
|
+
target: "es2020",
|
|
19
|
+
useDefineForClassFields: false
|
|
20
|
+
}
|
|
21
|
+
}
|
|
25
22
|
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
loader: path.resolve(__dirname, $.isExtensionEnv ? './doc-loader.js' : './doc-loader.ts'),
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
28
|
}];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function (
|
|
1
|
+
export default function (): {
|
|
2
2
|
test: RegExp;
|
|
3
3
|
exclude: RegExp;
|
|
4
4
|
use: ({
|
|
@@ -14,6 +14,16 @@ export default function (treeshaking: any, wcDomProps: any, hotModuleReload?: an
|
|
|
14
14
|
loader: string;
|
|
15
15
|
target: string;
|
|
16
16
|
jsx: string;
|
|
17
|
+
tsconfigRaw: {
|
|
18
|
+
compilerOptions: {
|
|
19
|
+
jsx: string;
|
|
20
|
+
target: string;
|
|
21
|
+
useDefineForClassFields: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
17
24
|
};
|
|
25
|
+
} | {
|
|
26
|
+
loader: any;
|
|
27
|
+
options?: undefined;
|
|
18
28
|
})[];
|
|
19
29
|
}[];
|