crx-monkey-next 0.0.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.
Files changed (94) hide show
  1. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/api.d.ts +3 -0
  2. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/api.js +4 -0
  3. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/api.js.map +1 -0
  4. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/i18n.d.ts +17 -0
  5. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/i18n.js +38 -0
  6. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/i18n.js.map +1 -0
  7. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/main.d.ts +16 -0
  8. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/main.js +8 -0
  9. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/main.js.map +1 -0
  10. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/message.d.ts +30 -0
  11. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/message.js +75 -0
  12. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/message.js.map +1 -0
  13. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/runtime.d.ts +43 -0
  14. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/runtime.js +89 -0
  15. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/client/runtime.js.map +1 -0
  16. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/node/plugins/tsBundler.d.ts +28 -0
  17. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/node/plugins/tsBundler.js +151 -0
  18. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/node/plugins/tsBundler.js.map +1 -0
  19. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/node/typeDefs.d.ts +200 -0
  20. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/node/typeDefs.js +2 -0
  21. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/src/node/typeDefs.js.map +1 -0
  22. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/dist/client/tsconfig.client.tsbuildinfo +1 -0
  23. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/api.d.ts +3 -0
  24. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/api.js +4 -0
  25. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/api.js.map +1 -0
  26. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/i18n.d.ts +17 -0
  27. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/i18n.js +38 -0
  28. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/i18n.js.map +1 -0
  29. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/main.d.ts +17 -0
  30. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/main.js +9 -0
  31. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/main.js.map +1 -0
  32. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/message.d.ts +30 -0
  33. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/message.js +75 -0
  34. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/message.js.map +1 -0
  35. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/runtime.d.ts +32 -0
  36. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/runtime.js +58 -0
  37. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/client/runtime.js.map +1 -0
  38. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/node/typeDefs.d.ts +189 -0
  39. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/node/typeDefs.js +2 -0
  40. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/src/node/typeDefs.js.map +1 -0
  41. package/.rollup.cache/home/yakisova41/crx-monkey-next/packages/crx-monkey/tsconfig.client.tsbuildinfo +1 -0
  42. package/README.md +34 -0
  43. package/bin/crx-monkey +2 -0
  44. package/bun.lockb +0 -0
  45. package/dist/client/main.d.ts +187 -0
  46. package/dist/client/main.js +200 -0
  47. package/dist/client/tsconfig.client.tsbuildinfo +1 -0
  48. package/dist/node/exports.d.ts +213 -0
  49. package/dist/node/exports.js +650 -0
  50. package/dist/node/main.js +2759 -0
  51. package/jest.config.js +17 -0
  52. package/package.json +81 -0
  53. package/rollup.config.js +101 -0
  54. package/src/client/i18n.ts +42 -0
  55. package/src/client/main.ts +20 -0
  56. package/src/client/message.ts +118 -0
  57. package/src/client/runtime.ts +109 -0
  58. package/src/node/BundlerRegisterer.ts +311 -0
  59. package/src/node/ConfigLoader.ts +127 -0
  60. package/src/node/CrxmBundler.ts +213 -0
  61. package/src/node/Distributior.ts +295 -0
  62. package/src/node/Logger.ts +77 -0
  63. package/src/node/Watcher.ts +166 -0
  64. package/src/node/__tests__/config.test.ts +157 -0
  65. package/src/node/__tests__/manifest.test.ts +380 -0
  66. package/src/node/build.ts +64 -0
  67. package/src/node/dev.ts +146 -0
  68. package/src/node/development/CreateDevClient.ts +168 -0
  69. package/src/node/development/codes/extension.ts +187 -0
  70. package/src/node/development/codes/sw.ts +41 -0
  71. package/src/node/development/codes/userjs.ts +150 -0
  72. package/src/node/exports.ts +135 -0
  73. package/src/node/file.ts +45 -0
  74. package/src/node/inversify.config.ts +53 -0
  75. package/src/node/main.ts +34 -0
  76. package/src/node/manifest/ManifestFactory.ts +165 -0
  77. package/src/node/manifest/ManifestLoader.ts +71 -0
  78. package/src/node/manifest/ManifestParser.ts +191 -0
  79. package/src/node/manifest/i18n.ts +93 -0
  80. package/src/node/plugins/htmlBundler/HTMLTools.ts +332 -0
  81. package/src/node/plugins/htmlBundler/main.ts +140 -0
  82. package/src/node/plugins/sassBundler.ts +59 -0
  83. package/src/node/plugins/tsBundler.ts +197 -0
  84. package/src/node/server/FileServer.ts +97 -0
  85. package/src/node/server/SockServer.ts +143 -0
  86. package/src/node/typeDefs.ts +221 -0
  87. package/src/node/types.ts +24 -0
  88. package/src/node/userscript/CodeInjector.ts +164 -0
  89. package/src/node/userscript/UserscriptBundler.ts +138 -0
  90. package/src/node/userscript/UserscriptHeader.ts +76 -0
  91. package/src/node/userscript/UserscriptRegisterer.ts +204 -0
  92. package/src/node/utils.ts +25 -0
  93. package/tsconfig.client.json +20 -0
  94. package/tsconfig.json +24 -0
