@hitachivantara/app-shell-vite-plugin 0.10.0 → 0.10.1

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/README.md CHANGED
@@ -12,6 +12,8 @@ It performs the following actions:
12
12
  - copy all the required js bundles to final "bundles" folders
13
13
  - process the `app-shell.config.json` file
14
14
  - create virtual endpoints to support dev mode
15
+ - create virtual main.tsx and App.tsx Files: These files were there strictly for development purposes, as what ultimately matters are the ESM modules
16
+ exported and consumed by others
15
17
  - create `importmap` and inject it into `index.html`
16
18
  - create <base href="..."> tag and inject it into `index.html`
17
19
  - creates APP_BASE_PATH variable that can be used in app code.
@@ -40,6 +42,24 @@ export default defineConfig(({ mode }) => {
40
42
  });
41
43
  ```
42
44
 
45
+ ## app-shell.config
46
+
47
+ The configuration file must be placed at the root directory of the app.
48
+ The vite-plugin can process the `app-shell.config` as a json file or Typescritp file.
49
+
50
+ Managing settings in TypeScript, provide more efficiency and type safety features.
51
+ You can check this configuration in action [here](../../samples/default-app/app-shell.config.ts).
52
+
53
+ ## Automatic configuration
54
+
55
+ `autoViewsAndRoutes`: automatically exports views from the "src/pages" directory (or any other specified folder).
56
+ This includes automatic route configuration (merges with existing ones, if any).
57
+
58
+ `autoDevMenu` (dev only): creates a navigation menu derived from the views.
59
+ This ensures a more organized and streamlined development process.
60
+
61
+ Empty Configuration Validity: With these automatic features in place, the configuration file isn't even mandatory for dev environments.
62
+
43
63
  ## `<base href="...">` tag
44
64
 
45
65
  The <base href="..."> tag is automatically injected at index.html file during the build process. The value of tag is the same as for the app base path. More information related to the way app base path is obtained can be checked [here](../../../docs/app-shell-utilities.md#usehvappshellbasepath).
@@ -57,4 +77,4 @@ Vite plugin creates the following env properties:
57
77
  | APP_BASE_PATH | App base path value | More information about the base path value can be checked [here](https://vitejs.dev/guide/env-and-mode.html). Usage example: [here](../../samples/internal-route-ice-cream-app/src/App.tsx) |
58
78
 
59
79
 
60
- _Typescript projects shall use [env.d.ts](../../samples/internal-route-ice-cream-app/src/env.d.ts) for type's definition._
80
+ _Typescript projects shall use [env.d.ts](../../samples/internal-route-ice-cream-app/src/env.d.ts) for type's definition._
@@ -1,10 +1,13 @@
1
1
  import { PluginOption } from "vite";
2
+ import type { HvAppShellConfig } from "@hitachivantara/app-shell-shared";
3
+ type AppShellConfigFunction = (pluginOptions: AppShellVitePluginOptions) => HvAppShellConfig;
4
+ export declare function configAppShell(config: AppShellConfigFunction | HvAppShellConfig): HvAppShellConfig | AppShellConfigFunction;
2
5
  export declare enum ApplicationBundleType {
3
6
  APP = "app",
4
7
  BUNDLE = "bundle"
5
8
  }
6
9
  type ApplicationBundleTypeKey = `${ApplicationBundleType}`;
7
- interface AppShellVitePluginOptions {
10
+ export interface AppShellVitePluginOptions {
8
11
  /**
9
12
  * Project root directory. Most likely location of the vite config file.
10
13
  *
@@ -48,6 +51,23 @@ interface AppShellVitePluginOptions {
48
51
  token: string;
49
52
  value: string;
50
53
  }];
54
+ /**
55
+ * The folder containing Views to be shared as Shared Modules. Defaults to "src/pages".
56
+ *
57
+ * The folder path must be relative to the project root (e.g. "src/pages").
58
+ */
59
+ viewsFolder?: string;
60
+ /**
61
+ * If set, the plugin will search for Views at the folder specified by `viewsFolder` and will add them to the App Shell configuration as views.
62
+ * The views' modules will be exported accordingly, and a route will be created from the folder structure.
63
+ * Dynamic route parameters are supported by prefixing the folder name with a $ (e.g. "src/pages/List/$id/index.tsx" will be configured as "/list/:id").
64
+ */
65
+ autoViewsAndRoutes?: boolean;
66
+ /**
67
+ * If true, the plugin will try to automatically add the views to the menu.
68
+ * This this only valid when running in dev mode and if the app-shell.config.json file does not contain any menu configuration already.
69
+ */
70
+ autoDevMenu?: boolean;
51
71
  }
52
72
  /**
53
73
  * Vite plugin to support App Shell apps setup
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAc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AAE,OAAO,CAAC;IAE5B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAExD;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA+CD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,GAAE,yBAA8B,GACnC,YAAY,CAyVd;AAED,eAAe,kBAAkB,CAAC"}
@@ -2,15 +2,25 @@ import virtual from "@rollup/plugin-virtual";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { viteStaticCopy } from "vite-plugin-static-copy";
5
+ import { register, createEsmHooks } from "ts-node";
5
6
  import { createRequire } from "node:module";
6
7
  import generateImportmap from "./vite-importmap-plugin.js";
8
+ createEsmHooks(register({
9
+ transpileOnly: true,
10
+ moduleTypes: {
11
+ "app-shell.config.ts": "cjs"
12
+ }
13
+ }));
7
14
  const require = createRequire(import.meta.url);
15
+ export function configAppShell(config) {
16
+ return config;
17
+ }
8
18
  /**
9
19
  * Return the main app (identified by @self)
10
20
  * @param appShellConfig The App shell configuration
11
21
  */
12
22
  const getMainApp = (appShellConfig) => {
13
- return appShellConfig.apps.filter(app => app.id === "@self")[0];
23
+ return appShellConfig.apps?.filter(app => app.id === "@self")[0];
14
24
  };
15
25
  /**
16
26
  * Return the public path to be use by vite to launch the application.
@@ -75,26 +85,28 @@ var ViteCommand;
75
85
  function getAppModules(root, appShellConfig, selfAppName) {
76
86
  const appModules = {};
77
87
  const selfApp = getMainApp(appShellConfig);
78
- const selfViews = selfApp?.views?.map(view => {
79
- const bundleName = view.bundle.replace(/^src\//, "");
80
- return {
81
- ...view,
82
- bundleName
83
- };
84
- }) ?? [];
85
- selfViews.forEach(view => {
86
- appModules[view.bundleName] = path.resolve(root, view.bundle);
87
- });
88
- const selfModules = selfApp?.modules?.map(module => {
89
- const bundleName = module.bundle.replace(/^src\//, "");
90
- return {
91
- ...module,
92
- bundleName
93
- };
94
- }) ?? [];
95
- selfModules.forEach(module => {
96
- appModules[module.bundleName] = path.resolve(root, module.bundle);
97
- });
88
+ if (selfApp != null) {
89
+ const selfViews = selfApp.views?.map(view => {
90
+ const bundleName = view.bundle.replace(/^src\//, "");
91
+ return {
92
+ ...view,
93
+ bundleName
94
+ };
95
+ }) ?? [];
96
+ selfViews.forEach(view => {
97
+ appModules[view.bundleName] = path.resolve(root, view.bundle);
98
+ });
99
+ const selfModules = selfApp.modules?.map(module => {
100
+ const bundleName = module.bundle.replace(/^src\//, "");
101
+ return {
102
+ ...module,
103
+ bundleName
104
+ };
105
+ }) ?? [];
106
+ selfModules.forEach(module => {
107
+ appModules[module.bundleName] = path.resolve(root, module.bundle);
108
+ });
109
+ }
98
110
  const implicitThemeModules = appShellConfig?.theming?.themes?.map(theme => {
99
111
  if (theme.startsWith("/src/") ||
100
112
  theme.startsWith("@self/") ||
@@ -201,7 +213,9 @@ function processConfiguration(root, appShellConfig, selfAppName, buildEntryPoint
201
213
  });
202
214
  if (selfApp) {
203
215
  selfApp.views = selfApp.views?.map(view => {
204
- const bundleName = view.bundle.replace(/^src\//, "");
216
+ const bundleName = view.bundle
217
+ .replace(/^src\//, "")
218
+ .replaceAll(/\$/g, "_");
205
219
  return {
206
220
  ...view,
207
221
  bundle: chunks[bundleName]
@@ -249,7 +263,6 @@ const generateBaseTag = (appShellConfig) => {
249
263
  return {
250
264
  name: "vite-plugin-generate-base",
251
265
  enforce: "pre",
252
- // except for react and react-dom when in dev mode
253
266
  transformIndexHtml: {
254
267
  enforce: "post",
255
268
  transform: (html) => ({
@@ -265,30 +278,191 @@ const generateBaseTag = (appShellConfig) => {
265
278
  }
266
279
  };
267
280
  };
281
+ function serveAppShellConfig(appShellConfig, root, appShellConfigFile, automaticViewsFolder) {
282
+ return {
283
+ name: "vite-plugin-watch-app-shell-config",
284
+ configureServer(server) {
285
+ const restartServer = (file) => {
286
+ if (appShellConfigFile != null && file.endsWith(appShellConfigFile)) {
287
+ console.info("App Shell configuration file changed. Reloading...");
288
+ delete require.cache[require.resolve(path.resolve(root, appShellConfigFile))];
289
+ server.restart();
290
+ }
291
+ };
292
+ const restartServer2 = (file) => {
293
+ if (automaticViewsFolder != null && file.match(/\/index\.[tj]sx?$/)) {
294
+ console.info("Automatic views folder changed. Reloading...");
295
+ server.restart();
296
+ }
297
+ };
298
+ if (appShellConfigFile != null) {
299
+ server.watcher.add(path.resolve(root, appShellConfigFile));
300
+ server.watcher.on("change", restartServer);
301
+ }
302
+ if (automaticViewsFolder != null) {
303
+ server.watcher.add(path.resolve(root, automaticViewsFolder));
304
+ server.watcher.on("unlink", restartServer2);
305
+ server.watcher.on("add", restartServer2);
306
+ }
307
+ const publicPath = getPublicPath(appShellConfig);
308
+ server.middlewares.use(`${publicPath}app-shell.config.json`, async (req, res) => {
309
+ res.end(JSON.stringify(appShellConfig));
310
+ });
311
+ }
312
+ };
313
+ }
268
314
  export var ApplicationBundleType;
269
315
  (function (ApplicationBundleType) {
270
316
  ApplicationBundleType["APP"] = "app";
271
317
  ApplicationBundleType["BUNDLE"] = "bundle";
272
318
  })(ApplicationBundleType || (ApplicationBundleType = {}));
319
+ const DEFAULT_CONFIG_FILES = [
320
+ "app-shell.config.ts",
321
+ "app-shell.config.js",
322
+ "app-shell.config.json"
323
+ ];
324
+ function findIndexFiles(dir) {
325
+ const files = [];
326
+ fs.readdirSync(dir).forEach(file => {
327
+ const filePath = path.join(dir, file);
328
+ const stat = fs.statSync(filePath);
329
+ if (stat.isDirectory()) {
330
+ files.push(...findIndexFiles(filePath));
331
+ }
332
+ else if (file.match(/^index\.[tj]sx?$/)) {
333
+ files.push(filePath);
334
+ }
335
+ });
336
+ return files;
337
+ }
338
+ function mapIndexFilesToRoutes(files, folder) {
339
+ const routes = [];
340
+ files.forEach(filePath => {
341
+ const bundle = filePath.substring(filePath.lastIndexOf(`/${folder.replace(/^\/|\/$/g, "")}/`) + 1, filePath.lastIndexOf("/"));
342
+ const route = bundle
343
+ .replace(new RegExp(`^${folder}`), "")
344
+ .replace(/index\.[t|j]sx?$/, "")
345
+ .replaceAll(/\$/g, ":")
346
+ .toLowerCase();
347
+ routes.push({ bundle, route });
348
+ });
349
+ return routes;
350
+ }
273
351
  /**
274
352
  * Vite plugin to support App Shell apps setup
275
353
  * @param opts Plugin options
276
354
  */
277
355
  export function appShellVitePlugin(opts = {}) {
278
- const root = opts.root || process.cwd();
279
- const mode = opts.mode || ViteBuildMode.PRODUCTION;
280
- const externalImportMap = opts.externalImportMap || false;
281
- const type = opts.type ?? ApplicationBundleType.APP;
356
+ const { root = process.cwd(), mode = ViteBuildMode.PRODUCTION, externalImportMap = false, type = ApplicationBundleType.APP, viewsFolder = "src/pages", autoViewsAndRoutes = false, autoDevMenu = false } = opts;
282
357
  const buildEntryPoint = type !== ApplicationBundleType.BUNDLE;
283
358
  console.info(`Vite running in mode: ${mode}`);
284
359
  const devMode = mode === ViteBuildMode.DEVELOPMENT;
285
360
  const packageJsonRaw = fs.readFileSync(path.resolve(root, "package.json"), "utf-8");
286
361
  const packageJson = JSON.parse(packageJsonRaw);
287
- let appShellConfigRaw = fs.readFileSync(path.resolve(root, "app-shell.config.json"), "utf-8");
288
- opts.configReplacements?.forEach(item => {
289
- appShellConfigRaw = appShellConfigRaw.replaceAll(`@@${item.token}@@`, item.value);
290
- });
291
- const appShellConfiguration = JSON.parse(appShellConfigRaw);
362
+ const appShellConfigFile = DEFAULT_CONFIG_FILES.find(file => fs.existsSync(path.resolve(root, file)));
363
+ let appShellConfiguration;
364
+ if (appShellConfigFile) {
365
+ if (appShellConfigFile.endsWith(".json")) {
366
+ // token replacement is only supported for json files
367
+ let appShellConfigRaw = fs.readFileSync(path.resolve(root, "app-shell.config.json"), "utf-8");
368
+ opts.configReplacements?.forEach(item => {
369
+ appShellConfigRaw = appShellConfigRaw.replaceAll(`@@${item.token}@@`, item.value);
370
+ });
371
+ appShellConfiguration = JSON.parse(appShellConfigRaw);
372
+ }
373
+ else {
374
+ // using require instead of import to avoids using --experimental-loader ts-node/esm
375
+ // eslint-disable-next-line import/no-dynamic-require
376
+ const loadedAppShellConfig = require(path.resolve(root, appShellConfigFile)).default;
377
+ if (typeof loadedAppShellConfig === "function") {
378
+ appShellConfiguration = loadedAppShellConfig(opts);
379
+ }
380
+ else {
381
+ appShellConfiguration = loadedAppShellConfig;
382
+ }
383
+ }
384
+ }
385
+ else {
386
+ // an empty configuration is actually valid
387
+ // and with the automatic views option, it can even make sense
388
+ appShellConfiguration = {};
389
+ }
390
+ let selfApp = getMainApp(appShellConfiguration);
391
+ if (autoViewsAndRoutes != null) {
392
+ const folder = path.resolve(root, viewsFolder);
393
+ if (fs.existsSync(folder)) {
394
+ const views = mapIndexFilesToRoutes(findIndexFiles(folder), viewsFolder);
395
+ if (views.length > 0) {
396
+ if (selfApp == null) {
397
+ selfApp = {
398
+ id: "@self",
399
+ baseUrl: "/"
400
+ };
401
+ if (appShellConfiguration.apps == null) {
402
+ appShellConfiguration.apps = [];
403
+ }
404
+ appShellConfiguration.apps.push(selfApp);
405
+ }
406
+ if (selfApp.views != null && selfApp.views.length > 0) {
407
+ const nowOverlappingViews = views.filter(view => {
408
+ const exists = selfApp.views.some(existingView => existingView.bundle === view.bundle ||
409
+ existingView.route === view.route);
410
+ return !exists;
411
+ });
412
+ selfApp.views.push(...nowOverlappingViews);
413
+ }
414
+ else {
415
+ selfApp.views = views;
416
+ }
417
+ }
418
+ }
419
+ }
420
+ if (devMode && autoDevMenu) {
421
+ if (appShellConfiguration.menu == null ||
422
+ appShellConfiguration.menu.length === 0) {
423
+ if (selfApp != null &&
424
+ selfApp.views != null &&
425
+ selfApp.views.length > 0) {
426
+ const menu = [];
427
+ for (let i = 0; i !== selfApp.views.length; i += 1) {
428
+ const view = selfApp.views[i];
429
+ // skip dynamic routes (e.g. /list/:id))
430
+ if (view.route.indexOf(":") === -1) {
431
+ let currentMenu = menu;
432
+ const bundleParts = view.bundle.split("/");
433
+ const numberOfParts = view.route
434
+ .split("/")
435
+ .filter(part => part !== "").length;
436
+ const srcFolderParts = bundleParts.length - numberOfParts;
437
+ if (bundleParts.length > srcFolderParts) {
438
+ for (let j = srcFolderParts; j !== bundleParts.length - 1; j += 1) {
439
+ const part = bundleParts[j];
440
+ let submenu = currentMenu.find(item => item.label === part);
441
+ if (submenu == null) {
442
+ submenu = {
443
+ label: part,
444
+ submenus: []
445
+ };
446
+ currentMenu.push(submenu);
447
+ }
448
+ currentMenu = submenu.submenus;
449
+ }
450
+ const label = bundleParts[bundleParts.length - 1];
451
+ let menuitem = currentMenu.find(item => item.label === label);
452
+ if (menuitem == null) {
453
+ menuitem = {
454
+ label
455
+ };
456
+ currentMenu.push(menuitem);
457
+ }
458
+ menuitem.target = view.route;
459
+ }
460
+ }
461
+ }
462
+ appShellConfiguration.menu = menu;
463
+ }
464
+ }
465
+ }
292
466
  return [
293
467
  // Copy all the required js bundles to final "bundles" folders, that will be injected by the importmap
294
468
  (buildEntryPoint || devMode) &&
@@ -325,6 +499,27 @@ export function appShellVitePlugin(opts = {}) {
325
499
  }),
326
500
  // create virtual endpoints to support dev mode
327
501
  virtual({
502
+ "/virtual/main.tsx": `import React, { Suspense } from "react";
503
+ import ReactDOM from "react-dom/client";
504
+ import App from "virtual:App.tsx";
505
+
506
+ const root = ReactDOM.createRoot(document.getElementById("hv-root"));
507
+
508
+ root.render(React.createElement(
509
+ Suspense,
510
+ { fallback: true },
511
+ React.createElement(App, null)
512
+ ));`,
513
+ "virtual:App.tsx": `import React from "react";
514
+ import { HvAppShell } from "@hitachivantara/app-shell";
515
+
516
+ const App = () => {
517
+ return React.createElement(HvAppShell, {
518
+ configUrl: window.location.origin + APP_BASE_PATH + "app-shell.config.json"
519
+ });
520
+ };
521
+
522
+ export default App;`,
328
523
  "/bundles/react.production.min.js": `import * as React from "react";
