adnbn 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/cli/builders/app/index.d.ts +2 -1
  2. package/dist/cli/builders/locale/index.d.ts +2 -1
  3. package/dist/cli/builders/manifest/index.d.ts +2 -1
  4. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +2 -4
  5. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
  6. package/dist/cli/entrypoint/finder/AbstractAssetFinder.d.ts +2 -1
  7. package/dist/cli/entrypoint/finder/AbstractAssetFinder.js +2 -2
  8. package/dist/cli/entrypoint/finder/AbstractAssetFinder.js.map +1 -1
  9. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.d.ts +2 -1
  10. package/dist/cli/entrypoint/finder/AbstractFinder.d.ts +2 -1
  11. package/dist/cli/entrypoint/finder/AbstractFinder.js +6 -3
  12. package/dist/cli/entrypoint/finder/AbstractFinder.js.map +1 -1
  13. package/dist/cli/entrypoint/finder/AbstractOptionsFinder.d.ts +2 -1
  14. package/dist/cli/entrypoint/finder/AbstractPluginFinder.d.ts +2 -1
  15. package/dist/cli/entrypoint/finder/AbstractTransportFinder.d.ts +2 -1
  16. package/dist/cli/entrypoint/finder/AbstractViewFinder.d.ts +2 -1
  17. package/dist/cli/entrypoint/finder/AssetPluginFinder.d.ts +2 -1
  18. package/dist/cli/entrypoint/finder/BackgroundFinder.d.ts +2 -1
  19. package/dist/cli/entrypoint/finder/CommandFinder.d.ts +2 -1
  20. package/dist/cli/entrypoint/finder/ContentFinder.d.ts +2 -1
  21. package/dist/cli/entrypoint/finder/IconFinder.d.ts +2 -1
  22. package/dist/cli/entrypoint/finder/IconFinder.js +1 -1
  23. package/dist/cli/entrypoint/finder/IconFinder.js.map +1 -1
  24. package/dist/cli/entrypoint/finder/LocaleFinder.d.ts +2 -1
  25. package/dist/cli/entrypoint/finder/OffscreenFinder.d.ts +2 -1
  26. package/dist/cli/entrypoint/finder/OffscreenViewFinder.d.ts +2 -1
  27. package/dist/cli/entrypoint/finder/PageFinder.d.ts +2 -1
  28. package/dist/cli/entrypoint/finder/PluginFinder.d.ts +2 -1
  29. package/dist/cli/entrypoint/finder/PopupFinder.d.ts +2 -1
  30. package/dist/cli/entrypoint/finder/RelayFinder.d.ts +2 -1
  31. package/dist/cli/entrypoint/finder/ServiceFinder.d.ts +2 -1
  32. package/dist/cli/entrypoint/finder/SidebarFinder.d.ts +2 -1
  33. package/dist/cli/entrypoint/finder/index.d.ts +2 -1
  34. package/dist/cli/entrypoint/index.d.ts +2 -1
  35. package/dist/cli/entrypoint/parser/AbstractParser.d.ts +2 -1
  36. package/dist/cli/entrypoint/parser/AbstractParser.js +1 -1
  37. package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
  38. package/dist/cli/entrypoint/parser/BackgroundParser.d.ts +2 -1
  39. package/dist/cli/entrypoint/parser/CommandParser.d.ts +2 -1
  40. package/dist/cli/entrypoint/parser/ContentParser.d.ts +2 -1
  41. package/dist/cli/entrypoint/parser/OffscreenParser.d.ts +2 -1
  42. package/dist/cli/entrypoint/parser/PageParser.d.ts +2 -1
  43. package/dist/cli/entrypoint/parser/PopupParser.d.ts +2 -1
  44. package/dist/cli/entrypoint/parser/RelayParser.d.ts +2 -1
  45. package/dist/cli/entrypoint/parser/ServiceParser.d.ts +2 -1
  46. package/dist/cli/entrypoint/parser/SidebarParser.d.ts +2 -1
  47. package/dist/cli/entrypoint/parser/ViewParser.d.ts +84 -84
  48. package/dist/cli/entrypoint/parser/index.d.ts +2 -1
  49. package/dist/cli/index.js +2 -2
  50. package/dist/cli/index.js.map +1 -1
  51. package/dist/cli/plugins/asset.d.ts +2 -1
  52. package/dist/cli/plugins/background/Background.d.ts +2 -1
  53. package/dist/cli/plugins/background/BackgroundEntry.d.ts +2 -1
  54. package/dist/cli/plugins/background/BackgroundManifest.d.ts +2 -1
  55. package/dist/cli/plugins/background/Command.d.ts +2 -1
  56. package/dist/cli/plugins/background/Service.d.ts +2 -1
  57. package/dist/cli/plugins/background/ServiceDeclaration.d.ts +2 -1
  58. package/dist/cli/plugins/background/index.d.ts +2 -1
  59. package/dist/cli/plugins/bundler.d.ts +2 -1
  60. package/dist/cli/plugins/bundler.js +1 -15
  61. package/dist/cli/plugins/bundler.js.map +1 -1
  62. package/dist/cli/plugins/content/Content.d.ts +2 -1
  63. package/dist/cli/plugins/content/ContentDriver.d.ts +2 -1
  64. package/dist/cli/plugins/content/ContentManager.d.ts +2 -1
  65. package/dist/cli/plugins/content/ContentName.d.ts +2 -1
  66. package/dist/cli/plugins/content/Relay.d.ts +2 -1
  67. package/dist/cli/plugins/content/RelayDeclaration.d.ts +2 -1
  68. package/dist/cli/plugins/content/index.d.ts +2 -1
  69. package/dist/cli/plugins/dotenv/crypt.d.ts +4 -0
  70. package/dist/cli/plugins/dotenv/crypt.js +26 -0
  71. package/dist/cli/plugins/dotenv/crypt.js.map +1 -0
  72. package/dist/cli/plugins/dotenv/index.d.ts +2 -1
  73. package/dist/cli/plugins/dotenv/index.js +9 -12
  74. package/dist/cli/plugins/dotenv/index.js.map +1 -1
  75. package/dist/cli/plugins/dotenv/utils.d.ts +9 -4
  76. package/dist/cli/plugins/dotenv/utils.js +31 -26
  77. package/dist/cli/plugins/dotenv/utils.js.map +1 -1
  78. package/dist/cli/plugins/html.d.ts +2 -1
  79. package/dist/cli/plugins/icon/Icon.d.ts +2 -1
  80. package/dist/cli/plugins/icon/Icon.js +1 -1
  81. package/dist/cli/plugins/icon/Icon.js.map +1 -1
  82. package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +2 -1
  83. package/dist/cli/plugins/icon/declaration/index.d.ts +2 -1
  84. package/dist/cli/plugins/icon/index.d.ts +2 -1
  85. package/dist/cli/plugins/icon/index.js +1 -2
  86. package/dist/cli/plugins/icon/index.js.map +1 -1
  87. package/dist/cli/plugins/index.d.ts +2 -1
  88. package/dist/cli/plugins/locale/Locale.d.ts +2 -1
  89. package/dist/cli/plugins/locale/declaration/LocaleDeclaration.d.ts +2 -1
  90. package/dist/cli/plugins/locale/declaration/index.d.ts +2 -1
  91. package/dist/cli/plugins/locale/index.d.ts +2 -1
  92. package/dist/cli/plugins/locale/index.js +1 -1
  93. package/dist/cli/plugins/locale/index.js.map +1 -1
  94. package/dist/cli/plugins/meta/AbstractMeta.d.ts +2 -1
  95. package/dist/cli/plugins/meta/Author.d.ts +2 -1
  96. package/dist/cli/plugins/meta/Email.d.ts +2 -1
  97. package/dist/cli/plugins/meta/Homepage.d.ts +2 -1
  98. package/dist/cli/plugins/meta/Incognito.d.ts +2 -1
  99. package/dist/cli/plugins/meta/index.d.ts +2 -1
  100. package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -1
  101. package/dist/cli/plugins/offscreen/OffscreenDeclaration.d.ts +2 -1
  102. package/dist/cli/plugins/offscreen/index.d.ts +2 -1
  103. package/dist/cli/plugins/optimization.d.ts +2 -1
  104. package/dist/cli/plugins/optimization.js +2 -2
  105. package/dist/cli/plugins/optimization.js.map +1 -1
  106. package/dist/cli/plugins/output.d.ts +2 -1
  107. package/dist/cli/plugins/output.js +2 -2
  108. package/dist/cli/plugins/output.js.map +1 -1
  109. package/dist/cli/plugins/page/Page.d.ts +2 -1
  110. package/dist/cli/plugins/page/declaration/PageDeclaration.d.ts +2 -1
  111. package/dist/cli/plugins/page/declaration/index.d.ts +2 -1
  112. package/dist/cli/plugins/page/index.d.ts +2 -1
  113. package/dist/cli/plugins/popup/Popup.d.ts +2 -1
  114. package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +2 -1
  115. package/dist/cli/plugins/popup/declaration/index.d.ts +2 -1
  116. package/dist/cli/plugins/popup/index.d.ts +2 -1
  117. package/dist/cli/plugins/public.d.ts +2 -1
  118. package/dist/cli/plugins/react.d.ts +2 -1
  119. package/dist/cli/plugins/react.js +4 -4
  120. package/dist/cli/plugins/react.js.map +1 -1
  121. package/dist/cli/plugins/sidebar/Sidebar.d.ts +2 -1
  122. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +2 -1
  123. package/dist/cli/plugins/sidebar/declaration/index.d.ts +2 -1
  124. package/dist/cli/plugins/sidebar/index.d.ts +2 -1
  125. package/dist/cli/plugins/style.d.ts +2 -1
  126. package/dist/cli/plugins/style.js +4 -4
  127. package/dist/cli/plugins/style.js.map +1 -1
  128. package/dist/cli/plugins/typescript/FileBuilder.d.ts +2 -1
  129. package/dist/cli/plugins/typescript/FileBuilder.js +2 -2
  130. package/dist/cli/plugins/typescript/FileBuilder.js.map +1 -1
  131. package/dist/cli/plugins/typescript/TypescriptConfig.d.ts +2 -1
  132. package/dist/cli/plugins/typescript/TypescriptConfig.js +4 -4
  133. package/dist/cli/plugins/typescript/TypescriptConfig.js.map +1 -1
  134. package/dist/cli/plugins/typescript/declaration/VendorDeclaration.d.ts +2 -1
  135. package/dist/cli/plugins/typescript/declaration/index.d.ts +2 -1
  136. package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.d.ts +2 -1
  137. package/dist/cli/plugins/typescript/declaration/transport/index.d.ts +2 -1
  138. package/dist/cli/plugins/typescript/index.d.ts +2 -1
  139. package/dist/cli/plugins/version/AbstractVersion.d.ts +2 -1
  140. package/dist/cli/plugins/version/AddonVersion.d.ts +2 -1
  141. package/dist/cli/plugins/version/AddonVersion.js +2 -2
  142. package/dist/cli/plugins/version/AddonVersion.js.map +1 -1
  143. package/dist/cli/plugins/version/BrowserMinimumVersion.d.ts +2 -1
  144. package/dist/cli/plugins/version/index.d.ts +2 -1
  145. package/dist/cli/plugins/view/View.d.ts +2 -1
  146. package/dist/cli/plugins/view/index.d.ts +2 -1
  147. package/dist/cli/resolvers/bundler.d.ts +2 -1
  148. package/dist/cli/resolvers/config.d.ts +2 -1
  149. package/dist/cli/resolvers/config.js +32 -24
  150. package/dist/cli/resolvers/config.js.map +1 -1
  151. package/dist/cli/resolvers/path.d.ts +6 -4
  152. package/dist/cli/resolvers/path.js +24 -14
  153. package/dist/cli/resolvers/path.js.map +1 -1
  154. package/dist/cli/resolvers/plugin.d.ts +2 -1
  155. package/dist/cli/virtual/index.js +3 -3
  156. package/dist/{config-DzmiK3GH.d.ts → config-Ce0Le6r4.d.ts} +90 -59
  157. package/dist/entry/transport/index.d.ts +5 -5
  158. package/dist/entry/transport/index.js.map +1 -1
  159. package/dist/index.d.ts +2 -1
  160. package/dist/locale/adapters/react/context.d.ts +2 -3
  161. package/dist/locale/adapters/react/index.d.ts +2 -2
  162. package/dist/main/config.d.ts +3 -2
  163. package/dist/main/env.js +1 -1
  164. package/dist/main/env.js.map +1 -1
  165. package/dist/main/index.d.ts +2 -1
  166. package/dist/main/plugin.d.ts +3 -2
  167. package/dist/message/MessageManager.js +4 -1
  168. package/dist/message/MessageManager.js.map +1 -1
  169. package/dist/message/adapters/react/useMessageHandler.d.ts +2 -2
  170. package/dist/message/adapters/react/useMessageHandler.js +15 -8
  171. package/dist/message/adapters/react/useMessageHandler.js.map +1 -1
  172. package/dist/transport/index.d.ts +6 -0
  173. package/dist/transport/index.js +1 -0
  174. package/dist/transport/index.js.map +1 -0
  175. package/dist/types/config.d.ts +2 -1
  176. package/dist/types/content.d.ts +1 -1
  177. package/dist/types/content.js.map +1 -1
  178. package/dist/types/env.d.ts +9 -0
  179. package/dist/types/env.js +5 -0
  180. package/dist/types/env.js.map +1 -0
  181. package/dist/types/plugin.d.ts +2 -1
  182. package/package.json +45 -46
