@atlaspack/transformer-webextension 2.14.31 → 2.14.32-dev-ts-project-refs-d30e9754f.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schema.js ADDED
@@ -0,0 +1,560 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionSchema = exports.MV2Schema = exports.MV3Schema = void 0;
4
+ const validateVersion = (ver) => {
5
+ const parts = ver.split('.', 5);
6
+ if (parts.length == 5)
7
+ return 'Extension versions to have at most three dots';
8
+ if (parts.every((part) => part.length != 0 && Number(part[0]) >= 0 && Number(part) < 65536))
9
+ return;
10
+ return 'Extension versions must be dot-separated integers between 0 and 65535';
11
+ };
12
+ const string = { type: 'string' };
13
+ const boolean = { type: 'boolean' };
14
+ const icons = {
15
+ type: 'object',
16
+ properties: {},
17
+ additionalProperties: string,
18
+ };
19
+ const actionProps = {
20
+ // FF only
21
+ browser_style: boolean,
22
+ chrome_style: boolean,
23
+ // You can also have a raw string, but not in Edge, apparently...
24
+ default_icon: {
25
+ oneOf: [icons, string],
26
+ },
27
+ default_popup: string,
28
+ default_title: string,
29
+ };
30
+ const arrStr = {
31
+ type: 'array',
32
+ items: string,
33
+ };
34
+ const browserAction = {
35
+ type: 'object',
36
+ properties: {
37
+ ...actionProps,
38
+ // rest are FF only
39
+ default_area: {
40
+ type: 'string',
41
+ enum: ['navbar', 'menupanel', 'tabstrip', 'personaltoolbar'],
42
+ },
43
+ theme_icons: {
44
+ type: 'array',
45
+ items: {
46
+ type: 'object',
47
+ properties: {
48
+ light: string,
49
+ dark: string,
50
+ size: { type: 'number' },
51
+ },
52
+ additionalProperties: false,
53
+ required: ['light', 'dark', 'size'],
54
+ },
55
+ },
56
+ },
57
+ additionalProperties: false,
58
+ };
59
+ const warBase = {
60
+ type: 'object',
61
+ properties: {
62
+ resources: arrStr,
63
+ matches: arrStr,
64
+ extension_ids: arrStr,
65
+ use_dynamic_url: boolean,
66
+ },
67
+ additionalProperties: false,
68
+ };
69
+ const mv2Background = {
70
+ type: 'object',
71
+ properties: {
72
+ scripts: arrStr,
73
+ page: string,
74
+ persistent: boolean,
75
+ },
76
+ additionalProperties: false,
77
+ };
78
+ const commonProps = {
79
+ $schema: string,
80
+ name: string,
81
+ version: {
82
+ type: 'string',
83
+ __validate: validateVersion,
84
+ },
85
+ default_locale: string,
86
+ description: string,
87
+ icons,
88
+ author: string,
89
+ browser_specific_settings: {
90
+ type: 'object',
91
+ properties: {},
92
+ additionalProperties: {
93
+ type: 'object',
94
+ properties: {},
95
+ },
96
+ },
97
+ chrome_settings_overrides: {
98
+ type: 'object',
99
+ properties: {
100
+ homepage: string,
101
+ search_provider: {
102
+ type: 'object',
103
+ properties: {
104
+ name: string,
105
+ keyword: string,
106
+ favicon_url: string,
107
+ search_url: string,
108
+ encoding: string,
109
+ suggest_url: string,
110
+ image_url: string,
111
+ instant_url: string,
112
+ search_url_post_params: string,
113
+ suggest_url_post_params: string,
114
+ image_url_post_params: string,
115
+ instant_url_post_params: string,
116
+ alternate_urls: arrStr,
117
+ prepopulated_id: { type: 'number' },
118
+ is_default: boolean,
119
+ },
120
+ additionalProperties: false,
121
+ required: ['name', 'search_url'],
122
+ },
123
+ startup_pages: arrStr,
124
+ },
125
+ additionalProperties: false,
126
+ },
127
+ chrome_url_overrides: {
128
+ type: 'object',
129
+ properties: {
130
+ bookmarks: string,
131
+ history: string,
132
+ newtab: string,
133
+ },
134
+ additionalProperties: false,
135
+ },
136
+ commands: {
137
+ type: 'object',
138
+ properties: {},
139
+ additionalProperties: {
140
+ type: 'object',
141
+ properties: {
142
+ suggested_key: {
143
+ type: 'object',
144
+ properties: {
145
+ default: string,
146
+ mac: string,
147
+ linux: string,
148
+ windows: string,
149
+ chromeos: string,
150
+ android: string,
151
+ ios: string,
152
+ },
153
+ additionalProperties: false,
154
+ },
155
+ description: string,
156
+ },
157
+ additionalProperties: false,
158
+ },
159
+ },
160
+ content_scripts: {
161
+ type: 'array',
162
+ items: {
163
+ type: 'object',
164
+ properties: {
165
+ matches: arrStr,
166
+ css: arrStr,
167
+ js: arrStr,
168
+ match_about_blank: boolean,
169
+ exclude_matches: arrStr,
170
+ include_globs: arrStr,
171
+ exclude_globs: arrStr,
172
+ run_at: {
173
+ type: 'string',
174
+ enum: ['document_idle', 'document_start', 'document_end'],
175
+ },
176
+ all_frames: boolean,
177
+ world: {
178
+ type: 'string',
179
+ enum: ['ISOLATED', 'MAIN'],
180
+ },
181
+ },
182
+ additionalProperties: false,
183
+ required: ['matches'],
184
+ },
185
+ },
186
+ declarative_net_request: {
187
+ type: 'object',
188
+ properties: {
189
+ rule_resources: {
190
+ type: 'array',
191
+ items: {
192
+ type: 'object',
193
+ properties: {
194
+ id: string,
195
+ enabled: boolean,
196
+ path: string,
197
+ },
198
+ additionalProperties: false,
199
+ required: ['id', 'enabled', 'path'],
200
+ },
201
+ },
202
+ },
203
+ additionalProperties: false,
204
+ required: ['rule_resources'],
205
+ },
206
+ devtools_page: string,
207
+ // looks to be FF only
208
+ dictionaries: {
209
+ type: 'object',
210
+ properties: {},
211
+ additionalProperties: string,
212
+ },
213
+ externally_connectable: {
214
+ type: 'object',
215
+ properties: {
216
+ ids: arrStr,
217
+ matches: arrStr,
218
+ accept_tls_channel_id: boolean,
219
+ },
220
+ additionalProperties: false,
221
+ },
222
+ // These next two are where it gets a bit Chrome-y
223
+ // (we don't include all because some have next to no actual use)
224
+ file_browser_handlers: {
225
+ type: 'array',
226
+ items: {
227
+ type: 'object',
228
+ properties: {
229
+ id: string,
230
+ default_title: string,
231
+ file_filters: arrStr,
232
+ },
233
+ additionalProperties: false,
234
+ required: ['id', 'default_title', 'file_filters'],
235
+ },
236
+ },
237
+ file_system_provider_capabilities: {
238
+ type: 'object',
239
+ properties: {
240
+ configurable: boolean,
241
+ multiple_mounts: boolean,
242
+ watchable: boolean,
243
+ source: {
244
+ type: 'string',
245
+ enum: ['file', 'device', 'network'],
246
+ },
247
+ },
248
+ additionalProperties: false,
249
+ required: ['source'],
250
+ },
251
+ homepage_url: string,
252
+ incognito: {
253
+ type: 'string',
254
+ enum: ['spanning', 'split', 'not_allowed'],
255
+ },
256
+ key: string,
257
+ minimum_chrome_version: {
258
+ type: 'string',
259
+ __validate: validateVersion,
260
+ },
261
+ // No NaCl modules because deprecated
262
+ oauth2: {
263
+ type: 'object',
264
+ properties: {
265
+ client_id: string,
266
+ scopes: arrStr,
267
+ },
268
+ additionalProperties: false,
269
+ },
270
+ offline_enabled: boolean,
271
+ omnibox: {
272
+ type: 'object',
273
+ properties: {},
274
+ additionalProperties: string,
275
+ },
276
+ optional_host_permissions: arrStr,
277
+ optional_permissions: arrStr,
278
+ // options_page is deprecated
279
+ options_ui: {
280
+ type: 'object',
281
+ properties: {
282
+ browser_style: boolean,
283
+ chrome_style: boolean,
284
+ open_in_tab: boolean,
285
+ page: string,
286
+ },
287
+ additionalProperties: false,
288
+ required: ['page'],
289
+ },
290
+ permissions: arrStr,
291
+ // FF only, but has some use
292
+ protocol_handlers: {
293
+ type: 'array',
294
+ items: {
295
+ type: 'object',
296
+ properties: {
297
+ protocol: string,
298
+ name: string,
299
+ uriTemplate: string,
300
+ },
301
+ additionalProperties: false,
302
+ required: ['protocol', 'name', 'uriTemplate'],
303
+ },
304
+ },
305
+ // Chrome only
306
+ requirements: {
307
+ type: 'object',
308
+ properties: {
309
+ '3D': {
310
+ type: 'object',
311
+ properties: {
312
+ features: arrStr,
313
+ },
314
+ additionalProperties: false,
315
+ },
316
+ },
317
+ },
318
+ short_name: string,
319
+ // FF only, but has some use
320
+ sidebar_action: {
321
+ type: 'object',
322
+ properties: {
323
+ browser_style: actionProps.browser_style,
324
+ default_icon: actionProps.default_icon,
325
+ default_panel: string,
326
+ default_title: string,
327
+ open_at_install: boolean,
328
+ },
329
+ additionalProperties: false,
330
+ required: ['default_panel'],
331
+ },
332
+ storage: {
333
+ type: 'object',
334
+ properties: {
335
+ managed_schema: string,
336
+ },
337
+ additionalProperties: false,
338
+ },
339
+ theme: {
340
+ type: 'object',
341
+ properties: {
342
+ images: {
343
+ type: 'object',
344
+ properties: {
345
+ theme_frame: string,
346
+ additional_backgrounds: arrStr,
347
+ },
348
+ additionalProperties: false,
349
+ },
350
+ colors: {
351
+ type: 'object',
352
+ properties: {
353
+ bookmark_text: string,
354
+ button_background_active: string,
355
+ button_background_hover: string,
356
+ icons: string,
357
+ icons_attention: string,
358
+ frame: string,
359
+ frame_inactive: string,
360
+ ntp_background: string,
361
+ ntp_text: string,
362
+ popup: string,
363
+ popup_border: string,
364
+ popup_highlight: string,
365
+ popup_highlight_text: string,
366
+ popup_text: string,
367
+ sidebar: string,
368
+ sidebar_border: string,
369
+ sidebar_highlight: string,
370
+ sidebar_highlight_text: string,
371
+ sidebar_text: string,
372
+ tab_background_separator: string,
373
+ tab_background_text: string,
374
+ tab_line: string,
375
+ tab_loading: string,
376
+ tab_selected: string,
377
+ tab_text: string,
378
+ toolbar: string,
379
+ toolbar_bottom_separator: string,
380
+ toolbar_field: string,
381
+ toolbar_field_border: string,
382
+ toolbar_field_border_focus: string,
383
+ toolbar_field_focus: string,
384
+ toolbar_field_highlight: string,
385
+ toolbar_field_highlight_text: string,
386
+ toolbar_field_separator: string,
387
+ toolbar_field_text: string,
388
+ toolbar_field_text_focus: string,
389
+ toolbar_text: string,
390
+ toolbar_top_separator: string,
391
+ toolbar_vertical_separator: string,
392
+ },
393
+ additionalProperties: false,
394
+ },
395
+ properties: {
396
+ type: 'object',
397
+ properties: {
398
+ additional_backgrounds_alignment: arrStr,
399
+ additional_backgrounds_tiling: {
400
+ type: 'array',
401
+ items: {
402
+ type: 'string',
403
+ enum: ['no-repeat', 'repeat', 'repeat-x', 'repeat-y'],
404
+ },
405
+ },
406
+ },
407
+ additionalProperties: false,
408
+ },
409
+ },
410
+ additionalProperties: false,
411
+ required: ['colors'],
412
+ },
413
+ tts_engine: {
414
+ type: 'object',
415
+ properties: {
416
+ voices: {
417
+ type: 'array',
418
+ items: {
419
+ type: 'object',
420
+ properties: {
421
+ voice_name: string,
422
+ lang: string,
423
+ event_type: {
424
+ type: 'string',
425
+ enum: ['start', 'word', 'sentence', 'marker', 'end', 'error'],
426
+ },
427
+ },
428
+ additionalProperties: false,
429
+ required: ['voice_name', 'event_type'],
430
+ },
431
+ },
432
+ },
433
+ additionalProperties: false,
434
+ },
435
+ update_url: string,
436
+ user_scripts: {
437
+ type: 'object',
438
+ properties: {
439
+ api_script: string,
440
+ },
441
+ additionalProperties: false,
442
+ },
443
+ version_name: string,
444
+ };
445
+ exports.MV3Schema = {
446
+ type: 'object',
447
+ properties: {
448
+ ...commonProps,
449
+ manifest_version: {
450
+ type: 'number',
451
+ enum: [3],
452
+ },
453
+ action: browserAction,
454
+ background: {
455
+ oneOf: [
456
+ {
457
+ type: 'object',
458
+ properties: {
459
+ service_worker: string,
460
+ type: {
461
+ type: 'string',
462
+ enum: ['classic', 'module'],
463
+ },
464
+ // to support both Chrome and Firefox
465
+ scripts: arrStr,
466
+ page: string,
467
+ persistent: boolean,
468
+ },
469
+ additionalProperties: false,
470
+ required: ['service_worker'],
471
+ },
472
+ mv2Background,
473
+ ], // for Firefox
474
+ },
475
+ content_security_policy: {
476
+ type: 'object',
477
+ properties: {
478
+ extension_pages: string,
479
+ sandbox: string,
480
+ },
481
+ additionalProperties: false,
482
+ },
483
+ host_permissions: arrStr,
484
+ sandbox: {
485
+ type: 'object',
486
+ properties: {
487
+ pages: arrStr,
488
+ },
489
+ additionalProperties: false,
490
+ },
491
+ side_panel: {
492
+ type: 'object',
493
+ properties: {
494
+ default_path: string,
495
+ },
496
+ additionalProperties: false,
497
+ },
498
+ web_accessible_resources: {
499
+ type: 'array',
500
+ items: {
501
+ oneOf: [
502
+ {
503
+ ...warBase,
504
+ required: ['resources', 'matches'],
505
+ },
506
+ {
507
+ ...warBase,
508
+ required: ['resources', 'extension_ids'],
509
+ },
510
+ ],
511
+ },
512
+ },
513
+ },
514
+ required: ['manifest_version', 'name', 'version'],
515
+ };
516
+ exports.MV2Schema = {
517
+ type: 'object',
518
+ properties: {
519
+ ...commonProps,
520
+ manifest_version: {
521
+ type: 'number',
522
+ enum: [2],
523
+ },
524
+ background: mv2Background,
525
+ browser_action: browserAction,
526
+ content_security_policy: string,
527
+ page_action: {
528
+ type: 'object',
529
+ properties: {
530
+ ...actionProps,
531
+ // rest are FF only
532
+ hide_matches: arrStr,
533
+ show_matches: arrStr,
534
+ pinned: boolean,
535
+ },
536
+ additionalProperties: false,
537
+ },
538
+ sandbox: {
539
+ type: 'object',
540
+ properties: {
541
+ pages: arrStr,
542
+ content_security_policy: string,
543
+ },
544
+ additionalProperties: false,
545
+ },
546
+ web_accessible_resources: arrStr,
547
+ },
548
+ required: ['manifest_version', 'name', 'version'],
549
+ };
550
+ exports.VersionSchema = {
551
+ type: 'object',
552
+ properties: {
553
+ $schema: string,
554
+ manifest_version: {
555
+ type: 'number',
556
+ enum: [2, 3],
557
+ },
558
+ },
559
+ required: ['manifest_version'],
560
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/transformer-webextension",
3
- "version": "2.14.31",
3
+ "version": "2.14.32-dev-ts-project-refs-d30e9754f.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -11,18 +11,18 @@
11
11
  },