329
524
  export default React;
330
525
 
@@ -409,7 +604,8 @@ export function appShellVitePlugin(opts = {}) {
409
604
  ], externalImportMap && buildEntryPoint),
410
605
  buildEntryPoint && generateBaseTag(appShellConfiguration),
411
606
  // process configuration
412
- processConfiguration(root, appShellConfiguration, packageJson.name, buildEntryPoint)
607
+ processConfiguration(root, appShellConfiguration, packageJson.name, buildEntryPoint),
608
+ serveAppShellConfig(appShellConfiguration, root, appShellConfigFile, autoViewsAndRoutes ? viewsFolder : undefined)
413
609
  ];
414
610
  }
415
611
  export default appShellVitePlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAE3D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,GAAG,CACjB,cAAgC,EACE,EAAE;IACpC,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,cAAgC,EAAU,EAAE;IACjE,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,CAAC;KACZ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B,EAAE,2CAA2C;YAC7D,oCAAoC,EAClC,qCAAqC;YACvC,GAAG,qBAAqB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBAClD,IAAI,GAAG,CAAC,EAAE,KAAK,OAAO,EAAE;oBACtB,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;oBAC1C,IAAI,OAAO,EAAE;wBACX,GAAG,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;qBACjC;iBACF;qBAAM;oBACL,GAAG,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;iBACjC;gBACD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAA4B,CAAC;SACjC,EACD;YACE,OAAO;YACP,WAAW;YACX,kBAAkB;YAClB,kCAAkC;YAClC,oCAAoC;YACpC,gBAAgB;YAChB,gBAAgB;YAChB,OAAO;YACP,WAAW,CAAC,IAAI;SACjB,EACD,iBAAiB,IAAI,eAAe,CACrC;QACD,eAAe,IAAI,eAAe,CAAC,qBAAqB,CAAC;QACzD,wBAAwB;QACxB,oBAAoB,CAClB,IAAI,EACJ,qBAAqB,EACrB,WAAW,CAAC,IAAI,EAChB,eAAe,CAChB;KACF,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import { NormalizedOutputOptions, OutputBundle } from \"rollup\";\nimport virtual from \"@rollup/plugin-virtual\";\n\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\nimport { PluginOption, UserConfig } from \"vite\";\n\nimport { createRequire } from \"node:module\";\nimport {\n HvAppShellAppsConfig,\n HvAppShellConfig\n} from \"@hitachivantara/app-shell-shared\";\nimport generateImportmap from \"./vite-importmap-plugin.js\";\n\nconst require = createRequire(import.meta.url);\n\n/**\n * Return the main app (identified by @self)\n * @param appShellConfig The App shell configuration\n */\nconst getMainApp = (\n appShellConfig: HvAppShellConfig\n): HvAppShellAppsConfig | undefined => {\n return appShellConfig.apps.filter(app => app.id === \"@self\")[0];\n};\n\n/**\n * Return the public path to be use by vite to launch the application.\n * Value is obtained by returning the baseUrl value of the main app {@link #getMainApp}\n * @param appShellConfig The App shell configuration\n */\nconst getPublicPath = (appShellConfig: HvAppShellConfig): string => {\n const mainApp = getMainApp(appShellConfig);\n if (!mainApp) {\n return \"/\";\n }\n const url = mainApp.baseUrl;\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\n/**\n * Resolves the module name and normalizes slashes to be posix/unix-like forward slashes.\n *\n * @param moduleName The name of the module to be searched for\n * @returns The module path normalized\n */\nfunction resolveModule(moduleName: string) {\n const module = require.resolve(moduleName);\n return module.replace(/\\\\+/g, \"/\");\n}\n\n/**\n * This function will find out the module path using node `require.resolve` function\n * and add the suffix param after the folder with module name.\n *\n * @param moduleName \"@module/name\"\n * @param suffix to be added after the module path\n * @returns the /path/to/@module/name/<suffix>\n */\nfunction getModulePath(moduleName: string, suffix: string) {\n const moduleNameWithSlashes = `/${moduleName}/`;\n const module = resolveModule(moduleName);\n const modulePosition = module.lastIndexOf(moduleNameWithSlashes);\n return `${module.slice(\n 0,\n modulePosition + moduleNameWithSlashes.length\n )}${suffix}`;\n}\n\nenum ViteBuildMode {\n PRODUCTION = \"production\",\n DEVELOPMENT = \"development\"\n}\n\nenum ViteCommand {\n BUILD = \"build\",\n SERVE = \"serve\"\n}\n\n/**\n * Returns the modules to be created by the build of the app.\n * The list of modules is defined by the app-shell-config.json file routes ( limited to the @self app)\n * The bundles will be created following the original directories structure ( having the src folder path removed)\n *\n * @param root Project root directory.\n * @param appShellConfig The App Shell configuration.\n */\nfunction getAppModules(\n root: string,\n appShellConfig: HvAppShellConfig,\n selfAppName: string\n) {\n const appModules: { [key: string]: string } = {};\n\n const selfApp = getMainApp(appShellConfig);\n const selfViews =\n selfApp?.views?.map(view => {\n const bundleName = view.bundle.replace(/^src\\//, \"\");\n return {\n ...view,\n bundleName\n };\n }) ?? [];\n\n selfViews.forEach(view => {\n appModules[view.bundleName] = path.resolve(root, view.bundle);\n });\n\n const selfModules =\n selfApp?.modules?.map(module => {\n const bundleName = module.bundle.replace(/^src\\//, \"\");\n return {\n ...module,\n bundleName\n };\n }) ?? [];\n\n selfModules.forEach(module => {\n appModules[module.bundleName] = path.resolve(root, module.bundle);\n });\n\n const implicitThemeModules =\n appShellConfig?.theming?.themes?.map(theme => {\n if (\n theme.startsWith(\"/src/\") ||\n theme.startsWith(\"@self/\") ||\n theme.startsWith(selfAppName)\n ) {\n const bundle = theme\n .replace(/^@self\\//, \"\")\n .replace(new RegExp(`^${selfAppName}/`), \"\");\n const bundleName = bundle.replace(/^(\\/?)src\\//, \"\");\n return {\n bundle,\n bundleName\n };\n }\n\n return undefined;\n }) ?? [];\n\n implicitThemeModules.forEach(module => {\n if (module != null && appModules[module.bundleName] == null) {\n appModules[module.bundleName] = path.resolve(root, module.bundle);\n }\n });\n\n console.info(\"Modules exported by the application bundle:\", appModules);\n return appModules;\n}\n\n/**\n * Process configuration, executing several tasks:\n * - Create rollup configuration to support module creation\n * - Generates final transformed configuration json\n * - \"base\" value is always \"./\" for build, and main app baseUrl for preview or dev\n * - Injects the APP_BASE_PATH env prop, to be used by the apps (if required)\n * @param root Project root directory.\n * @param appShellConfig The original App Shell configuration json.\n * @param selfAppName The name of the application bundle being built.\n * @param buildEntryPoint If true, the index.html entry point will be added to the bundle.\n */\nfunction processConfiguration(\n root: string,\n appShellConfig: HvAppShellConfig,\n selfAppName: string,\n buildEntryPoint: boolean\n): PluginOption {\n const selfApp = getMainApp(appShellConfig);\n\n return {\n name: \"vite-plugin-appShell-configuration-processor\",\n\n config(config: UserConfig, { command }) {\n const projectRoot = root ?? config.root;\n\n const publicPath = getPublicPath(appShellConfig);\n return {\n build: {\n rollupOptions: {\n preserveEntrySignatures: \"strict\",\n input: {\n ...(buildEntryPoint &&\n fs.existsSync(path.resolve(projectRoot, \"index.html\"))\n ? { main: path.resolve(projectRoot, \"index.html\") }\n : {}),\n ...getAppModules(projectRoot, appShellConfig, selfAppName)\n },\n output: {\n entryFileNames: \"[name].js\"\n }\n }\n },\n // if serve (preview/dev) it uses the baseUrl. Otherwise(build), use ./\n base: command === ViteCommand.SERVE ? publicPath : \"./\",\n define: {\n ...config.define,\n APP_BASE_PATH: JSON.stringify(publicPath)\n }\n };\n },\n\n /**\n * Rollup hook with the info for bundle generation\n * It will be used to create a new configuration with:\n * - bundles replace with the final location (e.g. -> \"bundle\": \"src/pages/Main\" transformed to \"bundle\": \"pages/Main.js\",\n * @param options build options\n * @param bundle bundles information\n */\n async generateBundle(\n options: NormalizedOutputOptions,\n bundle: OutputBundle\n ) {\n // obtain the directory (dist) where the new config file will be placed\n let targetDir: string | undefined;\n if (options.dir) {\n targetDir = options.dir;\n } else if (options.file) {\n targetDir = path.dirname(options.file);\n }\n\n if (!targetDir) {\n throw new Error(\n \"Please set outputPath, so we can know where to place the json file\"\n );\n }\n\n // create the targetDir if it does not exist\n if (!fs.existsSync(targetDir)) {\n fs.mkdirSync(targetDir, { recursive: true });\n }\n\n /**\n * Creating a map with each chunk and the final name. Only the bundles with type=chunck are important\n * Filename do not include the src path at the value\n */\n const chunks: Record<string, string> = {};\n\n Object.keys(bundle).forEach(key => {\n const chunk = bundle[key];\n if (chunk.type === \"chunk\") {\n const outputChunk = chunk;\n if (outputChunk.isEntry) {\n const { fileName } = outputChunk;\n const { name } = outputChunk;\n\n chunks[name] = fileName;\n }\n }\n });\n\n if (selfApp) {\n selfApp.views = selfApp.views?.map(view => {\n const bundleName = view.bundle.replace(/^src\\//, \"\");\n return {\n ...view,\n bundle: chunks[bundleName]\n };\n });\n selfApp.modules = selfApp.modules?.map(module => {\n const bundleName = module.bundle.replace(/^src\\//, \"\");\n return {\n ...module,\n bundle: chunks[bundleName]\n };\n });\n\n // replace references to @self with the name of this application bundle\n selfApp.id = selfAppName;\n\n // also replace implicit references to selfApp in other parts of the configuration\n const { theming } = appShellConfig;\n if (theming != null) {\n theming.themes = theming.themes?.map(theme => {\n if (\n theme.startsWith(\"@self/\") ||\n theme.startsWith(selfAppName) ||\n theme.startsWith(\"/src/\")\n ) {\n const bundleName = theme\n .replace(/^@self\\//, \"\")\n .replace(new RegExp(`^${selfAppName}/`), \"\")\n .replace(/^(\\/?)src\\//, \"\");\n return `${selfAppName}/${chunks[bundleName]}`;\n }\n\n return theme;\n });\n }\n }\n\n const finalAppShellConfig = buildEntryPoint\n ? { ...appShellConfig }\n : { name: appShellConfig.name, apps: [selfApp] };\n\n fs.writeFileSync(\n path.resolve(targetDir, \"app-shell.config.json\"),\n JSON.stringify(finalAppShellConfig)\n );\n }\n };\n}\n\n/**\n * Add the <BASE> tag at index.html file. Tag value is obtained by the main app ({@link #getMainApp}) baseUrl ({@link #getPublicPath})‘\n * @param appShellConfig The app shell configuration.\n */\nconst generateBaseTag = (appShellConfig: HvAppShellConfig): PluginOption => {\n const publicPath = getPublicPath(appShellConfig);\n return {\n name: \"vite-plugin-generate-base\",\n enforce: \"pre\",\n // except for react and react-dom when in dev mode\n transformIndexHtml: {\n enforce: \"post\",\n transform: (html: string) => ({\n html,\n tags: [\n {\n tag: \"base\",\n attrs: { href: publicPath },\n injectTo: \"head-prepend\"\n }\n ]\n })\n }\n };\n};\n\nexport enum ApplicationBundleType {\n APP = \"app\",\n BUNDLE = \"bundle\"\n}\n\ntype ApplicationBundleTypeKey = `${ApplicationBundleType}`;\n\ninterface AppShellVitePluginOptions {\n /**\n * Project root directory. Most likely location of the vite config file.\n *\n * @default process.cwd()\n */\n root?: string;\n /**\n * Execution mode.\n */\n mode?: string;\n /**\n * If true, the plugin will generate the importmap with an external js file instead of inline in the html.\n * The map will be saved at the root of the application destination dir and named as \"importmap.js\"\n *\n * @default false\n */\n externalImportMap?: boolean;\n\n /**\n * Type of application bundle being built. Can be \"app\" or \"bundle\".\n *\n * - \"app\": The application bundle includes both the index.html entry point and the exported modules.\n * - \"bundle\": The application bundle will not include the index.html entry point.\n *\n * @default \"app\"\n */\n type?: ApplicationBundleTypeKey;\n\n /** Array of tokens that are replaced at app-shell.config.json during the build of the solution.\n * e.g.\n * {\n * token: \"USER_NOTIFICATIONS_URL\",\n * value: \"http://localhost:8080\"\n * }\n * Tokens used at config file must be wrapped (at the beginning and at the end) by @@ sequence\n * e.g.\n * {\n * \"id\": \"@hv/user-notifications-client\",\n * \"baseUrl\": \"@@USER_NOTIFICATIONS_URL@@\"\n * }\n */\n configReplacements?: [{ token: string; value: string }];\n}\n\n/**\n * Vite plugin to support App Shell apps setup\n * @param opts Plugin options\n */\nexport function appShellVitePlugin(\n opts: AppShellVitePluginOptions = {}\n): PluginOption {\n const root = opts.root || process.cwd();\n const mode = opts.mode || ViteBuildMode.PRODUCTION;\n const externalImportMap = opts.externalImportMap || false;\n const type = opts.type ?? ApplicationBundleType.APP;\n\n const buildEntryPoint = type !== ApplicationBundleType.BUNDLE;\n\n console.info(`Vite running in mode: ${mode}`);\n\n const devMode = mode === ViteBuildMode.DEVELOPMENT;\n\n const packageJsonRaw = fs.readFileSync(\n path.resolve(root, \"package.json\"),\n \"utf-8\"\n );\n const packageJson = JSON.parse(packageJsonRaw);\n\n let appShellConfigRaw = fs.readFileSync(\n path.resolve(root, \"app-shell.config.json\"),\n \"utf-8\"\n );\n\n opts.configReplacements?.forEach(item => {\n appShellConfigRaw = appShellConfigRaw.replaceAll(\n `@@${item.token}@@`,\n item.value\n );\n });\n\n const appShellConfiguration = JSON.parse(\n appShellConfigRaw\n ) as HvAppShellConfig;\n\n return [\n // Copy all the required js bundles to final \"bundles\" folders, that will be injected by the importmap\n (buildEntryPoint || devMode) &&\n viteStaticCopy({\n targets: [\n {\n src: getModulePath(\"es-module-shims\", \"dist/*\"),\n dest: \"bundles\"\n },\n ...(!devMode && buildEntryPoint\n ? [\n {\n src: [\n resolveModule(\"./esm-externals/react.production.min.js\"),\n resolveModule(\n \"./esm-externals/react.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/react-dom.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/react-dom.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/react-router-dom.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/react-router-dom.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/emotion-react.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/emotion-react.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/emotion-cache.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/emotion-cache.production.min.js.map\"\n ),\n resolveModule(\n \"@hitachivantara/app-shell-shared/bundles/app-shell-shared.esm.js\"\n ),\n resolveModule(\n \"@hitachivantara/app-shell-shared/bundles/app-shell-shared.esm.js.map\"\n ),\n resolveModule(\n \"@hitachivantara/uikit-react-shared/bundles/uikit-react-shared.esm.js\"\n ),\n resolveModule(\n \"@hitachivantara/uikit-react-shared/bundles/uikit-react-shared.esm.js.map\"\n )\n ],\n dest: \"bundles\"\n }\n ]\n : [])\n ]\n }),\n\n // create virtual endpoints to support dev mode\n virtual({\n \"/bundles/react.production.min.js\": `import * as React from \"react\";\n export default React;\n\n export {\n Fragment,\n StrictMode,\n Profiler,\n Suspense,\n Children,\n Component,\n PureComponent,\n cloneElement,\n createContext,\n createElement,\n createFactory,\n createRef,\n forwardRef,\n isValidElement,\n lazy,\n memo,\n useCallback,\n useContext,\n useDebugValue,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n version,\n } from \"react\";`,\n \"/bundles/react-dom.production.min.js\": `export {\n default,\n flushSync,\n createPortal,\n findDOMNode,\n hydrate,\n render,\n unmountComponentAtNode,\n unstable_batchedUpdates,\n unstable_renderSubtreeIntoContainer,\n version,\n } from \"react-dom\";`,\n \"/bundles/react-router-dom.production.min.js\": `export * from \"react-router-dom\";`,\n \"/bundles/emotion-react.production.min.js\": `export * from \"@emotion/react\";`,\n \"/bundles/emotion-cache.production.min.js\": `import createCache from \"@emotion/cache\"; export default createCache;`,\n \"/bundles/app-shell-shared.esm.js\": `export * from \"@hitachivantara/app-shell-shared\";`,\n \"/bundles/uikit-react-shared.esm.js\": `export * from \"@hitachivantara/uikit-react-shared\";`\n }),\n\n // generation of the importmap to create the link to the js bundles\n generateImportmap(\n {\n react: `./bundles/react.production.min.js`,\n \"react-dom\": `./bundles/react-dom.production.min.js`,\n \"react-router-dom\": `./bundles/react-router-dom.production.min.js`,\n \"@hitachivantara/app-shell-shared\": \"./bundles/app-shell-shared.esm.js\",\n \"@emotion/react\": \"./bundles/emotion-react.production.min.js\",\n \"@emotion/cache\": \"./bundles/emotion-cache.production.min.js\",\n \"@hitachivantara/uikit-react-shared\":\n \"./bundles/uikit-react-shared.esm.js\",\n ...appShellConfiguration?.apps?.reduce((acc, app) => {\n if (app.id === \"@self\") {\n acc[`${packageJson.name}/`] = app.baseUrl;\n if (devMode) {\n acc[`${app.id}/`] = app.baseUrl;\n }\n } else {\n acc[`${app.id}/`] = app.baseUrl;\n }\n return acc;\n }, {} as Record<string, string>)\n },\n [\n \"react\",\n \"react-dom\",\n \"react-router-dom\",\n \"@hitachivantara/app-shell-shared\",\n \"@hitachivantara/uikit-react-shared\",\n \"@emotion/react\",\n \"@emotion/cache\",\n \"@self\",\n packageJson.name\n ],\n externalImportMap && buildEntryPoint\n ),\n buildEntryPoint && generateBaseTag(appShellConfiguration),\n // process configuration\n processConfiguration(\n root,\n appShellConfiguration,\n packageJson.name,\n buildEntryPoint\n )\n ];\n}\n\nexport default appShellVitePlugin;\n"]}