@@ -0,0 +1,189 @@
1
+ /**
2
+ * The config for crx monkey.
3
+ */
4
+ export interface CrxmConfig {
5
+ output?: {
6
+ /**
7
+ * Directory of outputs.
8
+ */
9
+ chrome?: string;
10
+ /**
11
+ * The path containing the filename of the output userscript.
12
+ */
13
+ userjs?: string;
14
+ };
15
+ /**
16
+ * The path of manifest.
17
+ */
18
+ manifest?: string;
19
+ /**
20
+ * Server settings.
21
+ */
22
+ server?: {
23
+ /**
24
+ * The port of file server.
25
+ */
26
+ port?: number;
27
+ /**
28
+ * The hostname using by file server and sockserver.
29
+ */
30
+ host?: string;
31
+ /**
32
+ * The port of websocket
33
+ */
34
+ websocket?: number;
35
+ /**
36
+ * Disable websocket for reloading in userscript
37
+ */
38
+ disable_sock_in_userjs?: boolean;
39
+ };
40
+ /**
41
+ * Additional Userscript header
42
+ */
43
+ header?: UserScriptHeader;
44
+ /**
45
+ * Setting build plugin for any file
46
+ * `Record<File regular expression, Bundler plugin>`
47
+ */
48
+ build?: Record<string, CrxmBundlerPlugin>;
49
+ /**
50
+ * Setting watch plugin for any file
51
+ * `Record<File regular expression, Bundler plugin>`
52
+ */
53
+ watch?: Record<string, CrxmBundlerPluginWatch>;
54
+ /**
55
+ * The log level.
56
+ * * `info` Show only infomations.
57
+ * * `error` Show infomations and errors.
58
+ * * `debug` Show all logs dispatched.
59
+ */
60
+ logLevel?: 'info' | 'error' | 'debug';
61
+ /**
62
+ * A directory copied as it is to `/public` in dist.
63
+ */
64
+ public: string | undefined;
65
+ }
66
+ type DeepRequired<T> = {
67
+ [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : T[P];
68
+ };
69
+ export type CrxmConfigRequired = DeepRequired<CrxmConfig>;
70
+ export type UserScriptHeader = Array<[keyof UserScriptHeaderProps, string]>;
71
+ export interface UserScriptHeaderProps {
72
+ '@name': string;
73
+ '@namespace'?: string;
74
+ '@copyright'?: string;
75
+ '@version': string;
76
+ '@description'?: string;
77
+ '@icon'?: string;
78
+ '@iconURL'?: string;
79
+ '@defaulticon'?: string;
80
+ '@icon64'?: string;
81
+ '@icon64URL'?: string;
82
+ '@grant'?: string;
83
+ '@author'?: string;
84
+ '@homepage'?: string;
85
+ '@homepageURL'?: string;
86
+ '@website'?: string;
87
+ '@source'?: string;
88
+ '@antifeature'?: string;
89
+ '@require'?: string;
90
+ '@resource'?: string;
91
+ '@include'?: string;
92
+ '@match'?: string;
93
+ '@exclude'?: string;
94
+ '@run-at'?: string;
95
+ '@sandbox'?: string;
96
+ '@connect'?: string;
97
+ '@noframes'?: string;
98
+ '@updateURL'?: string;
99
+ '@downloadURL'?: string;
100
+ '@supportURL'?: string;
101
+ '@webRequest'?: string;
102
+ '@unwrap'?: string;
103
+ [key: string]: string | undefined;
104
+ }
105
+ export interface CrxmManifest extends chrome.runtime.ManifestV3 {
106
+ content_scripts?: CrxmContentScripts;
107
+ }
108
+ export interface CrxmManifestImportantKeys {
109
+ description: string;
110
+ content_scripts: CrxmContentScripts;
111
+ background: {
112
+ service_worker: string;
113
+ type: string;
114
+ } | undefined;
115
+ name: string;
116
+ version: string;
117
+ manifest_version: 3;
118
+ action: {
119
+ default_icon: {
120
+ '16'?: string;
121
+ '24'?: string;
122
+ '32'?: string;
123
+ } | undefined;
124
+ default_title?: string;
125
+ default_popup?: string;
126
+ } | undefined;
127
+ icons: Record<number, string> | undefined;
128
+ }
129
+ export type CrxmContentScript = {
130
+ matches?: string[] | undefined;
131
+ exclude_matches?: string[] | undefined;
132
+ css?: string[] | undefined;
133
+ js?: string[] | undefined;
134
+ run_at?: 'document_start' | 'document_end' | 'document_idle' | undefined;
135
+ all_frames?: boolean | undefined;
136
+ match_about_blank?: boolean | undefined;
137
+ include_globs?: string[] | undefined;
138
+ exclude_globs?: string[] | undefined;
139
+ world?: 'ISOLATED' | 'MAIN' | undefined;
140
+ userscript_direct_inject?: boolean;
141
+ trusted_inject?: boolean;
142
+ use_isolated_connection?: boolean;
143
+ [key: string]: unknown;
144
+ };
145
+ export type CrxmContentScripts = Array<CrxmContentScript>;
146
+ export type CrxmManifestImportantKeyRequired = DeepRequired<CrxmManifestImportantKeys>;
147
+ export type CrxmManifestRequired = CrxmManifestImportantKeyRequired & chrome.runtime.ManifestV3;
148
+ export type BuildTarget = {
149
+ hash: string;
150
+ entryPoint: string;
151
+ usingPlugin: {
152
+ build: CrxmBundlerPlugin;
153
+ watch: CrxmBundlerPluginWatch;
154
+ };
155
+ flag: string;
156
+ };
157
+ export type ScriptUpdateHandler = (target: BuildTarget) => unknown;
158
+ export interface I_CrxmBundler {
159
+ compileResults: Record<string, Uint8Array>;
160
+ addTarget(entryPoint: string, usingPlugin: {
161
+ build: CrxmBundlerPlugin;
162
+ watch: CrxmBundlerPluginWatch;
163
+ }, flag: string): string;
164
+ removeTarget(targetEntryPoint: string): void;
165
+ getInternalHashFromPath(filePath: string, flag: string | null): string;
166
+ getBuildResultFromPath(filePath: string): Uint8Array | undefined;
167
+ build(): Promise<void>;
168
+ compileForce(hash: string): Promise<BuildTarget>;
169
+ watch(): Promise<void>;
170
+ stopWatch(): Promise<void>;
171
+ addListener(handler: ScriptUpdateHandler): void;
172
+ removeListener(handler: ScriptUpdateHandler): void;
173
+ }
174
+ /**
175
+ * Plugin for used when build.
176
+ */
177
+ export type CrxmBundlerPlugin = (filepath: string, bundler: I_CrxmBundler) => Promise<Uint8Array>;
178
+ /**
179
+ * Plugin for used when watch.
180
+ */
181
+ export type CrxmBundlerPluginWatch = {
182
+ name: string;
183
+ plugin: (filepath: string, sendResult: CrxmResultSender, bundler: I_CrxmBundler) => Promise<CrxmBundlerPluginWatcher>;
184
+ };
185
+ export type CrxmBundlerPluginWatcher = {
186
+ stop: () => Promise<void>;
187
+ };
188
+ export type CrxmResultSender = (result: Uint8Array) => void;
189
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=typeDefs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeDefs.js","sourceRoot":"","sources":["typeDefs.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.es2021.d.ts","./node_modules/typescript/lib/lib.es2022.d.ts","./node_modules/typescript/lib/lib.es2023.d.ts","./node_modules/typescript/lib/lib.es2024.d.ts","./node_modules/typescript/lib/lib.esnext.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2016.intl.d.ts","./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2017.date.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2019.intl.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.date.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.es2020.number.d.ts","./node_modules/typescript/lib/lib.es2021.promise.d.ts","./node_modules/typescript/lib/lib.es2021.string.d.ts","./node_modules/typescript/lib/lib.es2021.weakref.d.ts","./node_modules/typescript/lib/lib.es2021.intl.d.ts","./node_modules/typescript/lib/lib.es2022.array.d.ts","./node_modules/typescript/lib/lib.es2022.error.d.ts","./node_modules/typescript/lib/lib.es2022.intl.d.ts","./node_modules/typescript/lib/lib.es2022.object.d.ts","./node_modules/typescript/lib/lib.es2022.string.d.ts","./node_modules/typescript/lib/lib.es2022.regexp.d.ts","./node_modules/typescript/lib/lib.es2023.array.d.ts","./node_modules/typescript/lib/lib.es2023.collection.d.ts","./node_modules/typescript/lib/lib.es2023.intl.d.ts","./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2024.collection.d.ts","./node_modules/typescript/lib/lib.es2024.object.d.ts","./node_modules/typescript/lib/lib.es2024.promise.d.ts","./node_modules/typescript/lib/lib.es2024.regexp.d.ts","./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2024.string.d.ts","./node_modules/typescript/lib/lib.esnext.array.d.ts","./node_modules/typescript/lib/lib.esnext.collection.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.esnext.disposable.d.ts","./node_modules/typescript/lib/lib.esnext.promise.d.ts","./node_modules/typescript/lib/lib.esnext.decorators.d.ts","./node_modules/typescript/lib/lib.esnext.iterator.d.ts","./node_modules/typescript/lib/lib.esnext.float16.d.ts","./node_modules/typescript/lib/lib.decorators.d.ts","./node_modules/typescript/lib/lib.decorators.legacy.d.ts","./node_modules/tslib/tslib.d.ts","./src/client/message.ts","./src/node/typeDefs.ts","./src/client/runtime.ts","./src/client/i18n.ts","./src/client/api.ts","./src/client/main.ts","./node_modules/@types/har-format/index.d.ts","./node_modules/@types/chrome/har-format/index.d.ts","./node_modules/@types/chrome/chrome-cast/index.d.ts","./node_modules/@types/filewriter/index.d.ts","./node_modules/@types/filesystem/index.d.ts","./node_modules/@types/chrome/index.d.ts","./node_modules/@types/tampermonkey/index.d.ts"],"fileIdsList":[[88],[89,90,92],[91],[81,82,84,85],[81,86],[81,82,84,85,86],[81],[81,82,83]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},"1ccad1b5af260383eb013e145193d6d899a0f40fd85f68cc2eb6b847b4516fd9","959001dfb34c386acaa64adbb00237f7d9e783ac09894a7f9949c5bf4121884e","31b7a832f009bd64301894f060178b453dfc627deac455f2844bcb1dd1d32de4","d04b5662c0ca3753b3a37b10f63492e35de393bdac98e68b37c0f255fb2bc9c9","c8ba3836cfac65753b723f89fea350a2e4f200a778cf10e9344bd8de3d0877ac",{"version":"ab19cd6d671f7e49c1095e607008e8e37600347198574564764d2581cb30837b","affectsGlobalScope":true},{"version":"5574d520dabc450de6be799f1791d86d71da4fb236f16e6ca21b953788bb5154","impliedFormat":1},{"version":"5f877dfc985d1fd3ac8bf4a75cd77b06c42ca608809b324c44b4151758de7189","affectsGlobalScope":true,"impliedFormat":1},{"version":"9698d9513bbce8e33fded9b396243b917cd7544ab192c9ebaadce5ea298c31e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"14c2fd6220654a41c53836a62ba96d4b515ae1413b0ccb31c2445fb1ae1de5de","affectsGlobalScope":true,"impliedFormat":1},{"version":"4f29c38739500cd35a2ce41d15a35e34445ca755ebb991915b5f170985a49d21","affectsGlobalScope":true,"impliedFormat":1},{"version":"db3a8593c2ccdd12de17752811a26ad28a4aa28334caf58011284c81b07bdda2","affectsGlobalScope":true,"impliedFormat":1},{"version":"30cd709772047c77082b5a84fe43b75ccf8e2b4d8a72ad03d0fa1a9032c8b979","affectsGlobalScope":true,"impliedFormat":1}],"root":[[82,87]],"options":{"allowJs":false,"allowSyntheticDefaultImports":true,"composite":true,"declaration":false,"emitDeclarationOnly":false,"esModuleInterop":false,"importHelpers":true,"module":99,"noEmitHelpers":true,"skipLibCheck":false,"sourceMap":true,"strict":true,"target":99},"referencedMap":[[89,1],[93,2],[92,3],[86,4],[85,5],[87,6],[82,7],[84,8],[83,7]],"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94],"emitSignatures":[[82,"515639954738fb4e00aec261d1cd39609efe4b96bb98f9d74fbf8ca4e589e09b"],[83,"069c775c7bf50e2d208aea01b78679a10ab44c2137e80dc529c20b82e48198a4"],[84,"1c6c4aba325279a98be591760172ff02cf97ef2a4838d516c39593acbcfc901f"],[85,"0967a822cf2a7731bb2e90fd32f4c5c3023641e4379b86e18c77872e0cf62890"],[87,"7263a5fa2428e632f8ae73cc492b5dff2155fc30cc52b831733caf51a5c04b88"]],"latestChangedDtsFile":"./src/client/main.d.ts","version":"5.8.3"}
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # CRX MONKEY 🐵
2
+
3
+ <img src="https://raw.githubusercontent.com/yakisova41/crx-monkey/main/docs/static/img/logo.svg" width="150px">
4
+
5
+ Build Typescript into Chrome extension and Userscript
6
+
7
+ This is the build system created for [Return YouTube Comment Username
8
+ ](https://github.com/yakisova41/return-youtube-comment-username).
9
+
10
+ [Documentation](https://yakisova41.github.io/crx-monkey/docs/intro)
11
+
12
+ ## Feature
13
+
14
+ - The same code can be used in Chrome extension and userscript.
15
+ - Typescript can be used.
16
+ - The page, service_worker, and popup are automatically reloaded during development.
17
+ - Automatic code generation to execute code on the DOM
18
+ - Message passing from MAIN world to service_worker is available.
19
+ - Highspeed build by esbuild.
20
+
21
+ ## Installation
22
+
23
+ It is easy to set up using `create-crx-monkey`.
24
+
25
+ ```sh
26
+ npm create crx-monkey
27
+ ```
28
+
29
+ Follow the prompts to set up.
30
+
31
+ ```
32
+ Project name? any projectname...
33
+ Select a Language? Typescript / Javascript
34
+ ```
package/bin/crx-monkey ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../dist/node/main.js";
package/bun.lockb ADDED
Binary file
@@ -0,0 +1,187 @@
1
+ declare function waitResult<T = string>(type: string, actionId: string, callback: (data: T) => void): {
2
+ remove: () => void;
3
+ };
4
+ declare function waitResultOnce<T = string>(type: string, actionId: string): Promise<T>;
5
+ type IsolateConnectorEvent<T> = CustomEvent<{
6
+ type: string;
7
+ actionId: string;
8
+ data: T;
9
+ }>;
10
+ /**
11
+ * Bypass `chrome.runtime.sendMessage`.
12
+ *
13
+ * You can send message to service worker.
14
+ * @param callback
15
+ */
16
+ declare function sendMessage<T = never, U = never>(message: T, options?: object, callback?: (response: U) => void): Promise<void>;
17
+ /**
18
+ * Bypass `chrome.runtime.onMessage`.
19
+ *
20
+ * You can get a content of message receved the bypassing isolated content_script.
21
+ * @param callback
22
+ */
23
+ declare function addListener<T = never>(callback: (request: T, sender: chrome.runtime.MessageSender) => void): {
24
+ remove: () => void;
25
+ };
26
+ declare const message: {
27
+ sendMessage: typeof sendMessage;
28
+ addListener: typeof addListener;
29
+ };
30
+
31
+ /**
32
+ * Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the getMessage() call is wrong — for example, messageName is not a string or the substitutions array has more than 9 elements — this method returns undefined.
33
+ * @param messageName
34
+ * @param substitutions
35
+ * @returns
36
+ */
37
+ declare function getMessage(messageName: string, substitutions?: string | string[] | undefined): string | undefined;
38
+ declare function detectLanguage(text: string): Promise<chrome.i18n.LanguageDetectionResult | undefined>;
39
+ declare function getAcceptLanguages(): Promise<string[] | undefined>;
40
+ declare function getUILanguage(): string | undefined;
41
+ declare const i18n: {
42
+ getMessage: typeof getMessage;
43
+ detectLanguage: typeof detectLanguage;
44
+ getAcceptLanguages: typeof getAcceptLanguages;
45
+ getUILanguage: typeof getUILanguage;
46
+ };
47
+
48
+ type UserScriptHeader = Array<[keyof UserScriptHeaderProps, string]>;
49
+ interface UserScriptHeaderProps {
50
+ '@name': string;
51
+ '@namespace'?: string;
52
+ '@copyright'?: string;
53
+ '@version': string;
54
+ '@description'?: string;
55
+ '@icon'?: string;
56
+ '@iconURL'?: string;
57
+ '@defaulticon'?: string;
58
+ '@icon64'?: string;
59
+ '@icon64URL'?: string;
60
+ '@grant'?: string;
61
+ '@author'?: string;
62
+ '@homepage'?: string;
63
+ '@homepageURL'?: string;
64
+ '@website'?: string;
65
+ '@source'?: string;
66
+ '@antifeature'?: string;
67
+ '@require'?: string;
68
+ '@resource'?: string;
69
+ '@include'?: string;
70
+ '@match'?: string;
71
+ '@exclude'?: string;
72
+ '@run-at'?: string;
73
+ '@sandbox'?: string;
74
+ '@connect'?: string;
75
+ '@noframes'?: string;
76
+ '@updateURL'?: string;
77
+ '@downloadURL'?: string;
78
+ '@supportURL'?: string;
79
+ '@webRequest'?: string;
80
+ '@unwrap'?: string;
81
+ [key: string]: string | undefined;
82
+ }
83
+ type BuildTarget = {
84
+ hash: string;
85
+ entryPoint: string;
86
+ usingPlugin: {
87
+ build: CrxmBundlerPlugin;
88
+ watch: CrxmBundlerPluginWatch;
89
+ };
90
+ flag: string;
91
+ };
92
+ type ScriptUpdateHandler = (target: BuildTarget) => unknown;
93
+ interface I_CrxmBundler {
94
+ compileResults: Record<string, Uint8Array>;
95
+ addTarget(entryPoint: string, usingPlugin: {
96
+ build: CrxmBundlerPlugin;
97
+ watch: CrxmBundlerPluginWatch;
98
+ }, flag: string): string;
99
+ removeTarget(targetEntryPoint: string): void;
100
+ getInternalHashFromPath(filePath: string, flag: string | null): string;
101
+ getBuildResultFromPath(filePath: string): Uint8Array | undefined;
102
+ build(): Promise<void>;
103
+ compileForce(hash: string): Promise<BuildTarget>;
104
+ watch(): Promise<void>;
105
+ stopWatch(): Promise<void>;
106
+ addListener(handler: ScriptUpdateHandler): void;
107
+ removeListener(handler: ScriptUpdateHandler): void;
108
+ }
109
+ /**
110
+ * Plugin for used when build.
111
+ */
112
+ type CrxmBundlerPlugin = {
113
+ name: string;
114
+ plugin: (filepath: string, bundler: I_CrxmBundler) => Promise<Uint8Array>;
115
+ };
116
+ /**
117
+ * Plugin for used when watch.
118
+ */
119
+ type CrxmBundlerPluginWatch = {
120
+ name: string;
121
+ plugin: (filepath: string, sendResult: CrxmResultSender, bundler: I_CrxmBundler) => Promise<CrxmBundlerPluginWatcher>;
122
+ };
123
+ type CrxmBundlerPluginWatcher = {
124
+ stop: () => Promise<void>;
125
+ };
126
+ type CrxmResultSender = (result: Uint8Array) => void;
127
+
128
+ declare function getRunningRuntime(): "Userscript" | "Extension";
129
+ declare function getRunningWorld(): "MAIN" | "ISOLATED";
130
+ declare function getCrxmConfig(): Promise<{
131
+ output: {
132
+ chrome?: string;
133
+ userjs?: string;
134
+ };
135
+ manifest: string;
136
+ server: {
137
+ port?: number;
138
+ host?: string;
139
+ websocket?: number;
140
+ disable_sock_in_userjs?: boolean;
141
+ };
142
+ header: UserScriptHeader;
143
+ build: Record<string, CrxmBundlerPlugin>;
144
+ watch: Record<string, CrxmBundlerPluginWatch>;
145
+ logLevel: "info" | "error" | "debug";
146
+ public: string;
147
+ define: {
148
+ sw?: Record<string, string>;
149
+ contentscripts?: Record<string, string>;
150
+ popup?: Record<string, string>;
151
+ };
152
+ }>;
153
+ /**
154
+ * Get `chrome.runtime.id`.
155
+ *
156
+ * You can get the extension id everyworld if running script by chrome extension.
157
+ */
158
+ declare function getExtensionId(): Promise<string>;
159
+ /**
160
+ * You can check browser's console logs in your terminal at development mode.
161
+ * [ATTENSION] It's unstable future.
162
+ */
163
+ declare function attachConsole(): void;
164
+ declare const runtime: {
165
+ getRunningRuntime: typeof getRunningRuntime;
166
+ getRunningWorld: typeof getRunningWorld;
167
+ getExtensionId: typeof getExtensionId;
168
+ getCrxmConfig: typeof getCrxmConfig;
169
+ attachConsole: typeof attachConsole;
170
+ };
171
+
172
+ /**
173
+ * The main endpoint for client of crx-monkey.
174
+ * Modules and Types that are exported from this file are used by userside.
175
+ */
176
+
177
+ declare global {
178
+ interface Window {
179
+ __CRX_CONTENT_BUILD_ID: string;
180
+ }
181
+ interface WindowEventMap {
182
+ 'crx-isolated-connector-result': IsolateConnectorEvent<never>;
183
+ }
184
+ }
185
+
186
+ export { attachConsole, getCrxmConfig, getExtensionId, getRunningRuntime, getRunningWorld, i18n, message, runtime, waitResult, waitResultOnce };
187
+ export type { IsolateConnectorEvent };