@hitachivantara/app-shell-vite-plugin 0.17.11 → 0.18.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 +22 -24
- package/dist/automatic-utils.d.ts +25 -2
- package/dist/automatic-utils.d.ts.map +1 -1
- package/dist/automatic-utils.js +97 -67
- package/dist/automatic-utils.js.map +1 -1
- package/dist/config-utils.d.ts +4 -11
- package/dist/config-utils.d.ts.map +1 -1
- package/dist/config-utils.js +9 -50
- package/dist/config-utils.js.map +1 -1
- package/dist/esm-externals/emotion-react.production.min.js.map +1 -1
- package/dist/esm-externals/react-dom.production.min.js +2 -2
- package/dist/esm-externals/react-dom.production.min.js.map +1 -1
- package/dist/esm-externals/react-router-dom.production.min.js +18 -8
- package/dist/esm-externals/react-router-dom.production.min.js.map +1 -1
- package/dist/esm-externals/react.production.min.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/virtual-entrypoints.js +2 -2
- package/dist/virtual-entrypoints.js.map +1 -1
- package/dist/vite-configuration-processor-plugin.d.ts +4 -1
- package/dist/vite-configuration-processor-plugin.d.ts.map +1 -1
- package/dist/vite-configuration-processor-plugin.js +44 -63
- package/dist/vite-configuration-processor-plugin.js.map +1 -1
- package/dist/vite-generate-base-plugin.d.ts +1 -1
- package/dist/vite-generate-base-plugin.js +3 -3
- package/dist/vite-generate-base-plugin.js.map +1 -1
- package/dist/vite-generate-bash-script-plugin.js +5 -5
- package/dist/vite-generate-bash-script-plugin.js.map +1 -1
- package/dist/vite-importmap-plugin.d.ts +1 -1
- package/dist/vite-importmap-plugin.d.ts.map +1 -1
- package/dist/vite-importmap-plugin.js +8 -8
- package/dist/vite-importmap-plugin.js.map +1 -1
- package/dist/vite-metadata-plugin.d.ts +1 -1
- package/dist/vite-metadata-plugin.js +2 -2
- package/dist/vite-metadata-plugin.js.map +1 -1
- package/dist/vite-plugin.d.ts +10 -4
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +11 -21
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vite-watch-config-plugin.d.ts +1 -1
- package/dist/vite-watch-config-plugin.d.ts.map +1 -1
- package/dist/vite-watch-config-plugin.js +69 -3
- package/dist/vite-watch-config-plugin.js.map +1 -1
- package/package.json +8 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-importmap-plugin.js","sourceRoot":"","sources":["../src/vite-importmap-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,kBAAkB,EAAE,UAAU;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAW,EAAE;IACrD,IAAI,uBAAuB,GAAG,EAAE,CAAC;IACjC,8DAA8D;IAC9D,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QACnC,uBAAuB,IAAI,MAAM,GAAG,WAAW,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC;KAC7E;IACD,uBAAuB,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/D,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,IAAyB;IAChD,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE/D,OAAO;QACL,IAAI,EAAE,wCAAwC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QAEd,6EAA6E;QAC7E,SAAS,EAAE,IAAI,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E,QAAQ;gCACb,KAAK,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE;gCAChC,QAAQ,EAAE,cAAc;6BACzB;4BACH,CAAC,CAAC;gCACE,GAAG,EAAE,QAAQ;gCACb,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;gCAC5B,QAAQ,EAAE,cAAc;gCACxB,QAAQ,EAAE,qBAAqB;oCAC7B,CAAC,CAAC,wBAAwB;oCAC1B,CAAC,CAAC,eAAe;6BACpB;qBACN;iBACF,CAAC;aACH;SACF;QACD,iBAAiB;YACf,CAAC,CAAC,OAAO,CAAC;gBACN,eAAe,EAAE,eAAe;aACjC,CAAC;YACJ,CAAC,CAAC,KAAK;KACV,CAAC;AACJ,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport type { NormalizedOutputOptions } from \"rollup\";\nimport type { PluginOption } from \"vite\";\n\nimport virtual from \"@rollup/plugin-virtual\";\n\nconst ID_PREFIX = `/@id/`;\n\nexport const extraDependencies: Record<string, string> = {\n \"@hv/uikit-icons/\": \"./icons/\"\n};\n\n/**\n * Auxiliary function to get the extraDependencies string\n * @returns a string with the extraDependencies content separated by commas\n */\nexport const getExtraDependenciesString = (): string => {\n let extraDependenciesString = \"\";\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const key in extraDependencies) {\n extraDependenciesString += `\\\\\"${key}\\\\\": \\\\\"${extraDependencies[key]}\\\\\",`;\n }\n extraDependenciesString = extraDependenciesString.slice(0, -1);\n return extraDependenciesString;\n};\n\nfunction replaceIdPrefix(keys: (string | RegExp)[]): PluginOption {\n const reg = new RegExp(`${ID_PREFIX}(${keys.join(\"|\")})`, \"g\");\n\n return {\n name: \"vite-plugin-importmap-replace-idprefix\",\n enforce: \"pre\",\n apply: \"serve\",\n\n // while in dev, we need to prevent 'vite:import-analysis' on runtime modules\n transform: code =>\n reg.test(code) ? code.replace(reg, (m, s1) => s1) : code,\n\n // and to say its resolved (as external)\n resolveId: (id: string) =>\n keys.some(key =>\n typeof key === \"string\" ? id.startsWith(key) : key.test(id)\n )\n ? {\n id,\n external: true\n }\n : undefined,\n\n // Avoid the warning: The following dependencies are imported but could not be resolved: [dependency] (imported by [sourceFile])\n load: (id: string) => {\n if (keys.includes(id)) {\n // Vite will try to resolve the modules even when externalized\n // In order to suppress the warning, a stub module is returned\n return \"export default {};\";\n }\n\n return undefined;\n }\n };\n}\n\n/**\n * Generate and injects the importmap tag into index.html\n * @param importmapElements The importmap elements to be included\n * @param sharedDependencies The shared packages (other than application bundles)\n */\nexport default function generateImportmap(\n importmapElements: Record<string, string>,\n sharedDependencies: string[],\n externalImportMap = false,\n placeholderEntryPoint = false\n): PluginOption {\n const keys = Object.keys(importmapElements);\n const devKeys = keys.filter(\n key => !sharedDependencies.some(lib => lib.startsWith(key))\n );\n\n let devMode = false;\n\n const importmapString = JSON.stringify(\n { imports: importmapElements },\n null,\n 2\n );\n\n const importmapScript = `const im = document.createElement('script');\nim.type = 'importmap';\nim.textContent = \\`${importmapString}\\`;\ndocument.currentScript.after(im);\n`;\n\n return [\n {\n name: \"vite-plugin-importmap\",\n enforce: \"pre\",\n\n // don't optimize / pre-transform deps that are in the importmap\n // except for react and react-dom when in dev mode\n config(config, { command }) {\n devMode = command !== \"build\";\n\n // vite docs says we can mutate the passed-in config directly\n // assigning to a new variable just to avoid the eslint warning\n const returnValue = config;\n\n // make sure optimizeDeps is defined\n returnValue.optimizeDeps = returnValue.optimizeDeps ?? {};\n\n returnValue.optimizeDeps.exclude = [\n ...(config.optimizeDeps?.exclude ?? []),\n ...(devMode ? devKeys : keys)\n ];\n\n if (devMode) {\n return;\n }\n\n // mark the modules referenced in the importmap as external\n const excludedModules = keys.map(key => {\n if (key.endsWith(\"/\")) {\n return new RegExp(`^${key}.*`);\n }\n\n return key;\n });\n\n console.info(\"Shared packages marked as external: \", excludedModules);\n\n // make sure build's rollupOptions is defined\n returnValue.build = returnValue.build ?? {};\n returnValue.build.rollupOptions = returnValue.build.rollupOptions ?? {};\n returnValue.build.rollupOptions.external =\n returnValue.build.rollupOptions.external ?? [];\n\n if (typeof returnValue.build.rollupOptions.external === \"function\") {\n // in case the developer has defined a custom external function\n // we wrap it and check our excluded modules first and call the original function if needed\n const originalExternal = returnValue.build.rollupOptions.external;\n\n returnValue.build.rollupOptions.external = (id, ...args) => {\n if (excludedModules.some(m => typeof m === id)) {\n return true;\n }\n\n return originalExternal(id, ...args);\n };\n } else {\n // otherwise we just add our excluded modules to the list supplied by the developer\n const externalModules: (string | RegExp)[] = [];\n\n if (Array.isArray(returnValue.build.rollupOptions.external)) {\n externalModules.push(...returnValue.build.rollupOptions.external);\n } else {\n externalModules.push(returnValue.build.rollupOptions.external);\n }\n\n externalModules.push(...excludedModules);\n\n returnValue.build.rollupOptions.external = externalModules;\n }\n },\n\n // while in dev, we need to prevent 'vite:import-analysis' on runtime modules\n // and also to say they're resolved (as external)\n // (it will still output an error in the console, but it won't break)\n // known issue: https://github.com/vitejs/vite/issues/11633\n configResolved(resolvedConfig) {\n if (!devMode) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore an hack: we want to add the plugin only after the config is resolved\n resolvedConfig.plugins.push(replaceIdPrefix(devKeys));\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(options: NormalizedOutputOptions) {\n if (!externalImportMap || placeholderEntryPoint) {\n return;\n }\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 // support for external import maps isn't yet available (https://github.com/WICG/import-maps/issues/235)\n // workaround: https://github.com/WICG/import-maps/issues/235#issuecomment-1002340944\n fs.writeFileSync(\n path.resolve(targetDir, \"importmap.js\"),\n importmapScript\n );\n },\n\n // inject the importmap script and also the es-module-shims script\n transformIndexHtml: {\n enforce: \"post\",\n transform: html => ({\n html,\n tags: [\n {\n tag: \"script\",\n attrs: { async: true, src: \"./bundles/es-module-shims.js\" },\n injectTo: \"head-prepend\"\n },\n externalImportMap\n ? {\n tag: \"script\",\n attrs: { src: \"./importmap.js\" },\n injectTo: \"head-prepend\"\n }\n : {\n tag: \"script\",\n attrs: { type: \"importmap\" },\n injectTo: \"head-prepend\",\n children: placeholderEntryPoint\n ? \"%%APPSHELL_IMPORTMAP%%\"\n : importmapString\n }\n ]\n })\n }\n },\n externalImportMap\n ? virtual({\n \"/importmap.js\": importmapScript\n })\n : false\n ];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vite-importmap-plugin.js","sourceRoot":"","sources":["../src/vite-importmap-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,kBAAkB,EAAE,UAAU;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAW,EAAE;IACrD,IAAI,uBAAuB,GAAG,EAAE,CAAC;IACjC,8DAA8D;IAC9D,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACpC,uBAAuB,IAAI,MAAM,GAAG,WAAW,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC;IAC9E,CAAC;IACD,uBAAuB,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;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C,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC/C,CAAC;gBAED,wGAAwG;gBACxG,qFAAqF;gBACrF,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EACvC,eAAe,CAChB,CAAC;YACJ,CAAC;YAED,kEAAkE;YAClE,kBAAkB,EAAE;gBAClB,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;oBAChB,IAAI;oBACJ,IAAI,EAAE;wBACJ;4BACE,GAAG,EAAE,QAAQ;4BACb,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,8BAA8B,EAAE;4BAC3D,QAAQ,EAAE,cAAc;yBACzB;wBACD,iBAAiB;4BACf,CAAC,CAAC;gCACE,GAAG,EAAE,QAAQ;gCACb,KAAK,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE;gCAChC,QAAQ,EAAE,cAAc;6BACzB;4BACH,CAAC,CAAC;gCACE,GAAG,EAAE,QAAQ;gCACb,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;gCAC5B,QAAQ,EAAE,cAAc;gCACxB,QAAQ,EAAE,qBAAqB;oCAC7B,CAAC,CAAC,wBAAwB;oCAC1B,CAAC,CAAC,eAAe;6BACpB;qBACN;iBACF,CAAC;aACH;SACF;QACD,iBAAiB;YACf,CAAC,CAAC,OAAO,CAAC;gBACN,eAAe,EAAE,eAAe;aACjC,CAAC;YACJ,CAAC,CAAC,KAAK;KACV,CAAC;AACJ,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport type { NormalizedOutputOptions } from \"rollup\";\nimport type { PluginOption } from \"vite\";\n\nimport virtual from \"@rollup/plugin-virtual\";\n\nconst ID_PREFIX = `/@id/`;\n\nexport const extraDependencies: Record<string, string> = {\n \"@hv/uikit-icons/\": \"./icons/\"\n};\n\n/**\n * Auxiliary function to get the extraDependencies string\n * @returns a string with the extraDependencies content separated by commas\n */\nexport const getExtraDependenciesString = (): string => {\n let extraDependenciesString = \"\";\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const key in extraDependencies) {\n extraDependenciesString += `\\\\\"${key}\\\\\": \\\\\"${extraDependencies[key]}\\\\\",`;\n }\n extraDependenciesString = extraDependenciesString.slice(0, -1);\n return extraDependenciesString;\n};\n\nfunction replaceIdPrefix(\n keys: (string | RegExp)[],\n packageName: string\n): PluginOption {\n const reg = new RegExp(\n `(/${packageName})?${ID_PREFIX}(${keys.join(\"|\")})`,\n \"g\"\n );\n\n return {\n name: \"vite-plugin-importmap-replace-idprefix\",\n enforce: \"pre\",\n apply: \"serve\",\n\n // while in dev, we need to prevent 'vite:import-analysis' on runtime modules\n transform: code =>\n reg.test(code) ? code.replace(reg, (m, s1, s2) => s2) : code,\n\n // and to say its resolved (as external)\n resolveId: (id: string) =>\n keys.some(key =>\n typeof key === \"string\" ? id.startsWith(key) : key.test(id)\n )\n ? {\n id,\n external: true\n }\n : undefined,\n\n // Avoid the warning: The following dependencies are imported but could not be resolved: [dependency] (imported by [sourceFile])\n load: (id: string) => {\n if (keys.includes(id)) {\n // Vite will try to resolve the modules even when externalized\n // In order to suppress the warning, a stub module is returned\n return \"export default {};\";\n }\n\n return undefined;\n }\n };\n}\n\n/**\n * Generate and injects the importmap tag into index.html\n * @param importmapElements The importmap elements to be included\n * @param sharedDependencies The shared packages (other than application bundles)\n */\nexport default function generateImportmap(\n importmapElements: Record<string, string>,\n packageName: string,\n sharedDependencies: string[],\n externalImportMap = false,\n placeholderEntryPoint = false\n): PluginOption {\n const keys = Object.keys(importmapElements);\n const devKeys = keys.filter(\n key => !sharedDependencies.some(lib => lib.startsWith(key))\n );\n\n let devMode = false;\n\n const importmapString = JSON.stringify(\n { imports: importmapElements },\n null,\n 2\n );\n\n const importmapScript = `const im = document.createElement('script');\nim.type = 'importmap';\nim.textContent = \\`${importmapString}\\`;\ndocument.currentScript.after(im);\n`;\n\n return [\n {\n name: \"vite-plugin-importmap\",\n enforce: \"pre\",\n\n // don't optimize / pre-transform deps that are in the importmap\n // except for react and react-dom when in dev mode\n config(config, { command }) {\n devMode = command !== \"build\";\n\n // vite docs says we can mutate the passed-in config directly\n // assigning to a new variable just to avoid the eslint warning\n const returnValue = config;\n\n // make sure optimizeDeps is defined\n returnValue.optimizeDeps = returnValue.optimizeDeps ?? {};\n\n returnValue.optimizeDeps.exclude = [\n ...(config.optimizeDeps?.exclude ?? []),\n ...(devMode ? devKeys : keys)\n ];\n\n if (devMode) {\n return;\n }\n\n // mark the modules referenced in the importmap as external\n const excludedModules = keys.map(key => {\n if (key.endsWith(\"/\")) {\n return new RegExp(`^${key}.*`);\n }\n\n return key;\n });\n\n console.info(\"Shared packages marked as external: \", excludedModules);\n\n // make sure build's rollupOptions is defined\n returnValue.build = returnValue.build ?? {};\n returnValue.build.rollupOptions = returnValue.build.rollupOptions ?? {};\n returnValue.build.rollupOptions.external =\n returnValue.build.rollupOptions.external ?? [];\n\n if (typeof returnValue.build.rollupOptions.external === \"function\") {\n // in case the developer has defined a custom external function\n // we wrap it and check our excluded modules first and call the original function if needed\n const originalExternal = returnValue.build.rollupOptions.external;\n\n returnValue.build.rollupOptions.external = (id, ...args) => {\n if (excludedModules.some(m => m === id)) {\n return true;\n }\n\n return originalExternal(id, ...args);\n };\n } else {\n // otherwise we just add our excluded modules to the list supplied by the developer\n const externalModules: (string | RegExp)[] = [];\n\n if (Array.isArray(returnValue.build.rollupOptions.external)) {\n externalModules.push(...returnValue.build.rollupOptions.external);\n } else {\n externalModules.push(returnValue.build.rollupOptions.external);\n }\n\n externalModules.push(...excludedModules);\n\n returnValue.build.rollupOptions.external = externalModules;\n }\n },\n\n // while in dev, we need to prevent 'vite:import-analysis' on runtime modules\n // and also to say they're resolved (as external)\n // (it will still output an error in the console, but it won't break)\n // known issue: https://github.com/vitejs/vite/issues/11633\n configResolved(resolvedConfig) {\n if (!devMode) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore an hack: we want to add the plugin only after the config is resolved\n resolvedConfig.plugins.push(replaceIdPrefix(devKeys, packageName));\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(options: NormalizedOutputOptions) {\n if (!externalImportMap || placeholderEntryPoint) {\n return;\n }\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 // support for external import maps isn't yet available (https://github.com/WICG/import-maps/issues/235)\n // workaround: https://github.com/WICG/import-maps/issues/235#issuecomment-1002340944\n fs.writeFileSync(\n path.resolve(targetDir, \"importmap.js\"),\n importmapScript\n );\n },\n\n // inject the importmap script and also the es-module-shims script\n transformIndexHtml: {\n order: \"post\",\n handler: html => ({\n html,\n tags: [\n {\n tag: \"script\",\n attrs: { async: true, src: \"./bundles/es-module-shims.js\" },\n injectTo: \"head-prepend\"\n },\n externalImportMap\n ? {\n tag: \"script\",\n attrs: { src: \"./importmap.js\" },\n injectTo: \"head-prepend\"\n }\n : {\n tag: \"script\",\n attrs: { type: \"importmap\" },\n injectTo: \"head-prepend\",\n children: placeholderEntryPoint\n ? \"%%APPSHELL_IMPORTMAP%%\"\n : importmapString\n }\n ]\n })\n }\n },\n externalImportMap\n ? virtual({\n \"/importmap.js\": importmapScript\n })\n : false\n ];\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import type { PluginOption } from "vite";
|
|
|
2
2
|
/**
|
|
3
3
|
* This plugin injects metadata into the index.html file.
|
|
4
4
|
* The metadata is used to help any troubleshoot activity by referencing
|
|
5
|
-
* the version of the app-shell-vite-plugin and app-shell packages used by the app.
|
|
5
|
+
* the version of the app-shell-vite-plugin and app-shell-ui packages used by the app.
|
|
6
6
|
*/
|
|
7
7
|
declare const injectMetadata: () => PluginOption;
|
|
8
8
|
export default injectMetadata;
|
|
@@ -8,10 +8,10 @@ const extractVersion = (packageJsonFile) => {
|
|
|
8
8
|
/**
|
|
9
9
|
* This plugin injects metadata into the index.html file.
|
|
10
10
|
* The metadata is used to help any troubleshoot activity by referencing
|
|
11
|
-
* the version of the app-shell-vite-plugin and app-shell packages used by the app.
|
|
11
|
+
* the version of the app-shell-vite-plugin and app-shell-ui packages used by the app.
|
|
12
12
|
*/
|
|
13
13
|
const injectMetadata = () => {
|
|
14
|
-
const appShellVersion = extractVersion(resolveModule("@hitachivantara/app-shell/package.json"));
|
|
14
|
+
const appShellVersion = extractVersion(resolveModule("@hitachivantara/app-shell-ui/package.json"));
|
|
15
15
|
const appShellVitePluginVersion = extractVersion(resolveModule("@hitachivantara/app-shell-vite-plugin/package.json"));
|
|
16
16
|
return {
|
|
17
17
|
name: "vite-metadata-plugin",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-metadata-plugin.js","sourceRoot":"","sources":["../src/vite-metadata-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,cAAc,GAAG,CAAC,eAAuB,EAAU,EAAE;IACzD,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC7D,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO,aAAa,CAAC,OAAO,CAAC;AAC/B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG,GAAiB,EAAE;IACxC,MAAM,eAAe,GAAG,cAAc,CACpC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"vite-metadata-plugin.js","sourceRoot":"","sources":["../src/vite-metadata-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAIpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,cAAc,GAAG,CAAC,eAAuB,EAAU,EAAE;IACzD,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC7D,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO,aAAa,CAAC,OAAO,CAAC;AAC/B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG,GAAiB,EAAE;IACxC,MAAM,eAAe,GAAG,cAAc,CACpC,aAAa,CAAC,2CAA2C,CAAC,CAC3D,CAAC;IAEF,MAAM,yBAAyB,GAAG,cAAc,CAC9C,aAAa,CAAC,oDAAoD,CAAC,CACpE,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,kBAAkB;YAChB,OAAO;gBACL;oBACE,GAAG,EAAE,MAAM;oBACX,KAAK,EAAE;wBACL,IAAI,EAAE,mBAAmB;wBACzB,OAAO,EAAE,eAAe;qBACzB;iBACF;gBACD;oBACE,GAAG,EAAE,MAAM;oBACX,KAAK,EAAE;wBACL,IAAI,EAAE,+BAA+B;wBACrC,OAAO,EAAE,yBAAyB;qBACnC;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import fs from \"fs\";\n\nimport type { PluginOption } from \"vite\";\n\nimport { resolveModule } from \"./nodeModule.js\";\n\nconst extractVersion = (packageJsonFile: string): string => {\n const packageJson = fs.readFileSync(packageJsonFile, \"utf8\");\n const packageObject = JSON.parse(packageJson);\n return packageObject.version;\n};\n\n/**\n * This plugin injects metadata into the index.html file.\n * The metadata is used to help any troubleshoot activity by referencing\n * the version of the app-shell-vite-plugin and app-shell-ui packages used by the app.\n */\nconst injectMetadata = (): PluginOption => {\n const appShellVersion = extractVersion(\n resolveModule(\"@hitachivantara/app-shell-ui/package.json\")\n );\n\n const appShellVitePluginVersion = extractVersion(\n resolveModule(\"@hitachivantara/app-shell-vite-plugin/package.json\")\n );\n\n return {\n name: \"vite-metadata-plugin\",\n transformIndexHtml() {\n return [\n {\n tag: \"meta\",\n attrs: {\n name: \"app-shell-version\",\n content: appShellVersion\n }\n },\n {\n tag: \"meta\",\n attrs: {\n name: \"app-shell-vite-plugin-version\",\n content: appShellVitePluginVersion\n }\n }\n ];\n }\n };\n};\n\nexport default injectMetadata;\n"]}
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -30,8 +30,7 @@ export interface AppShellVitePluginOptions {
|
|
|
30
30
|
* Tokens used at config file must be wrapped (at the beginning and at the end) by @@ sequence
|
|
31
31
|
* e.g.
|
|
32
32
|
* {
|
|
33
|
-
* "
|
|
34
|
-
* "baseUrl": "@@USER_NOTIFICATIONS_URL@@"
|
|
33
|
+
* "@hv/user-notifications-client": "@@USER_NOTIFICATIONS_URL@@"
|
|
35
34
|
* }
|
|
36
35
|
*/
|
|
37
36
|
configReplacements?: ConfigReplacement[];
|
|
@@ -49,9 +48,9 @@ export interface AppShellVitePluginOptions {
|
|
|
49
48
|
autoViewsAndRoutes?: boolean;
|
|
50
49
|
/**
|
|
51
50
|
* If true, the plugin will try to automatically add the views to the menu.
|
|
52
|
-
* This is only valid
|
|
51
|
+
* This is only valid if the app-shell.config.json file does not contain any menu configuration already.
|
|
53
52
|
*/
|
|
54
|
-
|
|
53
|
+
autoMenu?: boolean;
|
|
55
54
|
/**
|
|
56
55
|
* If true, the plugin will generate the importmap with an external js file instead of inline in the html.
|
|
57
56
|
* The map will be saved at the root of the application destination dir and named as "importmap.js".
|
|
@@ -84,6 +83,13 @@ export interface AppShellVitePluginOptions {
|
|
|
84
83
|
* @private
|
|
85
84
|
*/
|
|
86
85
|
generateEmptyShell?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The modules to be exported by the application.
|
|
88
|
+
*
|
|
89
|
+
* All the modules that the application need to export should be declared here in order to have them built properly.
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
modules?: string[];
|
|
87
93
|
}
|
|
88
94
|
/**
|
|
89
95
|
* 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":"AAMA,OAAO,EAAW,YAAY,EAAE,MAAM,MAAM,CAAC;AAa7C,OAAO,EACL,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAc3B,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAE7B
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAAW,YAAY,EAAE,MAAM,MAAM,CAAC;AAa7C,OAAO,EACL,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAc3B,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAE7B;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAEzC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CACzB,IAAI,GAAE,yBAA8B,EACpC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC/B,YAAY,CA+Jd;AAED,eAAe,kBAAkB,CAAC"}
|
package/dist/vite-plugin.js
CHANGED
|
@@ -25,7 +25,7 @@ var ViteBuildMode;
|
|
|
25
25
|
* @param env Environment variable
|
|
26
26
|
*/
|
|
27
27
|
function appShellVitePlugin(opts = {}, env = {}) {
|
|
28
|
-
const { root = process.cwd(), mode = ViteBuildMode.PRODUCTION, externalImportMap = false, viewsFolder = "src/pages", autoViewsAndRoutes = false,
|
|
28
|
+
const { root = process.cwd(), mode = ViteBuildMode.PRODUCTION, externalImportMap = false, viewsFolder = "src/pages", autoViewsAndRoutes = false, autoMenu = false, inlineConfig = opts.generateEmptyShell ?? false, generateEmptyShell = false, modules = [] } = opts;
|
|
29
29
|
const globalEnv = loadEnv(mode, process.cwd(), "");
|
|
30
30
|
const { type = globalEnv.CI ? "bundle" : "app" } = opts;
|
|
31
31
|
console.info(`Vite running in mode: ${mode}`);
|
|
@@ -38,11 +38,12 @@ function appShellVitePlugin(opts = {}, env = {}) {
|
|
|
38
38
|
? findAppShellConfigFile(root)
|
|
39
39
|
: undefined;
|
|
40
40
|
const appShellConfiguration = loadConfigFile(appShellConfigFile, opts, env);
|
|
41
|
+
let autoViewsBundles = [];
|
|
41
42
|
if (!generateEmptyShell) {
|
|
42
43
|
if (autoViewsAndRoutes) {
|
|
43
|
-
applyAutomaticViewsAndRoutes(appShellConfiguration, root, viewsFolder);
|
|
44
|
+
autoViewsBundles = applyAutomaticViewsAndRoutes(appShellConfiguration, root, viewsFolder);
|
|
44
45
|
}
|
|
45
|
-
if (
|
|
46
|
+
if (autoMenu) {
|
|
46
47
|
applyAutomaticMenu(appShellConfiguration);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -90,32 +91,21 @@ function appShellVitePlugin(opts = {}, env = {}) {
|
|
|
90
91
|
return acc;
|
|
91
92
|
}, {}),
|
|
92
93
|
...extraDependencies,
|
|
93
|
-
...appShellConfiguration?.apps
|
|
94
|
-
|
|
95
|
-
acc[`${packageJson.name}/`] = app.baseUrl;
|
|
96
|
-
if (devMode) {
|
|
97
|
-
acc[`${app.id}/`] = app.baseUrl;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
acc[`${app.id}/`] = app.baseUrl;
|
|
102
|
-
}
|
|
94
|
+
...Object.entries(appShellConfiguration?.apps ?? {}).reduce((acc, [key, value]) => {
|
|
95
|
+
acc[`${key}/`] = value;
|
|
103
96
|
return acc;
|
|
104
|
-
}, {})
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"@self",
|
|
108
|
-
packageJson.name
|
|
109
|
-
], externalImportMap && buildEntryPoint, generateEmptyShell),
|
|
97
|
+
}, {}),
|
|
98
|
+
[`${packageJson.name}/`]: appShellConfiguration.baseUrl ?? "/"
|
|
99
|
+
}, packageJson.name, [...SHARED_DEPENDENCIES.map(dep => dep.moduleId), packageJson.name], externalImportMap && buildEntryPoint, generateEmptyShell),
|
|
110
100
|
// inject version metadata in the index.html
|
|
111
101
|
buildEntryPoint && injectMetadata(),
|
|
112
102
|
// set the base tag and replace the title in the index.html
|
|
113
103
|
buildEntryPoint &&
|
|
114
104
|
generateBaseTag(appShellConfiguration, generateEmptyShell),
|
|
115
105
|
// configure the build process based on the config file
|
|
116
|
-
processConfiguration(root, appShellConfiguration, packageJson.name, buildEntryPoint, inlineConfig, generateEmptyShell),
|
|
106
|
+
processConfiguration(root, appShellConfiguration, packageJson.name, buildEntryPoint, inlineConfig, generateEmptyShell, modules.concat(autoViewsBundles)),
|
|
117
107
|
// serve the app shell config file as json and watch for changes
|
|
118
|
-
serveAppShellConfig(appShellConfiguration, root, appShellConfigFile, autoViewsAndRoutes ? viewsFolder : undefined),
|
|
108
|
+
serveAppShellConfig(appShellConfiguration, root, packageJson.name, appShellConfigFile, autoViewsAndRoutes ? viewsFolder : undefined),
|
|
119
109
|
// generate the shell script to replace the placeholders in the index.html
|
|
120
110
|
generateEmptyShell && generateBashScript(externalImportMap, inlineConfig)
|
|
121
111
|
];
|
package/dist/vite-plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAC;AAI7C,OAAO,iBAAiB,EAAE,EACxB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAC5E,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAC7D,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,mBAAmB,MAAM,+BAA+B,CAAC;AAChE,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OAAO,EAEL,sBAAsB,EACtB,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EACpC,kBAAkB,CACnB;QAED,4CAA4C;QAC5C,eAAe,IAAI,cAAc,EAAE;QAEnC,2DAA2D;QAC3D,eAAe;YACb,eAAe,CAAC,qBAAqB,EAAE,kBAAkB,CAAC;QAE5D,uDAAuD;QACvD,oBAAoB,CAClB,IAAI,EACJ,qBAAqB,EACrB,WAAW,CAAC,IAAI,EAChB,eAAe,EACf,YAAY,EACZ,kBAAkB,CACnB;QAED,gEAAgE;QAChE,mBAAmB,CACjB,qBAAqB,EACrB,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAC7C;QAED,0EAA0E;QAC1E,kBAAkB,IAAI,kBAAkB,CAAC,iBAAiB,EAAE,YAAY,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport virtual from \"@rollup/plugin-virtual\";\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\n\nimport { loadEnv, PluginOption } from \"vite\";\n\nimport type { HvAppShellConfig } from \"@hitachivantara/app-shell-shared\";\n\nimport generateImportmap, {\n extraDependencies\n} from \"./vite-importmap-plugin.js\";\nimport processConfiguration from \"./vite-configuration-processor-plugin.js\";\nimport generateBaseTag from \"./vite-generate-base-plugin.js\";\nimport injectMetadata from \"./vite-metadata-plugin.js\";\nimport serveAppShellConfig from \"./vite-watch-config-plugin.js\";\nimport generateBashScript from \"./vite-generate-bash-script-plugin.js\";\n\nimport {\n ConfigReplacement,\n findAppShellConfigFile,\n loadConfigFile\n} from \"./config-utils.js\";\nimport { getModulePath, resolveModule } from \"./nodeModule.js\";\nimport {\n applyAutomaticMenu,\n applyAutomaticViewsAndRoutes\n} from \"./automatic-utils.js\";\nimport getVirtualEntrypoints from \"./virtual-entrypoints.js\";\nimport SHARED_DEPENDENCIES from \"./shared-dependencies.js\";\n\nenum ViteBuildMode {\n PRODUCTION = \"production\",\n DEVELOPMENT = \"development\"\n}\n\nexport type ApplicationBundleType = \"app\" | \"bundle\";\n\nexport interface AppShellVitePluginOptions {\n /**\n * Project root directory. Most likely the 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 /**\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?: ApplicationBundleType;\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?: ConfigReplacement[];\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 is 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 /**\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 * This option is not for general use. It is only intended to be used for easing the automated testing of the App Shell.\n *\n * @default false\n * @private\n */\n externalImportMap?: boolean;\n /**\n * If true, the plugin will inline the app-shell.config.json file in a script tag of the index html.\n *\n * This option is not for general use. Its value will be automatically managed by the App Shell build process.\n *\n * @default false, true if generateEmptyShell is true\n * @private\n */\n inlineConfig?: boolean;\n /**\n * If true, the config file is ignored, only the App Shell is built and the generated index.html will contain a placeholders\n * for importmap (if externalImportMap is false), app shell config (if inlineConfig is true) and title.\n *\n * A bash script will also be added to the dist folder to replace the placeholders with the actual content,\n * when provided with a concrete configuration.\n *\n * This option is not for general use. It is used for generating the App Shell container image.\n *\n * @default false\n * @private\n */\n generateEmptyShell?: boolean;\n}\n\n/**\n * Vite plugin to support App Shell apps setup\n * @param opts Plugin options\n * @param env Environment variable\n */\nfunction appShellVitePlugin(\n opts: AppShellVitePluginOptions = {},\n env: Record<string, string> = {}\n): PluginOption {\n const {\n root = process.cwd(),\n mode = ViteBuildMode.PRODUCTION,\n externalImportMap = false,\n viewsFolder = \"src/pages\",\n autoViewsAndRoutes = false,\n autoDevMenu = false,\n inlineConfig = opts.generateEmptyShell ?? false,\n generateEmptyShell = false\n } = opts;\n\n const globalEnv = loadEnv(mode, process.cwd(), \"\");\n\n const { type = globalEnv.CI ? \"bundle\" : \"app\" } = opts;\n\n console.info(`Vite running in mode: ${mode}`);\n console.info(`AppShell Vite plugin running with type: ${type}`);\n\n const devMode = mode === ViteBuildMode.DEVELOPMENT;\n const buildEntryPoint = type !== \"bundle\";\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 = !generateEmptyShell\n ? findAppShellConfigFile(root)\n : undefined;\n const appShellConfiguration: HvAppShellConfig = loadConfigFile(\n appShellConfigFile,\n opts,\n env\n );\n\n if (!generateEmptyShell) {\n if (autoViewsAndRoutes) {\n applyAutomaticViewsAndRoutes(appShellConfiguration, root, viewsFolder);\n }\n\n if (devMode && autoDevMenu) {\n applyAutomaticMenu(appShellConfiguration);\n }\n }\n\n return [\n // copy the shared dependencies js bundles to the \"bundles\" folder\n (buildEntryPoint || devMode) &&\n viteStaticCopy({\n targets: [\n {\n src: getModulePath(\"es-module-shims\", \"dist/*\"),\n dest: \"bundles\"\n },\n // copy the ui kit icons' sprites to the \"icons\" folder\n {\n src: [\n getModulePath(\n \"@hitachivantara/uikit-react-icons\",\n \"dist/sprites/*.svg\"\n )\n ],\n dest: \"icons\"\n },\n ...(!devMode && buildEntryPoint\n ? [\n {\n src: SHARED_DEPENDENCIES.flatMap(dep => [\n resolveModule(dep.bundleSrc),\n resolveModule(`${dep.bundleSrc}.map`)\n ]),\n dest: \"bundles\"\n }\n ]\n : [])\n ]\n }),\n\n // create virtual endpoints for shell code and for shared dependencies\n virtual({\n ...getVirtualEntrypoints(inlineConfig),\n\n ...SHARED_DEPENDENCIES.reduce((acc, dep) => {\n acc[`/bundles/${dep.bundle}`] = dep.virtualSrc;\n return acc;\n }, {} as Record<string, string>)\n }),\n\n // generate the importmap for shared dependencies and for apps referenced in the config file\n generateImportmap(\n {\n ...SHARED_DEPENDENCIES.reduce((acc, dep) => {\n acc[dep.moduleId] = `./bundles/${dep.bundle}`;\n return acc;\n }, {} as Record<string, string>),\n\n ...extraDependencies,\n\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 ...SHARED_DEPENDENCIES.map(dep => dep.moduleId),\n \"@self\",\n packageJson.name\n ],\n externalImportMap && buildEntryPoint,\n generateEmptyShell\n ),\n\n // inject version metadata in the index.html\n buildEntryPoint && injectMetadata(),\n\n // set the base tag and replace the title in the index.html\n buildEntryPoint &&\n generateBaseTag(appShellConfiguration, generateEmptyShell),\n\n // configure the build process based on the config file\n processConfiguration(\n root,\n appShellConfiguration,\n packageJson.name,\n buildEntryPoint,\n inlineConfig,\n generateEmptyShell\n ),\n\n // serve the app shell config file as json and watch for changes\n serveAppShellConfig(\n appShellConfiguration,\n root,\n appShellConfigFile,\n autoViewsAndRoutes ? viewsFolder : undefined\n ),\n\n // generate the shell script to replace the placeholders in the index.html\n generateEmptyShell && generateBashScript(externalImportMap, inlineConfig)\n ];\n}\n\nexport default appShellVitePlugin;\n"]}
|
|
1
|
+
{"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAC;AAI7C,OAAO,iBAAiB,EAAE,EACxB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAC5E,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAC7D,OAAO,cAAc,MAAM,2BAA2B,CAAC;AACvD,OAAO,mBAAmB,MAAM,+BAA+B,CAAC;AAChE,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AAEvE,OAAO,EAEL,sBAAsB,EACtB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,MAAM,0BAA0B,CAAC;AAC7D,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,IAAK,aAGJ;AAHD,WAAK,aAAa;IAChB,0CAAyB,CAAA;IACzB,4CAA2B,CAAA;AAC7B,CAAC,EAHI,aAAa,KAAb,aAAa,QAGjB;AAmGD;;;;GAIG;AACH,SAAS,kBAAkB,CACzB,OAAkC,EAAE,EACpC,MAA8B,EAAE;IAEhC,MAAM,EACJ,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AkB,IAAI,kBAAkB,CAAC,iBAAiB,EAAE,YAAY,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport virtual from \"@rollup/plugin-virtual\";\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\n\nimport { loadEnv, PluginOption } from \"vite\";\n\nimport type { HvAppShellConfig } from \"@hitachivantara/app-shell-shared\";\n\nimport generateImportmap, {\n extraDependencies\n} from \"./vite-importmap-plugin.js\";\nimport processConfiguration from \"./vite-configuration-processor-plugin.js\";\nimport generateBaseTag from \"./vite-generate-base-plugin.js\";\nimport injectMetadata from \"./vite-metadata-plugin.js\";\nimport serveAppShellConfig from \"./vite-watch-config-plugin.js\";\nimport generateBashScript from \"./vite-generate-bash-script-plugin.js\";\n\nimport {\n ConfigReplacement,\n findAppShellConfigFile,\n loadConfigFile\n} from \"./config-utils.js\";\nimport { getModulePath, resolveModule } from \"./nodeModule.js\";\nimport {\n applyAutomaticMenu,\n applyAutomaticViewsAndRoutes\n} from \"./automatic-utils.js\";\nimport getVirtualEntrypoints from \"./virtual-entrypoints.js\";\nimport SHARED_DEPENDENCIES from \"./shared-dependencies.js\";\n\nenum ViteBuildMode {\n PRODUCTION = \"production\",\n DEVELOPMENT = \"development\"\n}\n\nexport type ApplicationBundleType = \"app\" | \"bundle\";\n\nexport interface AppShellVitePluginOptions {\n /**\n * Project root directory. Most likely the 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 /**\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?: ApplicationBundleType;\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 * \"@hv/user-notifications-client\": \"@@USER_NOTIFICATIONS_URL@@\"\n * }\n */\n configReplacements?: ConfigReplacement[];\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 is only valid if the app-shell.config.json file does not contain any menu configuration already.\n */\n autoMenu?: boolean;\n\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 * This option is not for general use. It is only intended to be used for easing the automated testing of the App Shell.\n *\n * @default false\n * @private\n */\n externalImportMap?: boolean;\n /**\n * If true, the plugin will inline the app-shell.config.json file in a script tag of the index html.\n *\n * This option is not for general use. Its value will be automatically managed by the App Shell build process.\n *\n * @default false, true if generateEmptyShell is true\n * @private\n */\n inlineConfig?: boolean;\n /**\n * If true, the config file is ignored, only the App Shell is built and the generated index.html will contain a placeholders\n * for importmap (if externalImportMap is false), app shell config (if inlineConfig is true) and title.\n *\n * A bash script will also be added to the dist folder to replace the placeholders with the actual content,\n * when provided with a concrete configuration.\n *\n * This option is not for general use. It is used for generating the App Shell container image.\n *\n * @default false\n * @private\n */\n generateEmptyShell?: boolean;\n /**\n * The modules to be exported by the application.\n *\n * All the modules that the application need to export should be declared here in order to have them built properly.\n *\n */\n modules?: string[];\n}\n\n/**\n * Vite plugin to support App Shell apps setup\n * @param opts Plugin options\n * @param env Environment variable\n */\nfunction appShellVitePlugin(\n opts: AppShellVitePluginOptions = {},\n env: Record<string, string> = {}\n): PluginOption {\n const {\n root = process.cwd(),\n mode = ViteBuildMode.PRODUCTION,\n externalImportMap = false,\n viewsFolder = \"src/pages\",\n autoViewsAndRoutes = false,\n autoMenu = false,\n inlineConfig = opts.generateEmptyShell ?? false,\n generateEmptyShell = false,\n modules = []\n } = opts;\n\n const globalEnv = loadEnv(mode, process.cwd(), \"\");\n\n const { type = globalEnv.CI ? \"bundle\" : \"app\" } = opts;\n\n console.info(`Vite running in mode: ${mode}`);\n console.info(`AppShell Vite plugin running with type: ${type}`);\n\n const devMode = mode === ViteBuildMode.DEVELOPMENT;\n const buildEntryPoint = type !== \"bundle\";\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 = !generateEmptyShell\n ? findAppShellConfigFile(root)\n : undefined;\n const appShellConfiguration: HvAppShellConfig = loadConfigFile(\n appShellConfigFile,\n opts,\n env\n );\n\n let autoViewsBundles: string[] = [];\n\n if (!generateEmptyShell) {\n if (autoViewsAndRoutes) {\n autoViewsBundles = applyAutomaticViewsAndRoutes(\n appShellConfiguration,\n root,\n viewsFolder\n );\n }\n\n if (autoMenu) {\n applyAutomaticMenu(appShellConfiguration);\n }\n }\n\n return [\n // copy the shared dependencies js bundles to the \"bundles\" folder\n (buildEntryPoint || devMode) &&\n viteStaticCopy({\n targets: [\n {\n src: getModulePath(\"es-module-shims\", \"dist/*\"),\n dest: \"bundles\"\n },\n // copy the ui kit icons' sprites to the \"icons\" folder\n {\n src: [\n getModulePath(\n \"@hitachivantara/uikit-react-icons\",\n \"dist/sprites/*.svg\"\n )\n ],\n dest: \"icons\"\n },\n ...(!devMode && buildEntryPoint\n ? [\n {\n src: SHARED_DEPENDENCIES.flatMap(dep => [\n resolveModule(dep.bundleSrc),\n resolveModule(`${dep.bundleSrc}.map`)\n ]),\n dest: \"bundles\"\n }\n ]\n : [])\n ]\n }),\n\n // create virtual endpoints for shell code and for shared dependencies\n virtual({\n ...getVirtualEntrypoints(inlineConfig),\n\n ...SHARED_DEPENDENCIES.reduce(\n (acc, dep) => {\n acc[`/bundles/${dep.bundle}`] = dep.virtualSrc;\n return acc;\n },\n {} as Record<string, string>\n )\n }),\n\n // generate the importmap for shared dependencies and for apps referenced in the config file\n generateImportmap(\n {\n ...SHARED_DEPENDENCIES.reduce(\n (acc, dep) => {\n acc[dep.moduleId] = `./bundles/${dep.bundle}`;\n return acc;\n },\n {} as Record<string, string>\n ),\n\n ...extraDependencies,\n\n ...Object.entries(appShellConfiguration?.apps ?? {}).reduce(\n (acc, [key, value]) => {\n acc[`${key}/`] = value;\n return acc;\n },\n {} as Record<string, string>\n ),\n\n [`${packageJson.name}/`]: appShellConfiguration.baseUrl ?? \"/\"\n },\n packageJson.name,\n [...SHARED_DEPENDENCIES.map(dep => dep.moduleId), packageJson.name],\n externalImportMap && buildEntryPoint,\n generateEmptyShell\n ),\n\n // inject version metadata in the index.html\n buildEntryPoint && injectMetadata(),\n\n // set the base tag and replace the title in the index.html\n buildEntryPoint &&\n generateBaseTag(appShellConfiguration, generateEmptyShell),\n\n // configure the build process based on the config file\n processConfiguration(\n root,\n appShellConfiguration,\n packageJson.name,\n buildEntryPoint,\n inlineConfig,\n generateEmptyShell,\n modules.concat(autoViewsBundles)\n ),\n\n // serve the app shell config file as json and watch for changes\n serveAppShellConfig(\n appShellConfiguration,\n root,\n packageJson.name,\n appShellConfigFile,\n autoViewsAndRoutes ? viewsFolder : undefined\n ),\n\n // generate the shell script to replace the placeholders in the index.html\n generateEmptyShell && generateBashScript(externalImportMap, inlineConfig)\n ];\n}\n\nexport default appShellVitePlugin;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PluginOption } from "vite";
|
|
2
2
|
import type { HvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
3
|
-
export default function serveAppShellConfig(appShellConfig: HvAppShellConfig, root: string, appShellConfigFile?: string, automaticViewsFolder?: string): PluginOption;
|
|
3
|
+
export default function serveAppShellConfig(appShellConfig: HvAppShellConfig, root: string, selfAppName: string, appShellConfigFile?: string, automaticViewsFolder?: string): PluginOption;
|
|
4
4
|
//# sourceMappingURL=vite-watch-config-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-watch-config-plugin.d.ts","sourceRoot":"","sources":["../src/vite-watch-config-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"vite-watch-config-plugin.d.ts","sourceRoot":"","sources":["../src/vite-watch-config-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAgFzE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,cAAc,EAAE,gBAAgB,EAChC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,oBAAoB,CAAC,EAAE,MAAM,GAC5B,YAAY,CA+Cd"}
|
|
@@ -1,7 +1,73 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
2
3
|
import { getPublicPath } from "./config-utils.js";
|
|
3
4
|
import { require } from "./nodeModule.js";
|
|
4
|
-
|
|
5
|
+
const replaceBundlePath = (bundle, selfAppName) => {
|
|
6
|
+
if (!bundle.startsWith(selfAppName) && !bundle.startsWith("@self")) {
|
|
7
|
+
return bundle;
|
|
8
|
+
}
|
|
9
|
+
const normalizedBundle = bundle
|
|
10
|
+
.replace(new RegExp(`^${selfAppName}/(?!src/)`, "g"), `${selfAppName}/src/`)
|
|
11
|
+
.replace(/^@self\/(?!src\/)/g, `${selfAppName}/src/`)
|
|
12
|
+
.replace(".js", "");
|
|
13
|
+
const normalizedPath = path.resolve(normalizedBundle.replace(selfAppName, "."));
|
|
14
|
+
let replacedBundle = bundle;
|
|
15
|
+
// Required since bundle can point to a folder or to a file, and if it's a file, it needs to be loaded with the correct extension
|
|
16
|
+
if (fs.existsSync(normalizedPath)) {
|
|
17
|
+
replacedBundle = normalizedBundle;
|
|
18
|
+
}
|
|
19
|
+
else if (fs.existsSync(`${normalizedPath}.ts`)) {
|
|
20
|
+
replacedBundle = `${normalizedBundle}.ts`;
|
|
21
|
+
}
|
|
22
|
+
else if (fs.existsSync(`${normalizedPath}.tsx`)) {
|
|
23
|
+
replacedBundle = `${normalizedBundle}.tsx`;
|
|
24
|
+
}
|
|
25
|
+
else if (fs.existsSync(`${normalizedPath}.js`)) {
|
|
26
|
+
replacedBundle = `${normalizedBundle}.js`;
|
|
27
|
+
}
|
|
28
|
+
else if (fs.existsSync(`${normalizedPath}.jsx`)) {
|
|
29
|
+
replacedBundle = `${normalizedBundle}.jsx`;
|
|
30
|
+
}
|
|
31
|
+
return replacedBundle;
|
|
32
|
+
};
|
|
33
|
+
const prepareConfigForDevMode = (config, selfAppName) => {
|
|
34
|
+
const { mainPanel, header, theming, providers } = config;
|
|
35
|
+
const replacedConfig = {
|
|
36
|
+
...config
|
|
37
|
+
};
|
|
38
|
+
// Main panel - Views
|
|
39
|
+
if (mainPanel?.views && replacedConfig.mainPanel) {
|
|
40
|
+
replacedConfig.mainPanel.views = mainPanel.views?.map(view => {
|
|
41
|
+
return { ...view, bundle: replaceBundlePath(view.bundle, selfAppName) };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// Header - Actions
|
|
45
|
+
if (header?.actions && replacedConfig.header) {
|
|
46
|
+
replacedConfig.header.actions = header.actions?.map(action => {
|
|
47
|
+
return {
|
|
48
|
+
...action,
|
|
49
|
+
bundle: replaceBundlePath(action.bundle, selfAppName)
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Theming
|
|
54
|
+
if (theming?.themes && replacedConfig.theming) {
|
|
55
|
+
replacedConfig.theming.themes = theming.themes?.map(theme => {
|
|
56
|
+
return replaceBundlePath(theme, selfAppName);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
// Providers
|
|
60
|
+
if (providers) {
|
|
61
|
+
replacedConfig.providers = providers.map(provider => {
|
|
62
|
+
return {
|
|
63
|
+
...provider,
|
|
64
|
+
bundle: replaceBundlePath(provider.bundle, selfAppName)
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return replacedConfig;
|
|
69
|
+
};
|
|
70
|
+
export default function serveAppShellConfig(appShellConfig, root, selfAppName, appShellConfigFile, automaticViewsFolder) {
|
|
5
71
|
return {
|
|
6
72
|
name: "vite-plugin-watch-app-shell-config",
|
|
7
73
|
apply: "serve",
|
|
@@ -16,7 +82,7 @@ export default function serveAppShellConfig(appShellConfig, root, appShellConfig
|
|
|
16
82
|
}
|
|
17
83
|
};
|
|
18
84
|
const restartServer2 = (file) => {
|
|
19
|
-
if (automaticViewsFolder != null &&
|
|
85
|
+
if (automaticViewsFolder != null && /\/index\.[tj]sx?$/.exec(file)) {
|
|
20
86
|
console.info("Automatic views folder changed. Reloading...");
|
|
21
87
|
server
|
|
22
88
|
.restart()
|
|
@@ -34,7 +100,7 @@ export default function serveAppShellConfig(appShellConfig, root, appShellConfig
|
|
|
34
100
|
}
|
|
35
101
|
const publicPath = getPublicPath(appShellConfig);
|
|
36
102
|
server.middlewares.use(`${publicPath}app-shell.config.json`, async (req, res) => {
|
|
37
|
-
res.end(JSON.stringify(appShellConfig));
|
|
103
|
+
res.end(JSON.stringify(prepareConfigForDevMode(appShellConfig, selfAppName)));
|
|
38
104
|
});
|
|
39
105
|
}
|
|
40
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-watch-config-plugin.js","sourceRoot":"","sources":["../src/vite-watch-config-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,cAAgC,EAChC,IAAY,EACZ,kBAA2B,EAC3B,oBAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,oCAAoC;QAC1C,KAAK,EAAE,OAAO;QAEd,eAAe,CAAC,MAAM;YACpB,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE;gBACrC,IAAI,kBAAkB,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"vite-watch-config-plugin.js","sourceRoot":"","sources":["../src/vite-watch-config-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAE,EAAE;IAChE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACnE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM;SAC5B,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,WAAW,WAAW,EAAE,GAAG,CAAC,EAAE,GAAG,WAAW,OAAO,CAAC;SAC3E,OAAO,CAAC,oBAAoB,EAAE,GAAG,WAAW,OAAO,CAAC;SACpD,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEtB,MAAM,cAAc,GA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KAAK,EAAE,cAAc,CAAC,CAAC;YAC3C,CAAC;YAED,MAAM,UAAU,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;YACjD,MAAM,CAAC,WAAW,CAAC,GAAG,CACpB,GAAG,UAAU,uBAAuB,EACpC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;gBACjB,GAAG,CAAC,GAAG,CACL,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CACrE,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import path from \"path\";\n\nimport type { PluginOption } from \"vite\";\n\nimport type { HvAppShellConfig } from \"@hitachivantara/app-shell-shared\";\n\nimport fs from \"fs\";\nimport { getPublicPath } from \"./config-utils.js\";\n\nimport { require } from \"./nodeModule.js\";\n\nconst replaceBundlePath = (bundle: string, selfAppName: string) => {\n if (!bundle.startsWith(selfAppName) && !bundle.startsWith(\"@self\")) {\n return bundle;\n }\n\n const normalizedBundle = bundle\n .replace(new RegExp(`^${selfAppName}/(?!src/)`, \"g\"), `${selfAppName}/src/`)\n .replace(/^@self\\/(?!src\\/)/g, `${selfAppName}/src/`)\n .replace(\".js\", \"\");\n\n const normalizedPath = path.resolve(\n normalizedBundle.replace(selfAppName, \".\")\n );\n\n let replacedBundle = bundle;\n // Required since bundle can point to a folder or to a file, and if it's a file, it needs to be loaded with the correct extension\n if (fs.existsSync(normalizedPath)) {\n replacedBundle = normalizedBundle;\n } else if (fs.existsSync(`${normalizedPath}.ts`)) {\n replacedBundle = `${normalizedBundle}.ts`;\n } else if (fs.existsSync(`${normalizedPath}.tsx`)) {\n replacedBundle = `${normalizedBundle}.tsx`;\n } else if (fs.existsSync(`${normalizedPath}.js`)) {\n replacedBundle = `${normalizedBundle}.js`;\n } else if (fs.existsSync(`${normalizedPath}.jsx`)) {\n replacedBundle = `${normalizedBundle}.jsx`;\n }\n\n return replacedBundle;\n};\n\nconst prepareConfigForDevMode = (\n config: HvAppShellConfig,\n selfAppName: string\n) => {\n const { mainPanel, header, theming, providers } = config;\n const replacedConfig: HvAppShellConfig = {\n ...config\n };\n // Main panel - Views\n if (mainPanel?.views && replacedConfig.mainPanel) {\n replacedConfig.mainPanel.views = mainPanel.views?.map(view => {\n return { ...view, bundle: replaceBundlePath(view.bundle, selfAppName) };\n });\n }\n // Header - Actions\n if (header?.actions && replacedConfig.header) {\n replacedConfig.header.actions = header.actions?.map(action => {\n return {\n ...action,\n bundle: replaceBundlePath(action.bundle, selfAppName)\n };\n });\n }\n // Theming\n if (theming?.themes && replacedConfig.theming) {\n replacedConfig.theming.themes = theming.themes?.map(theme => {\n return replaceBundlePath(theme, selfAppName);\n });\n }\n // Providers\n if (providers) {\n replacedConfig.providers = providers.map(provider => {\n return {\n ...provider,\n bundle: replaceBundlePath(provider.bundle, selfAppName)\n };\n });\n }\n\n return replacedConfig;\n};\n\nexport default function serveAppShellConfig(\n appShellConfig: HvAppShellConfig,\n root: string,\n selfAppName: string,\n appShellConfigFile?: string,\n automaticViewsFolder?: string\n): PluginOption {\n return {\n name: \"vite-plugin-watch-app-shell-config\",\n apply: \"serve\",\n\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[require.resolve(appShellConfigFile)];\n server\n .restart()\n .catch(e => console.error(`Restart failed with: ${e}`));\n }\n };\n\n const restartServer2 = (file: string) => {\n if (automaticViewsFolder != null && /\\/index\\.[tj]sx?$/.exec(file)) {\n console.info(\"Automatic views folder changed. Reloading...\");\n server\n .restart()\n .catch(e => console.error(`Restart failed with: ${e}`));\n }\n };\n\n if (appShellConfigFile != null) {\n server.watcher.add(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(\n JSON.stringify(prepareConfigForDevMode(appShellConfig, selfAppName))\n );\n }\n );\n }\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/app-shell-vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "AppShell Vite Plugin",
|
|
5
5
|
"author": "Hitachi Vantara - Boba Fett Team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@emotion/cache": "^11.11.0",
|
|
38
38
|
"@emotion/react": "^11.11.1",
|
|
39
|
-
"@hitachivantara/app-shell-shared": "0.
|
|
39
|
+
"@hitachivantara/app-shell-shared": "0.13.0",
|
|
40
|
+
"@hitachivantara/app-shell-ui": "0.38.0",
|
|
40
41
|
"@hitachivantara/uikit-react-icons": "^5.6.0",
|
|
41
42
|
"@hitachivantara/uikit-react-shared": "^5.1.0",
|
|
42
|
-
"@rollup/plugin-commonjs": "^
|
|
43
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
43
44
|
"@rollup/plugin-json": "^6.0.0",
|
|
44
45
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
45
46
|
"@rollup/plugin-replace": "^5.0.2",
|
|
@@ -49,15 +50,15 @@
|
|
|
49
50
|
"react": "^18.2.0",
|
|
50
51
|
"react-dom": "^18.2.0",
|
|
51
52
|
"react-router-dom": "^6.9.0",
|
|
52
|
-
"rollup": "^
|
|
53
|
+
"rollup": "^4.6.1",
|
|
53
54
|
"ts-node": "^10.9.1",
|
|
54
|
-
"vite": "^
|
|
55
|
-
"vite-plugin-static-copy": "^0.
|
|
55
|
+
"vite": "^5.0.4",
|
|
56
|
+
"vite-plugin-static-copy": "^1.0.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/react": "^18.0.28",
|
|
59
60
|
"@types/react-dom": "^18.0.11",
|
|
60
61
|
"tsc-watch": "^6.0.0"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2e601e6925c5426f068e58cb740b6a5ddf8dc109"
|
|
63
64
|
}
|