1
+ {"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE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EAChB,eAAe,CAChB;QACD,mBAAmB,CACjB,qBAAqB,EACrB,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAC7C;KACF,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import { NormalizedOutputOptions, OutputBundle } from \"rollup\";\nimport virtual from \"@rollup/plugin-virtual\";\n\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\nimport { PluginOption, UserConfig } from \"vite\";\n\nimport { register, createEsmHooks } from \"ts-node\";\nimport { createRequire } from \"node:module\";\n\nimport type {\n HvAppShellAppsConfig,\n HvAppShellConfig,\n HvAppShellViewsConfig\n} from \"@hitachivantara/app-shell-shared\";\n\nimport generateImportmap from \"./vite-importmap-plugin.js\";\n\ncreateEsmHooks(\n register({\n transpileOnly: true,\n moduleTypes: {\n \"app-shell.config.ts\": \"cjs\"\n }\n })\n);\nconst require = createRequire(import.meta.url);\n\ntype AppShellConfigFunction = (\n pluginOptions: AppShellVitePluginOptions\n) => HvAppShellConfig;\n\nexport function configAppShell(\n config: AppShellConfigFunction | HvAppShellConfig\n) {\n return config;\n}\n\n/**\n * Return the main app (identified by @self)\n * @param appShellConfig The App shell configuration\n */\nconst getMainApp = (\n appShellConfig: HvAppShellConfig\n): HvAppShellAppsConfig | undefined => {\n return appShellConfig.apps?.filter(app => app.id === \"@self\")[0];\n};\n\n/**\n * Return the public path to be use by vite to launch the application.\n * Value is obtained by returning the baseUrl value of the main app {@link #getMainApp}\n * @param appShellConfig The App shell configuration\n */\nconst getPublicPath = (appShellConfig: HvAppShellConfig): string => {\n const mainApp = getMainApp(appShellConfig);\n if (!mainApp) {\n return \"/\";\n }\n const url = mainApp.baseUrl;\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\n/**\n * Resolves the module name and normalizes slashes to be posix/unix-like forward slashes.\n *\n * @param moduleName The name of the module to be searched for\n * @returns The module path normalized\n */\nfunction resolveModule(moduleName: string) {\n const module = require.resolve(moduleName);\n return module.replace(/\\\\+/g, \"/\");\n}\n\n/**\n * This function will find out the module path using node `require.resolve` function\n * and add the suffix param after the folder with module name.\n *\n * @param moduleName \"@module/name\"\n * @param suffix to be added after the module path\n * @returns the /path/to/@module/name/<suffix>\n */\nfunction getModulePath(moduleName: string, suffix: string) {\n const moduleNameWithSlashes = `/${moduleName}/`;\n const module = resolveModule(moduleName);\n const modulePosition = module.lastIndexOf(moduleNameWithSlashes);\n return `${module.slice(\n 0,\n modulePosition + moduleNameWithSlashes.length\n )}${suffix}`;\n}\n\nenum ViteBuildMode {\n PRODUCTION = \"production\",\n DEVELOPMENT = \"development\"\n}\n\nenum ViteCommand {\n BUILD = \"build\",\n SERVE = \"serve\"\n}\n\n/**\n * Returns the modules to be created by the build of the app.\n * The list of modules is defined by the app-shell-config.json file routes ( limited to the @self app)\n * The bundles will be created following the original directories structure ( having the src folder path removed)\n *\n * @param root Project root directory.\n * @param appShellConfig The App Shell configuration.\n */\nfunction getAppModules(\n root: string,\n appShellConfig: HvAppShellConfig,\n selfAppName: string\n) {\n const appModules: { [key: string]: string } = {};\n\n const selfApp = getMainApp(appShellConfig);\n if (selfApp != null) {\n const selfViews =\n selfApp.views?.map(view => {\n const bundleName = view.bundle.replace(/^src\\//, \"\");\n return {\n ...view,\n bundleName\n };\n }) ?? [];\n\n selfViews.forEach(view => {\n appModules[view.bundleName] = path.resolve(root, view.bundle);\n });\n\n const selfModules =\n selfApp.modules?.map(module => {\n const bundleName = module.bundle.replace(/^src\\//, \"\");\n return {\n ...module,\n bundleName\n };\n }) ?? [];\n\n selfModules.forEach(module => {\n appModules[module.bundleName] = path.resolve(root, module.bundle);\n });\n }\n\n const implicitThemeModules =\n appShellConfig?.theming?.themes?.map(theme => {\n if (\n theme.startsWith(\"/src/\") ||\n theme.startsWith(\"@self/\") ||\n theme.startsWith(selfAppName)\n ) {\n const bundle = theme\n .replace(/^@self\\//, \"\")\n .replace(new RegExp(`^${selfAppName}/`), \"\");\n const bundleName = bundle.replace(/^(\\/?)src\\//, \"\");\n return {\n bundle,\n bundleName\n };\n }\n\n return undefined;\n }) ?? [];\n\n implicitThemeModules.forEach(module => {\n if (module != null && appModules[module.bundleName] == null) {\n appModules[module.bundleName] = path.resolve(root, module.bundle);\n }\n });\n\n console.info(\"Modules exported by the application bundle:\", appModules);\n return appModules;\n}\n\n/**\n * Process configuration, executing several tasks:\n * - Create rollup configuration to support module creation\n * - Generates final transformed configuration json\n * - \"base\" value is always \"./\" for build, and main app baseUrl for preview or dev\n * - Injects the APP_BASE_PATH env prop, to be used by the apps (if required)\n * @param root Project root directory.\n * @param appShellConfig The original App Shell configuration json.\n * @param selfAppName The name of the application bundle being built.\n * @param buildEntryPoint If true, the index.html entry point will be added to the bundle.\n */\nfunction processConfiguration(\n root: string,\n appShellConfig: HvAppShellConfig,\n selfAppName: string,\n buildEntryPoint: boolean\n): PluginOption {\n const selfApp = getMainApp(appShellConfig);\n\n return {\n name: \"vite-plugin-appShell-configuration-processor\",\n\n config(config: UserConfig, { command }) {\n const projectRoot = root ?? config.root;\n\n const publicPath = getPublicPath(appShellConfig);\n return {\n build: {\n rollupOptions: {\n preserveEntrySignatures: \"strict\",\n input: {\n ...(buildEntryPoint &&\n fs.existsSync(path.resolve(projectRoot, \"index.html\"))\n ? { main: path.resolve(projectRoot, \"index.html\") }\n : {}),\n ...getAppModules(projectRoot, appShellConfig, selfAppName)\n },\n output: {\n entryFileNames: \"[name].js\"\n }\n }\n },\n // if serve (preview/dev) it uses the baseUrl. Otherwise(build), use ./\n base: command === ViteCommand.SERVE ? publicPath : \"./\",\n define: {\n ...config.define,\n APP_BASE_PATH: JSON.stringify(publicPath)\n }\n };\n },\n\n /**\n * Rollup hook with the info for bundle generation\n * It will be used to create a new configuration with:\n * - bundles replace with the final location (e.g. -> \"bundle\": \"src/pages/Main\" transformed to \"bundle\": \"pages/Main.js\",\n * @param options build options\n * @param bundle bundles information\n */\n async generateBundle(\n options: NormalizedOutputOptions,\n bundle: OutputBundle\n ) {\n // obtain the directory (dist) where the new config file will be placed\n let targetDir: string | undefined;\n if (options.dir) {\n targetDir = options.dir;\n } else if (options.file) {\n targetDir = path.dirname(options.file);\n }\n\n if (!targetDir) {\n throw new Error(\n \"Please set outputPath, so we can know where to place the json file\"\n );\n }\n\n // create the targetDir if it does not exist\n if (!fs.existsSync(targetDir)) {\n fs.mkdirSync(targetDir, { recursive: true });\n }\n\n /**\n * Creating a map with each chunk and the final name. Only the bundles with type=chunck are important\n * Filename do not include the src path at the value\n */\n const chunks: Record<string, string> = {};\n\n Object.keys(bundle).forEach(key => {\n const chunk = bundle[key];\n if (chunk.type === \"chunk\") {\n const outputChunk = chunk;\n if (outputChunk.isEntry) {\n const { fileName } = outputChunk;\n const { name } = outputChunk;\n\n chunks[name] = fileName;\n }\n }\n });\n\n if (selfApp) {\n selfApp.views = selfApp.views?.map(view => {\n const bundleName = view.bundle\n .replace(/^src\\//, \"\")\n .replaceAll(/\\$/g, \"_\");\n return {\n ...view,\n bundle: chunks[bundleName]\n };\n });\n selfApp.modules = selfApp.modules?.map(module => {\n const bundleName = module.bundle.replace(/^src\\//, \"\");\n return {\n ...module,\n bundle: chunks[bundleName]\n };\n });\n\n // replace references to @self with the name of this application bundle\n selfApp.id = selfAppName;\n\n // also replace implicit references to selfApp in other parts of the configuration\n const { theming } = appShellConfig;\n if (theming != null) {\n theming.themes = theming.themes?.map(theme => {\n if (\n theme.startsWith(\"@self/\") ||\n theme.startsWith(selfAppName) ||\n theme.startsWith(\"/src/\")\n ) {\n const bundleName = theme\n .replace(/^@self\\//, \"\")\n .replace(new RegExp(`^${selfAppName}/`), \"\")\n .replace(/^(\\/?)src\\//, \"\");\n return `${selfAppName}/${chunks[bundleName]}`;\n }\n\n return theme;\n });\n }\n }\n\n const finalAppShellConfig = buildEntryPoint\n ? { ...appShellConfig }\n : { name: appShellConfig.name, apps: [selfApp] };\n\n fs.writeFileSync(\n path.resolve(targetDir, \"app-shell.config.json\"),\n JSON.stringify(finalAppShellConfig)\n );\n }\n };\n}\n\n/**\n * Add the <BASE> tag at index.html file. Tag value is obtained by the main app ({@link #getMainApp}) baseUrl ({@link #getPublicPath})‘\n * @param appShellConfig The app shell configuration.\n */\nconst generateBaseTag = (appShellConfig: HvAppShellConfig): PluginOption => {\n const publicPath = getPublicPath(appShellConfig);\n return {\n name: \"vite-plugin-generate-base\",\n enforce: \"pre\",\n transformIndexHtml: {\n enforce: \"post\",\n transform: (html: string) => ({\n html,\n tags: [\n {\n tag: \"base\",\n attrs: { href: publicPath },\n injectTo: \"head-prepend\"\n }\n ]\n })\n }\n };\n};\n\nfunction serveAppShellConfig(\n appShellConfig: HvAppShellConfig,\n root: string,\n appShellConfigFile?: string,\n automaticViewsFolder?: string\n): PluginOption {\n return {\n name: \"vite-plugin-watch-app-shell-config\",\n configureServer(server) {\n const restartServer = (file: string) => {\n if (appShellConfigFile != null && file.endsWith(appShellConfigFile)) {\n console.info(\"App Shell configuration file changed. Reloading...\");\n delete require.cache[\n require.resolve(path.resolve(root, appShellConfigFile))\n ];\n server.restart();\n }\n };\n\n const restartServer2 = (file: string) => {\n if (automaticViewsFolder != null && file.match(/\\/index\\.[tj]sx?$/)) {\n console.info(\"Automatic views folder changed. Reloading...\");\n server.restart();\n }\n };\n\n if (appShellConfigFile != null) {\n server.watcher.add(path.resolve(root, appShellConfigFile));\n server.watcher.on(\"change\", restartServer);\n }\n\n if (automaticViewsFolder != null) {\n server.watcher.add(path.resolve(root, automaticViewsFolder));\n server.watcher.on(\"unlink\", restartServer2);\n server.watcher.on(\"add\", restartServer2);\n }\n\n const publicPath = getPublicPath(appShellConfig);\n server.middlewares.use(\n `${publicPath}app-shell.config.json`,\n async (req, res) => {\n res.end(JSON.stringify(appShellConfig));\n }\n );\n }\n };\n}\n\nexport enum ApplicationBundleType {\n APP = \"app\",\n BUNDLE = \"bundle\"\n}\n\ntype ApplicationBundleTypeKey = `${ApplicationBundleType}`;\n\nexport interface AppShellVitePluginOptions {\n /**\n * Project root directory. Most likely location of the vite config file.\n *\n * @default process.cwd()\n */\n root?: string;\n /**\n * Execution mode.\n */\n mode?: string;\n /**\n * If true, the plugin will generate the importmap with an external js file instead of inline in the html.\n * The map will be saved at the root of the application destination dir and named as \"importmap.js\"\n *\n * @default false\n */\n externalImportMap?: boolean;\n\n /**\n * Type of application bundle being built. Can be \"app\" or \"bundle\".\n *\n * - \"app\": The application bundle includes both the index.html entry point and the exported modules.\n * - \"bundle\": The application bundle will not include the index.html entry point.\n *\n * @default \"app\"\n */\n type?: ApplicationBundleTypeKey;\n\n /** Array of tokens that are replaced at app-shell.config.json during the build of the solution.\n * e.g.\n * {\n * token: \"USER_NOTIFICATIONS_URL\",\n * value: \"http://localhost:8080\"\n * }\n * Tokens used at config file must be wrapped (at the beginning and at the end) by @@ sequence\n * e.g.\n * {\n * \"id\": \"@hv/user-notifications-client\",\n * \"baseUrl\": \"@@USER_NOTIFICATIONS_URL@@\"\n * }\n */\n configReplacements?: [{ token: string; value: string }];\n\n /**\n * The folder containing Views to be shared as Shared Modules. Defaults to \"src/pages\".\n *\n * The folder path must be relative to the project root (e.g. \"src/pages\").\n */\n viewsFolder?: string;\n /**\n * If set, the plugin will search for Views at the folder specified by `viewsFolder` and will add them to the App Shell configuration as views.\n * The views' modules will be exported accordingly, and a route will be created from the folder structure.\n * Dynamic route parameters are supported by prefixing the folder name with a $ (e.g. \"src/pages/List/$id/index.tsx\" will be configured as \"/list/:id\").\n */\n autoViewsAndRoutes?: boolean;\n /**\n * If true, the plugin will try to automatically add the views to the menu.\n * This this only valid when running in dev mode and if the app-shell.config.json file does not contain any menu configuration already.\n */\n autoDevMenu?: boolean;\n}\n\nconst DEFAULT_CONFIG_FILES = [\n \"app-shell.config.ts\",\n \"app-shell.config.js\",\n \"app-shell.config.json\"\n];\n\nfunction findIndexFiles(dir: string): string[] {\n const files: string[] = [];\n\n fs.readdirSync(dir).forEach(file => {\n const filePath = path.join(dir, file);\n const stat = fs.statSync(filePath);\n\n if (stat.isDirectory()) {\n files.push(...findIndexFiles(filePath));\n } else if (file.match(/^index\\.[tj]sx?$/)) {\n files.push(filePath);\n }\n });\n\n return files;\n}\n\nfunction mapIndexFilesToRoutes(\n files: string[],\n folder: string\n): HvAppShellViewsConfig[] {\n const routes: HvAppShellViewsConfig[] = [];\n\n files.forEach(filePath => {\n const bundle = filePath.substring(\n filePath.lastIndexOf(`/${folder.replace(/^\\/|\\/$/g, \"\")}/`) + 1,\n filePath.lastIndexOf(\"/\")\n );\n const route = bundle\n .replace(new RegExp(`^${folder}`), \"\")\n .replace(/index\\.[t|j]sx?$/, \"\")\n .replaceAll(/\\$/g, \":\")\n .toLowerCase();\n routes.push({ bundle, route });\n });\n\n return routes;\n}\n\n/**\n * Vite plugin to support App Shell apps setup\n * @param opts Plugin options\n */\nexport function appShellVitePlugin(\n opts: AppShellVitePluginOptions = {}\n): PluginOption {\n const {\n root = process.cwd(),\n mode = ViteBuildMode.PRODUCTION,\n externalImportMap = false,\n type = ApplicationBundleType.APP,\n viewsFolder = \"src/pages\",\n autoViewsAndRoutes = false,\n autoDevMenu = false\n } = opts;\n\n const buildEntryPoint = type !== ApplicationBundleType.BUNDLE;\n\n console.info(`Vite running in mode: ${mode}`);\n\n const devMode = mode === ViteBuildMode.DEVELOPMENT;\n\n const packageJsonRaw = fs.readFileSync(\n path.resolve(root, \"package.json\"),\n \"utf-8\"\n );\n const packageJson = JSON.parse(packageJsonRaw);\n\n const appShellConfigFile: string | undefined = DEFAULT_CONFIG_FILES.find(\n file => fs.existsSync(path.resolve(root, file))\n );\n\n let appShellConfiguration: HvAppShellConfig;\n if (appShellConfigFile) {\n if (appShellConfigFile.endsWith(\".json\")) {\n // token replacement is only supported for json files\n let appShellConfigRaw = fs.readFileSync(\n path.resolve(root, \"app-shell.config.json\"),\n \"utf-8\"\n );\n\n opts.configReplacements?.forEach(item => {\n appShellConfigRaw = appShellConfigRaw.replaceAll(\n `@@${item.token}@@`,\n item.value\n );\n });\n\n appShellConfiguration = JSON.parse(appShellConfigRaw) as HvAppShellConfig;\n } else {\n // using require instead of import to avoids using --experimental-loader ts-node/esm\n // eslint-disable-next-line import/no-dynamic-require\n const loadedAppShellConfig = require(path.resolve(\n root,\n appShellConfigFile\n )).default as AppShellConfigFunction | HvAppShellConfig;\n\n if (typeof loadedAppShellConfig === \"function\") {\n appShellConfiguration = loadedAppShellConfig(opts);\n } else {\n appShellConfiguration = loadedAppShellConfig;\n }\n }\n } else {\n // an empty configuration is actually valid\n // and with the automatic views option, it can even make sense\n appShellConfiguration = {};\n }\n\n let selfApp = getMainApp(appShellConfiguration);\n if (autoViewsAndRoutes != null) {\n const folder = path.resolve(root, viewsFolder);\n if (fs.existsSync(folder)) {\n const views = mapIndexFilesToRoutes(findIndexFiles(folder), viewsFolder);\n\n if (views.length > 0) {\n if (selfApp == null) {\n selfApp = {\n id: \"@self\",\n baseUrl: \"/\"\n };\n if (appShellConfiguration.apps == null) {\n appShellConfiguration.apps = [];\n }\n appShellConfiguration.apps.push(selfApp);\n }\n\n if (selfApp.views != null && selfApp.views.length > 0) {\n const nowOverlappingViews = views.filter(view => {\n const exists = selfApp!.views!.some(\n existingView =>\n existingView.bundle === view.bundle ||\n existingView.route === view.route\n );\n return !exists;\n });\n\n selfApp.views.push(...nowOverlappingViews);\n } else {\n selfApp.views = views;\n }\n }\n }\n }\n\n if (devMode && autoDevMenu) {\n if (\n appShellConfiguration.menu == null ||\n appShellConfiguration.menu.length === 0\n ) {\n if (\n selfApp != null &&\n selfApp.views != null &&\n selfApp.views.length > 0\n ) {\n const menu: HvAppShellConfig[\"menu\"] = [];\n for (let i = 0; i !== selfApp.views.length; i += 1) {\n const view = selfApp.views[i];\n\n // skip dynamic routes (e.g. /list/:id))\n if (view.route.indexOf(\":\") === -1) {\n let currentMenu = menu;\n const bundleParts = view.bundle.split(\"/\");\n const numberOfParts = view.route\n .split(\"/\")\n .filter(part => part !== \"\").length;\n const srcFolderParts = bundleParts.length - numberOfParts;\n if (bundleParts.length > srcFolderParts) {\n for (\n let j = srcFolderParts;\n j !== bundleParts.length - 1;\n j += 1\n ) {\n const part = bundleParts[j];\n let submenu = currentMenu.find(item => item.label === part);\n if (submenu == null) {\n submenu = {\n label: part,\n submenus: []\n };\n currentMenu.push(submenu);\n }\n currentMenu = submenu.submenus!;\n }\n\n const label = bundleParts[bundleParts.length - 1];\n let menuitem = currentMenu.find(item => item.label === label);\n if (menuitem == null) {\n menuitem = {\n label\n };\n currentMenu.push(menuitem);\n }\n menuitem.target = view.route;\n }\n }\n }\n\n appShellConfiguration.menu = menu;\n }\n }\n }\n\n return [\n // Copy all the required js bundles to final \"bundles\" folders, that will be injected by the importmap\n (buildEntryPoint || devMode) &&\n viteStaticCopy({\n targets: [\n {\n src: getModulePath(\"es-module-shims\", \"dist/*\"),\n dest: \"bundles\"\n },\n ...(!devMode && buildEntryPoint\n ? [\n {\n src: [\n resolveModule(\"./esm-externals/react.production.min.js\"),\n resolveModule(\n \"./esm-externals/react.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/react-dom.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/react-dom.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/react-router-dom.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/react-router-dom.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/emotion-react.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/emotion-react.production.min.js.map\"\n ),\n resolveModule(\n \"./esm-externals/emotion-cache.production.min.js\"\n ),\n resolveModule(\n \"./esm-externals/emotion-cache.production.min.js.map\"\n ),\n resolveModule(\n \"@hitachivantara/app-shell-shared/bundles/app-shell-shared.esm.js\"\n ),\n resolveModule(\n \"@hitachivantara/app-shell-shared/bundles/app-shell-shared.esm.js.map\"\n ),\n resolveModule(\n \"@hitachivantara/uikit-react-shared/bundles/uikit-react-shared.esm.js\"\n ),\n resolveModule(\n \"@hitachivantara/uikit-react-shared/bundles/uikit-react-shared.esm.js.map\"\n )\n ],\n dest: \"bundles\"\n }\n ]\n : [])\n ]\n }),\n\n // create virtual endpoints to support dev mode\n virtual({\n \"/virtual/main.tsx\": `import React, { Suspense } from \"react\";\n import ReactDOM from \"react-dom/client\";\n import App from \"virtual:App.tsx\";\n \n const root = ReactDOM.createRoot(document.getElementById(\"hv-root\"));\n \n root.render(React.createElement(\n Suspense,\n { fallback: true },\n React.createElement(App, null)\n ));`,\n \"virtual:App.tsx\": `import React from \"react\";\n import { HvAppShell } from \"@hitachivantara/app-shell\";\n\n const App = () => {\n return React.createElement(HvAppShell, {\n configUrl: window.location.origin + APP_BASE_PATH + \"app-shell.config.json\"\n });\n };\n \n export default App;`,\n\n \"/bundles/react.production.min.js\": `import * as React from \"react\";\n export default React;\n\n export {\n Fragment,\n StrictMode,\n Profiler,\n Suspense,\n Children,\n Component,\n PureComponent,\n cloneElement,\n createContext,\n createElement,\n createFactory,\n createRef,\n forwardRef,\n isValidElement,\n lazy,\n memo,\n useCallback,\n useContext,\n useDebugValue,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n version,\n } from \"react\";`,\n \"/bundles/react-dom.production.min.js\": `export {\n default,\n flushSync,\n createPortal,\n findDOMNode,\n hydrate,\n render,\n unmountComponentAtNode,\n unstable_batchedUpdates,\n unstable_renderSubtreeIntoContainer,\n version,\n } from \"react-dom\";`,\n \"/bundles/react-router-dom.production.min.js\": `export * from \"react-router-dom\";`,\n \"/bundles/emotion-react.production.min.js\": `export * from \"@emotion/react\";`,\n \"/bundles/emotion-cache.production.min.js\": `import createCache from \"@emotion/cache\"; export default createCache;`,\n \"/bundles/app-shell-shared.esm.js\": `export * from \"@hitachivantara/app-shell-shared\";`,\n \"/bundles/uikit-react-shared.esm.js\": `export * from \"@hitachivantara/uikit-react-shared\";`\n }),\n\n // generation of the importmap to create the link to the js bundles\n generateImportmap(\n {\n react: `./bundles/react.production.min.js`,\n \"react-dom\": `./bundles/react-dom.production.min.js`,\n \"react-router-dom\": `./bundles/react-router-dom.production.min.js`,\n \"@hitachivantara/app-shell-shared\": \"./bundles/app-shell-shared.esm.js\",\n \"@emotion/react\": \"./bundles/emotion-react.production.min.js\",\n \"@emotion/cache\": \"./bundles/emotion-cache.production.min.js\",\n \"@hitachivantara/uikit-react-shared\":\n \"./bundles/uikit-react-shared.esm.js\",\n ...appShellConfiguration?.apps?.reduce((acc, app) => {\n if (app.id === \"@self\") {\n acc[`${packageJson.name}/`] = app.baseUrl;\n if (devMode) {\n acc[`${app.id}/`] = app.baseUrl;\n }\n } else {\n acc[`${app.id}/`] = app.baseUrl;\n }\n return acc;\n }, {} as Record<string, string>)\n },\n [\n \"react\",\n \"react-dom\",\n \"react-router-dom\",\n \"@hitachivantara/app-shell-shared\",\n \"@hitachivantara/uikit-react-shared\",\n \"@emotion/react\",\n \"@emotion/cache\",\n \"@self\",\n packageJson.name\n ],\n externalImportMap && buildEntryPoint\n ),\n buildEntryPoint && generateBaseTag(appShellConfiguration),\n // process configuration\n processConfiguration(\n root,\n appShellConfiguration,\n packageJson.name,\n buildEntryPoint\n ),\n serveAppShellConfig(\n appShellConfiguration,\n root,\n appShellConfigFile,\n autoViewsAndRoutes ? viewsFolder : undefined\n )\n ];\n}\n\nexport default appShellVitePlugin;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/app-shell-vite-plugin",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "AppShell Vite Plugin",
5
5
  "author": "Hitachi Vantara - Boba Fett Team",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@emotion/cache": "^11.11.0",
36
36
  "@emotion/react": "^11.11.1",
37
- "@hitachivantara/app-shell-shared": "0.8.0",
37
+ "@hitachivantara/app-shell-shared": "0.8.1",
38
38
  "@hitachivantara/uikit-react-shared": "5.1.0",
39
39
  "@rollup/plugin-commonjs": "^24.0.0",
40
40
  "@rollup/plugin-json": "^6.0.0",
@@ -47,6 +47,7 @@
47
47
  "react-dom": "^18.2.0",
48
48
  "react-router-dom": "^6.9.0",
49
49
  "rollup": "^3.10.0",
50
+ "ts-node": "^10.9.1",
50
51
  "vite": "^4.1.4",
51
52
  "vite-plugin-static-copy": "^0.13.0"
52
53
  },
@@ -55,5 +56,5 @@
55
56
  "@types/react-dom": "^18.0.11",
56
57
  "tsc-watch": "^6.0.0"
57
58
  },
58
- "gitHead": "e460ddf7e870321827581df908985394baa04050"
59
+ "gitHead": "bf53c9b7ac49e2a26f589d03c79bb7b4233a8bfb"
59
60
  }