@@ -16,7 +16,7 @@ import '../file/resolvers/ImportResolver.js';
16
16
  import '../file/resolvers/TsResolver.js';
17
17
  import '../file/types.js';
18
18
  import '../../../types/browser.js';
19
- import '../../../config-DzmiK3GH.js';
19
+ import '../../../config-Ce0Le6r4.js';
20
20
  import '@rspack/core';
21
21
  import 'html-rspack-tags-plugin';
22
22
  import '../../../types/app.js';
@@ -29,6 +29,7 @@ import '../../../types/helpers.js';
29
29
  import '../../../types/background.js';
30
30
  import '../../../types/command.js';
31
31
  import '../../../types/locale.js';
32
+ import '../../../types/env.js';
32
33
  import './ViewParser.js';
33
34
  import '../../../types/view.js';
34
35
  import '../../../types/page.js';
package/dist/cli/index.js CHANGED
@@ -20,7 +20,7 @@ cli.command("watch [root]", "Start watch mode").option("-m, --mode <mode>", "Set
20
20
  app: options.app,
21
21
  browser: options.browser,
22
22
  manifestVersion: options.mv2 ? 2 : 3,
23
- inputDir: root,
23
+ rootDir: root,
24
24
  configFile: options.config
25
25
  });
26
26
  } catch (e) {
@@ -36,7 +36,7 @@ cli.command("build [root]", "Build for production").option("-m, --mode <mode>",
36
36
  app: options.app,
37
37
  browser: options.browser,
38
38
  manifestVersion: options.mv2 ? 2 : 3,
39
- inputDir: root,
39
+ rootDir: root,
40
40
  configFile: options.config,
41
41
  analyze: options.analyze
42
42
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import cac from \"cac\";\nimport {consola} from \"consola\";\nimport fs from \"fs\";\n\nimport app from \"./builders/app\";\n\nimport {Command} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\n\nconst pkg = fs.readFileSync(new URL(\"../../package.json\", import.meta.url), {encoding: \"utf-8\"});\nconst {name, version} = JSON.parse(pkg);\n\nconst cli = cac(name);\n\ncli.option(\"--debug\", \"Enable debug mode\");\n\ncli.command(\"init\", \"Initialize a new project\").action(() => {\n consola.box(\"Coming soon...\");\n});\n\ncli.command(\"watch [root]\", \"Start watch mode\")\n .option(\"-m, --mode <mode>\", \"Set env mode\", {default: \"development\"})\n .option(\"-c, --config <config>\", \"Path to config file\")\n .option(\"-a, --app <app>\", \"Specify an app to run\", {default: \"myapp\"})\n .option(\"-b, --browser <browser>\", \"Specify a browser\")\n .option(\"--mv2\", \"Target manifest v2\")\n .action(async (root, options) => {\n try {\n await app({\n command: Command.Watch,\n mode: options.mode,\n debug: options.debug,\n app: options.app,\n browser: options.browser,\n manifestVersion: options.mv2 ? 2 : 3,\n inputDir: root,\n configFile: options.config,\n });\n } catch (e) {\n consola.error(e);\n }\n });\n\ncli.command(\"build [root]\", \"Build for production\")\n .option(\"-m, --mode <mode>\", \"Set env mode\", {default: \"production\"})\n .option(\"-c, --config <config>\", \"Path to config file\")\n .option(\"-a, --app <app>\", \"Specify an app to run\", {default: \"myapp\"})\n .option(\"-b, --browser <browser>\", \"Specify a browser\", {default: Browser.Chrome})\n .option(\"--mv2\", \"Target manifest v2\")\n .option(\"--analyze\", \"Visualize extension bundle\")\n .action(async (root, options) => {\n try {\n await app({\n command: Command.Build,\n mode: options.mode,\n debug: options.debug,\n app: options.app,\n browser: options.browser,\n manifestVersion: options.mv2 ? 2 : 3,\n inputDir: root,\n configFile: options.config,\n analyze: options.analyze,\n });\n } catch (e) {\n consola.error(e);\n }\n });\n\ncli.version(version);\ncli.help();\ncli.parse();\n"],"mappings":"AAAA,OAAO,SAAS;AAChB,SAAQ,eAAc;AACtB,OAAO,QAAQ;AAEf,OAAO,SAAS;AAEhB,SAAQ,eAAc;AACtB,SAAQ,eAAc;AAEtB,MAAM,MAAM,GAAG,aAAa,IAAI,IAAI,sBAAsB,YAAY,GAAG,GAAG,EAAC,UAAU,QAAO,CAAC;AAC/F,MAAM,EAAC,MAAM,QAAO,IAAI,KAAK,MAAM,GAAG;AAEtC,MAAM,MAAM,IAAI,IAAI;AAEpB,IAAI,OAAO,WAAW,mBAAmB;AAEzC,IAAI,QAAQ,QAAQ,0BAA0B,EAAE,OAAO,MAAM;AACzD,UAAQ,IAAI,gBAAgB;AAChC,CAAC;AAED,IAAI,QAAQ,gBAAgB,kBAAkB,EACzC,OAAO,qBAAqB,gBAAgB,EAAC,SAAS,cAAa,CAAC,EACpE,OAAO,yBAAyB,qBAAqB,EACrD,OAAO,mBAAmB,yBAAyB,EAAC,SAAS,QAAO,CAAC,EACrE,OAAO,2BAA2B,mBAAmB,EACrD,OAAO,SAAS,oBAAoB,EACpC,OAAO,OAAO,MAAM,YAAY;AAC7B,MAAI;AACA,UAAM,IAAI;AAAA,MACN,SAAS,QAAQ;AAAA,MACjB,MAAM,QAAQ;AAAA,MACd,OAAO,QAAQ;AAAA,MACf,KAAK,QAAQ;AAAA,MACb,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,MAAM,IAAI;AAAA,MACnC,UAAU;AAAA,MACV,YAAY,QAAQ;AAAA,IACxB,CAAC;AAAA,EACL,SAAS,GAAG;AACR,YAAQ,MAAM,CAAC;AAAA,EACnB;AACJ,CAAC;AAEL,IAAI,QAAQ,gBAAgB,sBAAsB,EAC7C,OAAO,qBAAqB,gBAAgB,EAAC,SAAS,aAAY,CAAC,EACnE,OAAO,yBAAyB,qBAAqB,EACrD,OAAO,mBAAmB,yBAAyB,EAAC,SAAS,QAAO,CAAC,EACrE,OAAO,2BAA2B,qBAAqB,EAAC,SAAS,QAAQ,OAAM,CAAC,EAChF,OAAO,SAAS,oBAAoB,EACpC,OAAO,aAAa,4BAA4B,EAChD,OAAO,OAAO,MAAM,YAAY;AAC7B,MAAI;AACA,UAAM,IAAI;AAAA,MACN,SAAS,QAAQ;AAAA,MACjB,MAAM,QAAQ;AAAA,MACd,OAAO,QAAQ;AAAA,MACf,KAAK,QAAQ;AAAA,MACb,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,MAAM,IAAI;AAAA,MACnC,UAAU;AAAA,MACV,YAAY,QAAQ;AAAA,MACpB,SAAS,QAAQ;AAAA,IACrB,CAAC;AAAA,EACL,SAAS,GAAG;AACR,YAAQ,MAAM,CAAC;AAAA,EACnB;AACJ,CAAC;AAEL,IAAI,QAAQ,OAAO;AACnB,IAAI,KAAK;AACT,IAAI,MAAM;","names":[]}
1
+ {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["import cac from \"cac\";\nimport {consola} from \"consola\";\nimport fs from \"fs\";\n\nimport app from \"./builders/app\";\n\nimport {Command} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\n\nconst pkg = fs.readFileSync(new URL(\"../../package.json\", import.meta.url), {encoding: \"utf-8\"});\nconst {name, version} = JSON.parse(pkg);\n\nconst cli = cac(name);\n\ncli.option(\"--debug\", \"Enable debug mode\");\n\ncli.command(\"init\", \"Initialize a new project\").action(() => {\n consola.box(\"Coming soon...\");\n});\n\ncli.command(\"watch [root]\", \"Start watch mode\")\n .option(\"-m, --mode <mode>\", \"Set env mode\", {default: \"development\"})\n .option(\"-c, --config <config>\", \"Path to config file\")\n .option(\"-a, --app <app>\", \"Specify an app to run\", {default: \"myapp\"})\n .option(\"-b, --browser <browser>\", \"Specify a browser\")\n .option(\"--mv2\", \"Target manifest v2\")\n .action(async (root, options) => {\n try {\n await app({\n command: Command.Watch,\n mode: options.mode,\n debug: options.debug,\n app: options.app,\n browser: options.browser,\n manifestVersion: options.mv2 ? 2 : 3,\n rootDir: root,\n configFile: options.config,\n });\n } catch (e) {\n consola.error(e);\n }\n });\n\ncli.command(\"build [root]\", \"Build for production\")\n .option(\"-m, --mode <mode>\", \"Set env mode\", {default: \"production\"})\n .option(\"-c, --config <config>\", \"Path to config file\")\n .option(\"-a, --app <app>\", \"Specify an app to run\", {default: \"myapp\"})\n .option(\"-b, --browser <browser>\", \"Specify a browser\", {default: Browser.Chrome})\n .option(\"--mv2\", \"Target manifest v2\")\n .option(\"--analyze\", \"Visualize extension bundle\")\n .action(async (root, options) => {\n try {\n await app({\n command: Command.Build,\n mode: options.mode,\n debug: options.debug,\n app: options.app,\n browser: options.browser,\n manifestVersion: options.mv2 ? 2 : 3,\n rootDir: root,\n configFile: options.config,\n analyze: options.analyze,\n });\n } catch (e) {\n consola.error(e);\n }\n });\n\ncli.version(version);\ncli.help();\ncli.parse();\n"],"mappings":"AAAA,OAAO,SAAS;AAChB,SAAQ,eAAc;AACtB,OAAO,QAAQ;AAEf,OAAO,SAAS;AAEhB,SAAQ,eAAc;AACtB,SAAQ,eAAc;AAEtB,MAAM,MAAM,GAAG,aAAa,IAAI,IAAI,sBAAsB,YAAY,GAAG,GAAG,EAAC,UAAU,QAAO,CAAC;AAC/F,MAAM,EAAC,MAAM,QAAO,IAAI,KAAK,MAAM,GAAG;AAEtC,MAAM,MAAM,IAAI,IAAI;AAEpB,IAAI,OAAO,WAAW,mBAAmB;AAEzC,IAAI,QAAQ,QAAQ,0BAA0B,EAAE,OAAO,MAAM;AACzD,UAAQ,IAAI,gBAAgB;AAChC,CAAC;AAED,IAAI,QAAQ,gBAAgB,kBAAkB,EACzC,OAAO,qBAAqB,gBAAgB,EAAC,SAAS,cAAa,CAAC,EACpE,OAAO,yBAAyB,qBAAqB,EACrD,OAAO,mBAAmB,yBAAyB,EAAC,SAAS,QAAO,CAAC,EACrE,OAAO,2BAA2B,mBAAmB,EACrD,OAAO,SAAS,oBAAoB,EACpC,OAAO,OAAO,MAAM,YAAY;AAC7B,MAAI;AACA,UAAM,IAAI;AAAA,MACN,SAAS,QAAQ;AAAA,MACjB,MAAM,QAAQ;AAAA,MACd,OAAO,QAAQ;AAAA,MACf,KAAK,QAAQ;AAAA,MACb,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,MAAM,IAAI;AAAA,MACnC,SAAS;AAAA,MACT,YAAY,QAAQ;AAAA,IACxB,CAAC;AAAA,EACL,SAAS,GAAG;AACR,YAAQ,MAAM,CAAC;AAAA,EACnB;AACJ,CAAC;AAEL,IAAI,QAAQ,gBAAgB,sBAAsB,EAC7C,OAAO,qBAAqB,gBAAgB,EAAC,SAAS,aAAY,CAAC,EACnE,OAAO,yBAAyB,qBAAqB,EACrD,OAAO,mBAAmB,yBAAyB,EAAC,SAAS,QAAO,CAAC,EACrE,OAAO,2BAA2B,qBAAqB,EAAC,SAAS,QAAQ,OAAM,CAAC,EAChF,OAAO,SAAS,oBAAoB,EACpC,OAAO,aAAa,4BAA4B,EAChD,OAAO,OAAO,MAAM,YAAY;AAC7B,MAAI;AACA,UAAM,IAAI;AAAA,MACN,SAAS,QAAQ;AAAA,MACjB,MAAM,QAAQ;AAAA,MACd,OAAO,QAAQ;AAAA,MACf,KAAK,QAAQ;AAAA,MACb,SAAS,QAAQ;AAAA,MACjB,iBAAiB,QAAQ,MAAM,IAAI;AAAA,MACnC,SAAS;AAAA,MACT,YAAY,QAAQ;AAAA,MACpB,SAAS,QAAQ;AAAA,IACrB,CAAC;AAAA,EACL,SAAS,GAAG;AACR,YAAQ,MAAM,CAAC;AAAA,EACnB;AACJ,CAAC;AAEL,IAAI,QAAQ,OAAO;AACnB,IAAI,KAAK;AACT,IAAI,MAAM;","names":[]}
@@ -1,4 +1,4 @@
1
- import { b as PluginDefinition } from '../../config-DzmiK3GH.js';
1
+ import { b as PluginDefinition } from '../../config-Ce0Le6r4.js';
2
2
  import '@rspack/core';