12
12
  "main": "./lib/WebExtensionTransformer.js",
13
13
  "source": "./src/WebExtensionTransformer.ts",
14
- "types": "./lib/types/WebExtensionTransformer.d.ts",
14
+ "types": "./lib/types/src/WebExtensionTransformer.d.ts",
15
15
  "engines": {},
16
16
  "dependencies": {
17
+ "@atlaspack/diagnostic": "2.14.5-dev-ts-project-refs-d30e9754f.0",
18
+ "@atlaspack/plugin": "2.14.32-dev-ts-project-refs-d30e9754f.0",
19
+ "@atlaspack/utils": "2.19.4-dev-ts-project-refs-d30e9754f.0",
17
20
  "@mischnic/json-sourcemap": "^0.1.0",
18
- "@atlaspack/diagnostic": "2.14.4",
19
- "@atlaspack/plugin": "2.14.31",
20
- "@atlaspack/utils": "2.19.3",
21
21
  "content-security-policy-parser": "^0.3.0"
22
22
  },
23
23
  "type": "commonjs",
24
24
  "scripts": {
25
- "check-ts": "tsc --emitDeclarationOnly --rootDir src",
26
25
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
27
- }
26
+ },
27
+ "gitHead": "d30e9754f8d423d53261ec54ec87e6fa1299578a"
28
28
  }
package/tsconfig.json CHANGED
@@ -1,4 +1,18 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "include": ["src"]
2
+ "extends": "../../../tsconfig.base.json",
3
+ "include": ["src"],
4
+ "compilerOptions": {
5
+ "composite": true
6
+ },
7
+ "references": [
8
+ {
9
+ "path": "../../core/diagnostic/tsconfig.json"
10
+ },
11
+ {
12
+ "path": "../../core/plugin/tsconfig.json"
13
+ },
14
+ {
15
+ "path": "../../core/utils/tsconfig.json"
16
+ }
17
+ ]
4
18
  }