3
3
  import 'html-rspack-tags-plugin';
4
4
  import '../../types/app.js';
@@ -12,6 +12,7 @@ import '../../types/helpers.js';
12
12
  import '../../types/background.js';
13
13
  import '../../types/command.js';
14
14
  import '../../types/locale.js';
15
+ import '../../types/env.js';
15
16
 
16
17
  declare const _default: PluginDefinition<[]>;
17
18
 
@@ -14,10 +14,11 @@ import '../../entrypoint/finder/AbstractPluginFinder.js';
14
14
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
15
15
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
16
16
  import '../../entrypoint/finder/AbstractFinder.js';
17
- import '../../../config-DzmiK3GH.js';
17
+ import '../../../config-Ce0Le6r4.js';
18
18
  import '@rspack/core';
19
19
  import 'html-rspack-tags-plugin';
20
20
  import '../../../types/app.js';
21
+ import '../../../types/env.js';
21
22
 
22
23
  declare class export_default extends export_default$1 {
23
24
  entry(): BackgroundEntry<BackgroundEntrypointOptions>;
@@ -12,10 +12,11 @@ import '../../../types/locale.js';
12
12
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
13
13
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
14
14
  import '../../entrypoint/finder/AbstractFinder.js';
15
- import '../../../config-DzmiK3GH.js';
15
+ import '../../../config-Ce0Le6r4.js';
16
16
  import '@rspack/core';
17
17
  import 'html-rspack-tags-plugin';
18
18
  import '../../../types/app.js';
19
+ import '../../../types/env.js';
19
20
 
20
21
  declare class BackgroundEntry<O extends BackgroundEntrypointOptions> {
21
22
  readonly finder: export_default<O>;
@@ -8,11 +8,12 @@ import '../../entrypoint/finder/AbstractPluginFinder.js';
8
8
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
9
9
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
10
10
  import '../../entrypoint/finder/AbstractFinder.js';
11
- import '../../../config-DzmiK3GH.js';
11
+ import '../../../config-Ce0Le6r4.js';
12
12
  import '@rspack/core';
13
13
  import 'html-rspack-tags-plugin';
14
14
  import '../../../types/app.js';
15
15
  import '../../../types/locale.js';
16
+ import '../../../types/env.js';
16
17
  import '../../../types/content.js';
17
18
  import 'react';
18
19
  import 'utility-types';
@@ -7,13 +7,14 @@ import '../../entrypoint/finder/AbstractPluginFinder.js';
7
7
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
8
8
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
9
9
  import '../../entrypoint/finder/AbstractFinder.js';
10
- import '../../../config-DzmiK3GH.js';
10
+ import '../../../config-Ce0Le6r4.js';
11
11
  import '@rspack/core';
12
12
  import 'html-rspack-tags-plugin';
13
13
  import '../../../types/app.js';
14
14
  import '../../../types/browser.js';
15
15
  import '../../../types/locale.js';
16
16
  import '../../../types/helpers.js';
17
+ import '../../../types/env.js';
17
18
  import '../../../types/content.js';
18
19
  import 'react';
19
20
  import 'utility-types';
@@ -14,10 +14,11 @@ import '../../entrypoint/finder/AbstractPluginFinder.js';
14
14
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
15
15
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
16
16
  import '../../entrypoint/finder/AbstractFinder.js';
17
- import '../../../config-DzmiK3GH.js';
17
+ import '../../../config-Ce0Le6r4.js';
18
18
  import '@rspack/core';
19
19
  import 'html-rspack-tags-plugin';
20
20
  import '../../../types/app.js';
21
+ import '../../../types/env.js';
21
22
  import '../../entrypoint/finder/AbstractTransportFinder.js';
22
23
  import '../../entrypoint/name/InlineNameGenerator.js';
23
24
  import '../../entrypoint/name/NameGenerator.js';
@@ -1,4 +1,4 @@
1
- import { R as ReadonlyConfig } from '../../../config-DzmiK3GH.js';
1
+ import { R as ReadonlyConfig } from '../../../config-Ce0Le6r4.js';
2
2
  import export_default$1 from '../typescript/declaration/transport/TransportDeclaration.js';
3
3
  import '@rspack/core';
4
4
  import 'html-rspack-tags-plugin';
@@ -13,6 +13,7 @@ import '../../../types/helpers.js';
13
13
  import '../../../types/background.js';
14
14
  import '../../../types/command.js';
15
15
  import '../../../types/locale.js';
16
+ import '../../../types/env.js';
16
17
  import '../typescript/FileBuilder.js';
17
18
 
18
19
  declare class export_default extends export_default$1 {
@@ -1,4 +1,4 @@
1
- import { b as PluginDefinition } from '../../../config-DzmiK3GH.js';
1
+ import { b as PluginDefinition } from '../../../config-Ce0Le6r4.js';
2
2
  import '@rspack/core';
3
3
  import 'html-rspack-tags-plugin';
4
4
  import '../../../types/app.js';
@@ -12,6 +12,7 @@ import '../../../types/helpers.js';
12
12
  import '../../../types/background.js';
13
13
  import '../../../types/command.js';
14
14
  import '../../../types/locale.js';
15
+ import '../../../types/env.js';
15
16
 
16
17
  declare const _default: PluginDefinition<[]>;
17
18
 
@@ -1,4 +1,4 @@
1
- import { b as PluginDefinition } from '../../config-DzmiK3GH.js';
1
+ import { b as PluginDefinition } from '../../config-Ce0Le6r4.js';
2
2
  import '@rspack/core';
3
3
  import 'html-rspack-tags-plugin';
4
4
  import '../../types/app.js';
@@ -12,6 +12,7 @@ import '../../types/helpers.js';
12
12
  import '../../types/background.js';
13
13
  import '../../types/command.js';
14
14
  import '../../types/locale.js';
15
+ import '../../types/env.js';
15
16
 
16
17
  declare const _default: PluginDefinition<[]>;
17
18
 
@@ -1,25 +1,11 @@
1
1
  import _ from "lodash";
2
- import { merge as mergeConfig } from "webpack-merge";
3
2
  import { definePlugin } from "./../../main/plugin.js";
4
3
  var bundler_default = definePlugin(() => {
5
4
  return {
6
5
  name: "adnbn:bundler",
7
6
  bundler: async ({ config, rspack }) => {
8
7
  const { bundler } = config;
9
- const userConfig = _.isFunction(bundler) ? await bundler(rspack) : bundler;
10
- return mergeConfig(userConfig, {
11
- resolve: {
12
- fallback: {
13
- crypto: "crypto-browserify",
14
- buffer: "buffer/",
15
- stream: "stream-browserify",
16
- vm: "vm-browserify",
17
- string_decoder: "string_decoder/",
18
- path: "path-browserify",
19
- process: "process/browser"
20
- }
21
- }
22
- });
8
+ return _.isFunction(bundler) ? await bundler(rspack) : bundler;
23
9
  }
24
10
  };
25
11
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/plugins/bundler.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {merge as mergeConfig} from \"webpack-merge\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:bundler\",\n bundler: async ({config, rspack}) => {\n const {bundler} = config;\n\n const userConfig = _.isFunction(bundler) ? await bundler(rspack) : bundler;\n\n return mergeConfig(userConfig, {\n resolve: {\n fallback: {\n crypto: \"crypto-browserify\",\n buffer: \"buffer/\",\n stream: \"stream-browserify\",\n vm: \"vm-browserify\",\n string_decoder: \"string_decoder/\",\n path: \"path-browserify\",\n process: \"process/browser\",\n },\n },\n });\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AACd,SAAQ,SAAS,mBAAkB;AAEnC,SAAQ,oBAAmB;AAE3B,IAAO,kBAAQ,aAAa,MAAM;AAC9B,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,OAAO,EAAC,QAAQ,OAAM,MAAM;AACjC,YAAM,EAAC,QAAO,IAAI;AAElB,YAAM,aAAa,EAAE,WAAW,OAAO,IAAI,MAAM,QAAQ,MAAM,IAAI;AAEnE,aAAO,YAAY,YAAY;AAAA,QAC3B,SAAS;AAAA,UACL,UAAU;AAAA,YACN,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,IAAI;AAAA,YACJ,gBAAgB;AAAA,YAChB,MAAM;AAAA,YACN,SAAS;AAAA,UACb;AAAA,QACJ;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AACJ,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/cli/plugins/bundler.ts"],"sourcesContent":["import _ from \"lodash\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:bundler\",\n bundler: async ({config, rspack}) => {\n const {bundler} = config;\n\n return _.isFunction(bundler) ? await bundler(rspack) : bundler;\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AAEd,SAAQ,oBAAmB;AAE3B,IAAO,kBAAQ,aAAa,MAAM;AAC9B,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,OAAO,EAAC,QAAQ,OAAM,MAAM;AACjC,YAAM,EAAC,QAAO,IAAI;AAElB,aAAO,EAAE,WAAW,OAAO,IAAI,MAAM,QAAQ,MAAM,IAAI;AAAA,IAC3D;AAAA,EACJ;AACJ,CAAC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import export_default$2 from './ContentDriver.js';
2
2
  import { ContentProvider } from './types.js';
3
- import { R as ReadonlyConfig } from '../../../config-DzmiK3GH.js';
3
+ import { R as ReadonlyConfig } from '../../../config-Ce0Le6r4.js';
4
4
  import { EntrypointFile } from '../../../types/entrypoint.js';
5
5
  import export_default$1 from '../../entrypoint/finder/ContentFinder.js';
6
6
  import { ContentScriptEntrypointOptions } from '../../../types/content.js';
@@ -19,6 +19,7 @@ import '../../../types/command.js';
19
19
  import 'utility-types';
20
20
  import '../../../types/locale.js';
21
21
  import 'react';
22
+ import '../../../types/env.js';
22
23
 
23
24
  declare class export_default extends export_default$1 implements ContentProvider<ContentScriptEntrypointOptions> {
24
25
  protected _driver?: export_default$2<ContentScriptEntrypointOptions>;
@@ -9,7 +9,7 @@ import '../../../types/browser.js';
9
9
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
10
10
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
11
11
  import '../../entrypoint/finder/AbstractFinder.js';
12
- import '../../../config-DzmiK3GH.js';
12
+ import '../../../config-Ce0Le6r4.js';
13
13
  import '@rspack/core';
14
14
  import 'html-rspack-tags-plugin';
15
15
  import '../../../types/app.js';
@@ -17,6 +17,7 @@ import '../../../types/manifest.js';
17
17
  import '../../../types/background.js';
18
18
  import '../../../types/command.js';
19
19
  import '../../../types/locale.js';
20
+ import '../../../types/env.js';
20
21
 
21
22
  declare class export_default<O extends ContentScriptEntrypointOptions> implements ContentDriver<O> {
22
23
  protected readonly finder: export_default$1<O>;
@@ -1,7 +1,7 @@
1
1
  import { ContentScriptOptions, ContentScriptEntrypointOptions } from '../../../types/content.js';
2
2
  import ContentName from './ContentName.js';
3
3
  import { ContentProvider, ContentGroupItems } from './types.js';
4
- import { R as ReadonlyConfig } from '../../../config-DzmiK3GH.js';
4
+ import { R as ReadonlyConfig } from '../../../config-Ce0Le6r4.js';
5
5
  import { EntrypointEntries, EntrypointFile } from '../../../types/entrypoint.js';
6
6
  import { ManifestContentScripts, ManifestHostPermissions } from '../../../types/manifest.js';
7
7
  import 'react';
@@ -13,6 +13,7 @@ import '@rspack/core';
13
13
  import 'html-rspack-tags-plugin';
14
14
  import '../../../types/app.js';
15
15
  import '../../../types/locale.js';
16
+ import '../../../types/env.js';
16
17
  import '../../../types/background.js';
17
18
  import '../../../types/command.js';
18
19
 
@@ -1,5 +1,5 @@
1
1
  import { ContentNameGenerator } from './types.js';
2
- import { R as ReadonlyConfig } from '../../../config-DzmiK3GH.js';
2
+ import { R as ReadonlyConfig } from '../../../config-Ce0Le6r4.js';
3
3
  import export_default from '../../entrypoint/name/NameGenerator.js';
4
4
  import { ContentScriptEntrypointOptions } from '../../../types/content.js';
5
5
  import '../../../types/entrypoint.js';
@@ -14,6 +14,7 @@ import '../../../types/manifest.js';
14
14
  import '../../../types/background.js';
15
15
  import '../../../types/command.js';
16
16
  import '../../../types/locale.js';
17
+ import '../../../types/env.js';
17
18
 
18
19
  declare class ContentName extends export_default implements ContentNameGenerator<ContentScriptEntrypointOptions> {
19
20
  protected readonly config: ReadonlyConfig;
@@ -12,7 +12,7 @@ import '../../entrypoint/finder/AbstractPluginFinder.js';
12
12
  import '../../entrypoint/finder/AbstractEntrypointFinder.js';
13
13
  import '../../entrypoint/finder/AbstractOptionsFinder.js';
14
14
  import '../../entrypoint/finder/AbstractFinder.js';
15
- import '../../../config-DzmiK3GH.js';
15
+ import '../../../config-Ce0Le6r4.js';
16
16
  import '@rspack/core';
17
17
  import 'html-rspack-tags-plugin';
18
18
  import '../../../types/app.js';
@@ -20,6 +20,7 @@ import '../../../types/manifest.js';
20
20
  import '../../../types/background.js';
21
21
  import '../../../types/command.js';
22
22
  import '../../../types/locale.js';
23
+ import '../../../types/env.js';
23
24
  import '../../entrypoint/finder/AbstractTransportFinder.js';
24
25
  import '../../entrypoint/name/InlineNameGenerator.js';
25
26
  import '../../entrypoint/name/NameGenerator.js';
@@ -1,4 +1,4 @@
1
- import { R as ReadonlyConfig } from '../../../config-DzmiK3GH.js';
1
+ import { R as ReadonlyConfig } from '../../../config-Ce0Le6r4.js';
2
2
  import export_default$1 from '../typescript/declaration/transport/TransportDeclaration.js';
3
3
  import '@rspack/core';
4
4
  import 'html-rspack-tags-plugin';
@@ -13,6 +13,7 @@ import '../../../types/helpers.js';
13
13
  import '../../../types/background.js';
14
14
  import '../../../types/command.js';
15
15
  import '../../../types/locale.js';
16
+ import '../../../types/env.js';
16
17
  import '../typescript/FileBuilder.js';
17
18
 
18
19
  declare class export_default extends export_default$1 {
@@ -1,4 +1,4 @@
1
- import { b as PluginDefinition } from '../../../config-DzmiK3GH.js';
1
+ import { b as PluginDefinition } from '../../../config-Ce0Le6r4.js';
2
2
  import '@rspack/core';
3
3
  import 'html-rspack-tags-plugin';
4
4
  import '../../../types/app.js';
@@ -12,6 +12,7 @@ import '../../../types/helpers.js';
12
12
  import '../../../types/background.js';
13
13
  import '../../../types/command.js';
14
14
  import '../../../types/locale.js';
15
+ import '../../../types/env.js';
15
16
 
16
17
  declare const _default: PluginDefinition<[]>;
17
18
 
@@ -0,0 +1,4 @@
1
+ declare const encryptData: <T = any>(data: T, key: string) => string;
2
+ declare const decryptData: <T = any>(encrypted: string, key?: string) => T;
3
+
4
+ export { decryptData, encryptData };
@@ -0,0 +1,26 @@
1
+ const encryptData = (data, key) => {
2
+ const jsonString = JSON.stringify(data);
3
+ const dataBytes = Array.from(jsonString, (c) => c.charCodeAt(0));
4
+ const keyBytes = Array.from(key, (c) => c.charCodeAt(0));
5
+ const encryptedBytes = dataBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);
6
+ const encryptedString = String.fromCharCode(...encryptedBytes);
7
+ return btoa(encryptedString);
8
+ };
9
+ const decryptData = (encrypted, key) => {
10
+ const encryptedString = atob(encrypted);
11
+ const encryptedBytes = Array.from(encryptedString, (c) => c.charCodeAt(0));
12
+ let keyBytes;
13
+ try {
14
+ keyBytes = Array.from(key || __ADNBN_ENV_CRYPTO_KEY__, (c) => c.charCodeAt(0));
15
+ } catch (err) {
16
+ throw new Error('You need to specify the "key" argument for the decryptData function.');
17
+ }
18
+ const decryptedBytes = encryptedBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);
19
+ const decryptedString = String.fromCharCode(...decryptedBytes);
20
+ return JSON.parse(decryptedString);
21
+ };
22
+ export {
23
+ decryptData,
24
+ encryptData
25
+ };
26
+ //# sourceMappingURL=crypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/cli/plugins/dotenv/crypt.ts"],"sourcesContent":["export const encryptData = <T = any>(data: T, key: string): string => {\n const jsonString = JSON.stringify(data);\n const dataBytes = Array.from(jsonString, c => c.charCodeAt(0));\n const keyBytes = Array.from(key, c => c.charCodeAt(0));\n\n const encryptedBytes = dataBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);\n const encryptedString = String.fromCharCode(...encryptedBytes);\n\n return btoa(encryptedString);\n};\n\nexport const decryptData = <T = any>(encrypted: string, key?: string): T => {\n const encryptedString = atob(encrypted);\n const encryptedBytes = Array.from(encryptedString, c => c.charCodeAt(0));\n let keyBytes: any[];\n try {\n //@ts-expect-error: __ADNBN_ENV_CRYPTO_KEY__ is a virtual variable generated by the bundler `src/cli/plugins/dotenv/index.ts`\n keyBytes = Array.from(key || __ADNBN_ENV_CRYPTO_KEY__, c => c.charCodeAt(0));\n } catch (err) {\n throw new Error('You need to specify the \"key\" argument for the decryptData function.');\n }\n\n const decryptedBytes = encryptedBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);\n const decryptedString = String.fromCharCode(...decryptedBytes);\n\n return JSON.parse(decryptedString);\n};\n"],"mappings":"AAAO,MAAM,cAAc,CAAU,MAAS,QAAwB;AAClE,QAAM,aAAa,KAAK,UAAU,IAAI;AACtC,QAAM,YAAY,MAAM,KAAK,YAAY,OAAK,EAAE,WAAW,CAAC,CAAC;AAC7D,QAAM,WAAW,MAAM,KAAK,KAAK,OAAK,EAAE,WAAW,CAAC,CAAC;AAErD,QAAM,iBAAiB,UAAU,IAAI,CAAC,MAAM,MAAM,OAAO,SAAS,IAAI,SAAS,MAAM,CAAC;AACtF,QAAM,kBAAkB,OAAO,aAAa,GAAG,cAAc;AAE7D,SAAO,KAAK,eAAe;AAC/B;AAEO,MAAM,cAAc,CAAU,WAAmB,QAAoB;AACxE,QAAM,kBAAkB,KAAK,SAAS;AACtC,QAAM,iBAAiB,MAAM,KAAK,iBAAiB,OAAK,EAAE,WAAW,CAAC,CAAC;AACvE,MAAI;AACJ,MAAI;AAEA,eAAW,MAAM,KAAK,OAAO,0BAA0B,OAAK,EAAE,WAAW,CAAC,CAAC;AAAA,EAC/E,SAAS,KAAK;AACV,UAAM,IAAI,MAAM,sEAAsE;AAAA,EAC1F;AAEA,QAAM,iBAAiB,eAAe,IAAI,CAAC,MAAM,MAAM,OAAO,SAAS,IAAI,SAAS,MAAM,CAAC;AAC3F,QAAM,kBAAkB,OAAO,aAAa,GAAG,cAAc;AAE7D,SAAO,KAAK,MAAM,eAAe;AACrC;","names":[]}
@@ -1,4 +1,4 @@
1
- import { b as PluginDefinition } from '../../../config-DzmiK3GH.js';
1
+ import { b as PluginDefinition } from '../../../config-Ce0Le6r4.js';
2
2
  import { DotenvParseOutput } from 'dotenv';
3
3
  import '@rspack/core';
4
4
  import 'html-rspack-tags-plugin';
@@ -13,6 +13,7 @@ import '../../../types/helpers.js';
13
13
  import '../../../types/background.js';
14
14
  import '../../../types/command.js';
15
15
  import '../../../types/locale.js';
16
+ import '../../../types/env.js';
16
17
 
17
18
  declare const _default: PluginDefinition<[vars?: DotenvParseOutput | undefined]>;
18
19
 
@@ -1,21 +1,18 @@
1
- import _ from "lodash";
1
+ import { createHash } from "crypto";
2
2
  import { DefinePlugin } from "@rspack/core";
3
3
  import { definePlugin } from "./../../../main/plugin.js";
4
- import { encryptData, generateCryptoKey } from "./utils.js";
5
- const ReservedEnvKeys = /* @__PURE__ */ new Set(["APP", "BROWSER", "MODE", "MANIFEST_VERSION"]);
4
+ import { encryptData } from "./crypt.js";
5
+ import { filterEnvVars, resolveEnvOptions } from "./utils.js";
6
+ const generateKey = (value) => {
7
+ return createHash("sha256").update(value).digest("base64");
8
+ };
6
9
  var dotenv_default = definePlugin((vars = {}) => {
7
10
  return {
8
11
  name: "adnbn:dotenv",
9
12
  bundler: ({ config }) => {
10
- const { filter, crypt } = config.env;
11
- const filteredVars = !filter ? vars : Object.fromEntries(
12
- Object.entries(vars).filter(([key2]) => {
13
- if (ReservedEnvKeys.has(key2) || _.isFunction(filter) && filter(key2) || _.isString(filter) && filter.trim() && key2.startsWith(filter.trim())) {
14
- return true;
15
- }
16
- })
17
- );
18
- const key = generateCryptoKey([config.app, ...Object.keys(filteredVars)].join("-"));
13
+ const { filter, crypt } = resolveEnvOptions(config.env);
14
+ const filteredVars = filterEnvVars(vars, filter);
15
+ const key = generateKey([config.app, ...Object.keys(filteredVars)].join("-"));
19
16
  const data = crypt ? encryptData(filteredVars, key) : filteredVars;
20
17
  return {
21
18
  plugins: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/plugins/dotenv/index.ts"],"sourcesContent":["import _ from \"lodash\";\n\nimport {DefinePlugin} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {encryptData, generateCryptoKey} from \"./utils\";\n\nimport {type DotenvParseOutput} from \"dotenv\";\n\nconst ReservedEnvKeys = new Set<string>([\"APP\", \"BROWSER\", \"MODE\", \"MANIFEST_VERSION\"]);\n\nexport default definePlugin((vars: DotenvParseOutput = {}) => {\n return {\n name: \"adnbn:dotenv\",\n bundler: ({config}) => {\n const {filter, crypt} = config.env;\n\n const filteredVars = !filter\n ? vars\n : Object.fromEntries(\n Object.entries(vars).filter(([key]) => {\n if (\n ReservedEnvKeys.has(key) ||\n (_.isFunction(filter) && filter(key)) ||\n (_.isString(filter) && filter.trim() && key.startsWith(filter.trim()))\n ) {\n return true;\n }\n })\n );\n\n const key = generateCryptoKey([config.app, ...Object.keys(filteredVars)].join(\"-\"));\n\n const data = crypt ? encryptData(filteredVars, key) : filteredVars;\n\n return {\n plugins: [\n new DefinePlugin({\n __ADNBN_ENV_CRYPTO_KEY__: JSON.stringify(key),\n \"process.env\": JSON.stringify(data),\n }),\n ],\n };\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AAEd,SAAQ,oBAAmB;AAE3B,SAAQ,oBAAmB;AAE3B,SAAQ,aAAa,yBAAwB;AAI7C,MAAM,kBAAkB,oBAAI,IAAY,CAAC,OAAO,WAAW,QAAQ,kBAAkB,CAAC;AAEtF,IAAO,iBAAQ,aAAa,CAAC,OAA0B,CAAC,MAAM;AAC1D,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,YAAM,EAAC,QAAQ,MAAK,IAAI,OAAO;AAE/B,YAAM,eAAe,CAAC,SAChB,OACA,OAAO;AAAA,QACH,OAAO,QAAQ,IAAI,EAAE,OAAO,CAAC,CAACA,IAAG,MAAM;AACnC,cACI,gBAAgB,IAAIA,IAAG,KACtB,EAAE,WAAW,MAAM,KAAK,OAAOA,IAAG,KAClC,EAAE,SAAS,MAAM,KAAK,OAAO,KAAK,KAAKA,KAAI,WAAW,OAAO,KAAK,CAAC,GACtE;AACE,mBAAO;AAAA,UACX;AAAA,QACJ,CAAC;AAAA,MACL;AAEN,YAAM,MAAM,kBAAkB,CAAC,OAAO,KAAK,GAAG,OAAO,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG,CAAC;AAElF,YAAM,OAAO,QAAQ,YAAY,cAAc,GAAG,IAAI;AAEtD,aAAO;AAAA,QACH,SAAS;AAAA,UACL,IAAI,aAAa;AAAA,YACb,0BAA0B,KAAK,UAAU,GAAG;AAAA,YAC5C,eAAe,KAAK,UAAU,IAAI;AAAA,UACtC,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":["key"]}
1
+ {"version":3,"sources":["../../../../src/cli/plugins/dotenv/index.ts"],"sourcesContent":["import {createHash} from \"crypto\";\nimport {DefinePlugin} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {encryptData} from \"./crypt\";\nimport {filterEnvVars, resolveEnvOptions} from \"./utils\";\n\nimport {type DotenvParseOutput} from \"dotenv\";\n\nconst generateKey = (value: string): string => {\n return createHash(\"sha256\").update(value).digest(\"base64\");\n};\n\nexport default definePlugin((vars: DotenvParseOutput = {}) => {\n return {\n name: \"adnbn:dotenv\",\n bundler: ({config}) => {\n const {filter, crypt} = resolveEnvOptions(config.env);\n\n const filteredVars = filterEnvVars(vars, filter);\n\n const key = generateKey([config.app, ...Object.keys(filteredVars)].join(\"-\"));\n\n const data = crypt ? encryptData(filteredVars, key) : filteredVars;\n\n return {\n plugins: [\n new DefinePlugin({\n __ADNBN_ENV_CRYPTO_KEY__: JSON.stringify(key),\n \"process.env\": JSON.stringify(data),\n }),\n ],\n };\n },\n };\n});\n"],"mappings":"AAAA,SAAQ,kBAAiB;AACzB,SAAQ,oBAAmB;AAE3B,SAAQ,oBAAmB;AAE3B,SAAQ,mBAAkB;AAC1B,SAAQ,eAAe,yBAAwB;AAI/C,MAAM,cAAc,CAAC,UAA0B;AAC3C,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,QAAQ;AAC7D;AAEA,IAAO,iBAAQ,aAAa,CAAC,OAA0B,CAAC,MAAM;AAC1D,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,YAAM,EAAC,QAAQ,MAAK,IAAI,kBAAkB,OAAO,GAAG;AAEpD,YAAM,eAAe,cAAc,MAAM,MAAM;AAE/C,YAAM,MAAM,YAAY,CAAC,OAAO,KAAK,GAAG,OAAO,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG,CAAC;AAE5E,YAAM,OAAO,QAAQ,YAAY,cAAc,GAAG,IAAI;AAEtD,aAAO;AAAA,QACH,SAAS;AAAA,UACL,IAAI,aAAa;AAAA,YACb,0BAA0B,KAAK,UAAU,GAAG;AAAA,YAC5C,eAAe,KAAK,UAAU,IAAI;AAAA,UACtC,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":[]}
@@ -1,5 +1,10 @@
1
- declare const generateCryptoKey: (password: string) => string;
2
- declare const encryptData: <T = any>(data: T, key: string) => string;
3
- declare const decryptData: <T = any>(encrypted: string, key?: string) => T;
1
+ import { EnvFilterVariant, EnvFilterOptions, EnvFilterFunction } from '../../../types/env.js';
4
2
 
5
- export { decryptData, encryptData, generateCryptoKey };
3
+ type EnvOption = EnvFilterVariant | Partial<EnvFilterOptions>;
4
+ declare const resolveEnvOptions: (option?: EnvOption) => {
5
+ filter: EnvFilterFunction;
6
+ crypt: boolean;
7
+ };
8
+ declare const filterEnvVars: <T extends Record<string, any>>(vars: T, filter: EnvFilterFunction) => Partial<T>;
9
+
10
+ export { type EnvOption, filterEnvVars, resolveEnvOptions };
@@ -1,31 +1,36 @@
1
- import { createHash } from "crypto";
2
- const generateCryptoKey = (password) => {
3
- return createHash("sha256").update(password).digest("base64");
4
- };
5
- const encryptData = (data, key) => {
6
- const jsonString = JSON.stringify(data);
7
- const dataBytes = Array.from(jsonString, (c) => c.charCodeAt(0));
8
- const keyBytes = Array.from(key, (c) => c.charCodeAt(0));
9
- const encryptedBytes = dataBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);
10
- const encryptedString = String.fromCharCode(...encryptedBytes);
11
- return btoa(encryptedString);
12
- };
13
- const decryptData = (encrypted, key) => {
14
- const encryptedString = atob(encrypted);
15
- const encryptedBytes = Array.from(encryptedString, (c) => c.charCodeAt(0));
16
- let keyBytes;
17
- try {
18
- keyBytes = Array.from(key || __ADNBN_ENV_CRYPTO_KEY__, (c) => c.charCodeAt(0));
19
- } catch (err) {
20
- throw new Error('You need to specify the "key" argument for the decryptData function.');
1
+ import _ from "lodash";
2
+ import { ReservedEnvKeys } from "./../../../types/env.js";
3
+ const resolveEnvOptions = (option) => {
4
+ let userFilter;
5
+ let crypt = false;
6
+ if (_.isString(option)) {
7
+ userFilter = option;
8
+ } else if (_.isFunction(option)) {
9
+ userFilter = option;
10
+ } else if (option && _.isObject(option)) {
11
+ const { filter: f, crypt: c } = option;
12
+ userFilter = f;
13
+ crypt = Boolean(c);
21
14
  }
22
- const decryptedBytes = encryptedBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);
23
- const decryptedString = String.fromCharCode(...decryptedBytes);
24
- return JSON.parse(decryptedString);
15
+ const filter = (key) => {
16
+ if (ReservedEnvKeys.has(key)) {
17
+ return true;
18
+ }
19
+ if (_.isFunction(userFilter)) {
20
+ return userFilter(key);
21
+ }
22
+ if (_.isString(userFilter)) {
23
+ return key.startsWith(userFilter.trim());
24
+ }
25
+ return true;
26
+ };
27
+ return { filter, crypt };
28
+ };
29
+ const filterEnvVars = (vars, filter) => {
30
+ return Object.fromEntries(Object.entries(vars).filter(([key]) => filter(key)));
25
31
  };
26
32
  export {
27
- decryptData,
28
- encryptData,
29
- generateCryptoKey
33
+ filterEnvVars,
34
+ resolveEnvOptions
30
35
  };
31
36
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/plugins/dotenv/utils.ts"],"sourcesContent":["import {createHash} from \"crypto\";\n\nexport const generateCryptoKey = (password: string): string => {\n return createHash(\"sha256\").update(password).digest(\"base64\");\n};\n\nexport const encryptData = <T = any>(data: T, key: string): string => {\n const jsonString = JSON.stringify(data);\n const dataBytes = Array.from(jsonString, c => c.charCodeAt(0));\n const keyBytes = Array.from(key, c => c.charCodeAt(0));\n\n const encryptedBytes = dataBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);\n const encryptedString = String.fromCharCode(...encryptedBytes);\n\n return btoa(encryptedString);\n};\n\nexport const decryptData = <T = any>(encrypted: string, key?: string): T => {\n const encryptedString = atob(encrypted);\n const encryptedBytes = Array.from(encryptedString, c => c.charCodeAt(0));\n let keyBytes: any[];\n try {\n //@ts-expect-error: __ADNBN_ENV_CRYPTO_KEY__ is a virtual variable generated by the bundler `src/cli/plugins/dotenv/index.ts`\n keyBytes = Array.from(key || __ADNBN_ENV_CRYPTO_KEY__, c => c.charCodeAt(0));\n } catch (err) {\n throw new Error('You need to specify the \"key\" argument for the decryptData function.');\n }\n\n const decryptedBytes = encryptedBytes.map((byte, i) => byte ^ keyBytes[i % keyBytes.length]);\n const decryptedString = String.fromCharCode(...decryptedBytes);\n\n return JSON.parse(decryptedString);\n};\n"],"mappings":"AAAA,SAAQ,kBAAiB;AAElB,MAAM,oBAAoB,CAAC,aAA6B;AAC3D,SAAO,WAAW,QAAQ,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ;AAChE;AAEO,MAAM,cAAc,CAAU,MAAS,QAAwB;AAClE,QAAM,aAAa,KAAK,UAAU,IAAI;AACtC,QAAM,YAAY,MAAM,KAAK,YAAY,OAAK,EAAE,WAAW,CAAC,CAAC;AAC7D,QAAM,WAAW,MAAM,KAAK,KAAK,OAAK,EAAE,WAAW,CAAC,CAAC;AAErD,QAAM,iBAAiB,UAAU,IAAI,CAAC,MAAM,MAAM,OAAO,SAAS,IAAI,SAAS,MAAM,CAAC;AACtF,QAAM,kBAAkB,OAAO,aAAa,GAAG,cAAc;AAE7D,SAAO,KAAK,eAAe;AAC/B;AAEO,MAAM,cAAc,CAAU,WAAmB,QAAoB;AACxE,QAAM,kBAAkB,KAAK,SAAS;AACtC,QAAM,iBAAiB,MAAM,KAAK,iBAAiB,OAAK,EAAE,WAAW,CAAC,CAAC;AACvE,MAAI;AACJ,MAAI;AAEA,eAAW,MAAM,KAAK,OAAO,0BAA0B,OAAK,EAAE,WAAW,CAAC,CAAC;AAAA,EAC/E,SAAS,KAAK;AACV,UAAM,IAAI,MAAM,sEAAsE;AAAA,EAC1F;AAEA,QAAM,iBAAiB,eAAe,IAAI,CAAC,MAAM,MAAM,OAAO,SAAS,IAAI,SAAS,MAAM,CAAC;AAC3F,QAAM,kBAAkB,OAAO,aAAa,GAAG,cAAc;AAE7D,SAAO,KAAK,MAAM,eAAe;AACrC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/plugins/dotenv/utils.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {EnvFilterFunction, EnvFilterOptions, EnvFilterVariant, ReservedEnvKeys} from \"@typing/env\";\n\nexport type EnvOption = EnvFilterVariant | Partial<EnvFilterOptions>;\n\nexport const resolveEnvOptions = (option?: EnvOption): {filter: EnvFilterFunction; crypt: boolean} => {\n let userFilter: EnvFilterVariant | undefined;\n let crypt: boolean = false;\n\n if (_.isString(option)) {\n userFilter = option;\n } else if (_.isFunction(option)) {\n userFilter = option;\n } else if (option && _.isObject(option)) {\n const {filter: f, crypt: c} = option as Partial<EnvFilterOptions>;\n\n userFilter = f;\n crypt = Boolean(c);\n }\n\n const filter = (key: string): boolean => {\n if (ReservedEnvKeys.has(key)) {\n return true;\n }\n\n if (_.isFunction(userFilter)) {\n return userFilter(key);\n }\n\n if (_.isString(userFilter)) {\n return key.startsWith(userFilter.trim());\n }\n\n return true;\n };\n\n return {filter, crypt};\n};\n\nexport const filterEnvVars = <T extends Record<string, any>>(vars: T, filter: EnvFilterFunction): Partial<T> => {\n return Object.fromEntries(Object.entries(vars).filter(([key]) => filter(key))) as Partial<T>;\n};\n"],"mappings":"AAAA,OAAO,OAAO;AACd,SAA+D,uBAAsB;AAI9E,MAAM,oBAAoB,CAAC,WAAoE;AAClG,MAAI;AACJ,MAAI,QAAiB;AAErB,MAAI,EAAE,SAAS,MAAM,GAAG;AACpB,iBAAa;AAAA,EACjB,WAAW,EAAE,WAAW,MAAM,GAAG;AAC7B,iBAAa;AAAA,EACjB,WAAW,UAAU,EAAE,SAAS,MAAM,GAAG;AACrC,UAAM,EAAC,QAAQ,GAAG,OAAO,EAAC,IAAI;AAE9B,iBAAa;AACb,YAAQ,QAAQ,CAAC;AAAA,EACrB;AAEA,QAAM,SAAS,CAAC,QAAyB;AACrC,QAAI,gBAAgB,IAAI,GAAG,GAAG;AAC1B,aAAO;AAAA,IACX;AAEA,QAAI,EAAE,WAAW,UAAU,GAAG;AAC1B,aAAO,WAAW,GAAG;AAAA,IACzB;AAEA,QAAI,EAAE,SAAS,UAAU,GAAG;AACxB,aAAO,IAAI,WAAW,WAAW,KAAK,CAAC;AAAA,IAC3C;AAEA,WAAO;AAAA,EACX;AAEA,SAAO,EAAC,QAAQ,MAAK;AACzB;AAEO,MAAM,gBAAgB,CAAgC,MAAS,WAA0C;AAC5G,SAAO,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,OAAO,GAAG,CAAC,CAAC;AACjF;","names":[]}
@@ -1,4 +1,4 @@
1
- import { b as PluginDefinition } from '../../config-DzmiK3GH.js';
1
+ import { b as PluginDefinition } from '../../config-Ce0Le6r4.js';
2
2
  import '@rspack/core';
3
3
  import 'html-rspack-tags-plugin';
4
4
  import '../../types/app.js';
@@ -12,6 +12,7 @@ import '../../types/helpers.js';
12
12
  import '../../types/background.js';
13
13
  import '../../types/command.js';
14
14
  import '../../types/locale.js';
15
+ import '../../types/env.js';
15
16
 
16
17
  declare const _default: PluginDefinition<[]>;
17
18
 
@@ -12,10 +12,11 @@ import '../../../types/command.js';
12
12
  import '../../../types/locale.js';
13
13
  import '../../entrypoint/finder/AbstractAssetFinder.js';
14
14
  import '../../entrypoint/finder/AbstractFinder.js';
15
- import '../../../config-DzmiK3GH.js';
15
+ import '../../../config-Ce0Le6r4.js';
16
16
  import '@rspack/core';
17
17
  import 'html-rspack-tags-plugin';
18
18
  import '../../../types/app.js';
19
+ import '../../../types/env.js';
19
20
  import '../../entrypoint/finder/AssetPluginFinder.js';
20
21
 
21
22
  type CopyPatterns = Array<Pick<RawCopyPattern, "from" | "to">>;
@@ -3,7 +3,7 @@ import { IconFinder } from "./../../../cli/entrypoint/index.js";
3
3
  import { DefaultIconGroupName } from "./../../../types/icon.js";
4
4
  class Icon_default extends IconFinder {
5
5
  createPathname(item) {
6
- const dir = this.config.icon.outputDir || "icons";
6
+ const dir = this.config.iconOutDir;
7
7
  let { size, group } = item.name;
8
8
  group = group === DefaultIconGroupName ? "" : group + "-";
9
9
  return path.posix.join(dir, `${group}${size}.png`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/plugins/icon/Icon.ts"],"sourcesContent":["import path from \"path\";\nimport type {RawCopyPattern} from \"@rspack/binding\";\n\nimport {IconFinder, type IconItem} from \"@cli/entrypoint/index.js\";\nimport {ManifestIcon, ManifestIcons} from \"@typing/manifest\";\nimport {DefaultIconGroupName} from \"@typing/icon\";\n\nexport type CopyPatterns = Array<Pick<RawCopyPattern, \"from\" | \"to\">>;\n\nexport type IconDefinition = Record<string, Record<number, string>>;\n\nexport default class extends IconFinder {\n protected createPathname(item: IconItem): string {\n const dir = this.config.icon.outputDir || \"icons\";\n\n let {size, group} = item.name;\n\n group = group === DefaultIconGroupName ? \"\" : group + \"-\";\n\n return path.posix.join(dir, `${group}${size}.png`);\n }\n\n public async manifest(): Promise<ManifestIcons> {\n const icons = await this.icons();\n\n const manifest: ManifestIcons = new Map();\n\n for (const [group, items] of icons) {\n const collect: ManifestIcon = new Map();\n\n for (const [size, item] of items) {\n collect.set(size, \"/\" + this.createPathname(item));\n }\n\n manifest.set(group, collect);\n }\n\n return manifest;\n }\n\n public async copy(): Promise<CopyPatterns> {\n const icons = await this.icons();\n\n const patterns: CopyPatterns = [];\n\n for (const items of icons.values()) {\n for (const item of items.values()) {\n patterns.push({\n from: item.file.file,\n to: this.createPathname(item),\n });\n }\n }\n\n return patterns;\n }\n\n public async define(): Promise<IconDefinition> {\n const mapToJson = (map: Map<any, any>) => {\n return Object.fromEntries(\n Array.from(map.entries()).map(([key, value]) => [key, value instanceof Map ? mapToJson(value) : value])\n );\n };\n\n return mapToJson(await this.manifest());\n }\n\n public async names(): Promise<Set<string>> {\n const files = await this.icons();\n\n return new Set(files.keys());\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AAGjB,SAAQ,kBAAgC;AAExC,SAAQ,4BAA2B;AAMnC,MAAO,qBAAsB,WAAW;AAAA,EAC1B,eAAe,MAAwB;AAC7C,UAAM,MAAM,KAAK,OAAO,KAAK,aAAa;AAE1C,QAAI,EAAC,MAAM,MAAK,IAAI,KAAK;AAEzB,YAAQ,UAAU,uBAAuB,KAAK,QAAQ;AAEtD,WAAO,KAAK,MAAM,KAAK,KAAK,GAAG,KAAK,GAAG,IAAI,MAAM;AAAA,EACrD;AAAA,EAEA,MAAa,WAAmC;AAC5C,UAAM,QAAQ,MAAM,KAAK,MAAM;AAE/B,UAAM,WAA0B,oBAAI,IAAI;AAExC,eAAW,CAAC,OAAO,KAAK,KAAK,OAAO;AAChC,YAAM,UAAwB,oBAAI,IAAI;AAEtC,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO;AAC9B,gBAAQ,IAAI,MAAM,MAAM,KAAK,eAAe,IAAI,CAAC;AAAA,MACrD;AAEA,eAAS,IAAI,OAAO,OAAO;AAAA,IAC/B;AAEA,WAAO;AAAA,EACX;AAAA,EAEA,MAAa,OAA8B;AACvC,UAAM,QAAQ,MAAM,KAAK,MAAM;AAE/B,UAAM,WAAyB,CAAC;AAEhC,eAAW,SAAS,MAAM,OAAO,GAAG;AAChC,iBAAW,QAAQ,MAAM,OAAO,GAAG;AAC/B,iBAAS,KAAK;AAAA,UACV,MAAM,KAAK,KAAK;AAAA,UAChB,IAAI,KAAK,eAAe,IAAI;AAAA,QAChC,CAAC;AAAA,MACL;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA,EAEA,MAAa,SAAkC;AAC3C,UAAM,YAAY,CAAC,QAAuB;AACtC,aAAO,OAAO;AAAA,QACV,MAAM,KAAK,IAAI,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,iBAAiB,MAAM,UAAU,KAAK,IAAI,KAAK,CAAC;AAAA,MAC1G;AAAA,IACJ;AAEA,WAAO,UAAU,MAAM,KAAK,SAAS,CAAC;AAAA,EAC1C;AAAA,EAEA,MAAa,QAA8B;AACvC,UAAM,QAAQ,MAAM,KAAK,MAAM;AAE/B,WAAO,IAAI,IAAI,MAAM,KAAK,CAAC;AAAA,EAC/B;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/plugins/icon/Icon.ts"],"sourcesContent":["import path from \"path\";\nimport type {RawCopyPattern} from \"@rspack/binding\";\n\nimport {IconFinder, type IconItem} from \"@cli/entrypoint/index.js\";\nimport {ManifestIcon, ManifestIcons} from \"@typing/manifest\";\nimport {DefaultIconGroupName} from \"@typing/icon\";\n\nexport type CopyPatterns = Array<Pick<RawCopyPattern, \"from\" | \"to\">>;\n\nexport type IconDefinition = Record<string, Record<number, string>>;\n\nexport default class extends IconFinder {\n protected createPathname(item: IconItem): string {\n const dir = this.config.iconOutDir;\n\n let {size, group} = item.name;\n\n group = group === DefaultIconGroupName ? \"\" : group + \"-\";\n\n return path.posix.join(dir, `${group}${size}.png`);\n }\n\n public async manifest(): Promise<ManifestIcons> {\n const icons = await this.icons();\n\n const manifest: ManifestIcons = new Map();\n\n for (const [group, items] of icons) {\n const collect: ManifestIcon = new Map();\n\n for (const [size, item] of items) {\n collect.set(size, \"/\" + this.createPathname(item));\n }\n\n manifest.set(group, collect);\n }\n\n return manifest;\n }\n\n public async copy(): Promise<CopyPatterns> {\n const icons = await this.icons();\n\n const patterns: CopyPatterns = [];\n\n for (const items of icons.values()) {\n for (const item of items.values()) {\n patterns.push({\n from: item.file.file,\n to: this.createPathname(item),\n });\n }\n }\n\n return patterns;\n }\n\n public async define(): Promise<IconDefinition> {\n const mapToJson = (map: Map<any, any>) => {\n return Object.fromEntries(\n Array.from(map.entries()).map(([key, value]) => [key, value instanceof Map ? mapToJson(value) : value])\n );\n };\n\n return mapToJson(await this.manifest());\n }\n\n public async names(): Promise<Set<string>> {\n const files = await this.icons();\n\n return new Set(files.keys());\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AAGjB,SAAQ,kBAAgC;AAExC,SAAQ,4BAA2B;AAMnC,MAAO,qBAAsB,WAAW;AAAA,EAC1B,eAAe,MAAwB;AAC7C,UAAM,MAAM,KAAK,OAAO;AAExB,QAAI,EAAC,MAAM,MAAK,IAAI,KAAK;AAEzB,YAAQ,UAAU,uBAAuB,KAAK,QAAQ;AAEtD,WAAO,KAAK,MAAM,KAAK,KAAK,GAAG,KAAK,GAAG,IAAI,MAAM;AAAA,EACrD;AAAA,EAEA,MAAa,WAAmC;AAC5C,UAAM,QAAQ,MAAM,KAAK,MAAM;AAE/B,UAAM,WAA0B,oBAAI,IAAI;AAExC,eAAW,CAAC,OAAO,KAAK,KAAK,OAAO;AAChC,YAAM,UAAwB,oBAAI,IAAI;AAEtC,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO;AAC9B,gBAAQ,IAAI,MAAM,MAAM,KAAK,eAAe,IAAI,CAAC;AAAA,MACrD;AAEA,eAAS,IAAI,OAAO,OAAO;AAAA,IAC/B;AAEA,WAAO;AAAA,EACX;AAAA,EAEA,MAAa,OAA8B;AACvC,UAAM,QAAQ,MAAM,KAAK,MAAM;AAE/B,UAAM,WAAyB,CAAC;AAEhC,eAAW,SAAS,MAAM,OAAO,GAAG;AAChC,iBAAW,QAAQ,MAAM,OAAO,GAAG;AAC/B,iBAAS,KAAK;AAAA,UACV,MAAM,KAAK,KAAK;AAAA,UAChB,IAAI,KAAK,eAAe,IAAI;AAAA,QAChC,CAAC;AAAA,MACL;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA,EAEA,MAAa,SAAkC;AAC3C,UAAM,YAAY,CAAC,QAAuB;AACtC,aAAO,OAAO;AAAA,QACV,MAAM,KAAK,IAAI,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,iBAAiB,MAAM,UAAU,KAAK,IAAI,KAAK,CAAC;AAAA,MAC1G;AAAA,IACJ;AAEA,WAAO,UAAU,MAAM,KAAK,SAAS,CAAC;AAAA,EAC1C;AAAA,EAEA,MAAa,QAA8B;AACvC,UAAM,QAAQ,MAAM,KAAK,MAAM;AAE/B,WAAO,IAAI,IAAI,MAAM,KAAK,CAAC;AAAA,EAC/B;AACJ;","names":[]}