extension 2.0.0-rc.31 → 2.0.0-rc.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  [downloads-url]: https://npmjs.org/package/extension
5
5
  [action-image]: https://github.com/extension-js/extension.js/actions/workflows/ci.yml/badge.svg?branch=main
6
6
  [action-url]: https://github.com/extension-js/extension.js/actions
7
+ [coverage-image]: https://img.shields.io/codecov/c/github/extension-js/extension.js
8
+ [coverage-url]: https://codecov.io/github/extension-js/extension.js
7
9
  [discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat
8
10
  [discord-url]: https://discord.gg/v9h2RgeTSN
9
11
  [snyk-image]: https://snyk.io/test/github/extension-js/extension/badge.svg
@@ -11,7 +13,7 @@
11
13
 
12
14
  > The cross-browser extension framework
13
15
 
14
- # Extension.js [![Version][npm-version-image]][npm-version-url] [![Downloads][downloads-image]][downloads-url] [![workflow][action-image]][action-url] [![discord][discord-image]][discord-url]
16
+ # Extension.js [![Version][npm-version-image]][npm-version-url] [![Downloads][downloads-image]][downloads-url] [![workflow][action-image]][action-url] [![coverage][coverage-image]][coverage-url] [![discord][discord-image]][discord-url]
15
17
 
16
18
  <img alt="Logo" align="right" src="https://github.com/user-attachments/assets/698a3b2e-c77a-4857-bd2a-1d2eb180120b" width="20%" />
17
19
 
package/dist/cli.js CHANGED
@@ -86,7 +86,7 @@ async function check_updates_checkUpdates(packageJson) {
86
86
  }
87
87
  if (update && isStableVersion(update.latest)) console.log(checkUpdates(packageJson, update));
88
88
  }
89
- var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"https://github.com/cezaraugusto/extension.git","directory":"programs/cli"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.js","require":"./dist/cli.js"}},"main":"./dist/cli.js","types":"./dist/cli.d.ts","files":["dist"],"bin":{"extension":"./dist/cli.js"},"name":"extension","version":"2.0.0-rc.31","description":"Create cross-browser extensions with no build configuration.","author":{"name":"Cezar Augusto","email":"boss@cezaraugusto.net","url":"https://cezaraugusto.com"},"scripts":{"watch":"rslib build --watch","compile:types":"bash install_scripts.sh","compile:readme-files":"node ./scripts/copyMarkdownFilesToCli.js","compile:cli":"rslib build","compile":"pnpm compile:readme-files && pnpm compile:cli && pnpm compile:types","clean":"rm -rf dist","test":"echo \\"Note: no test specified\\" && exit 0","test:cli":"vitest run"},"keywords":["zero-config","build","develop","browser","extension","chrome extension","edge extension","firefox extension","safari extension","web","react","typescript"],"dependencies":{"chalk":"^5.3.0","@types/chrome":"^0.0.287","@types/firefox-webext-browser":"^120.0.4","@types/node":"^22.10.1","@types/react":"^19.0.1","@types/react-dom":"^19.0.1","commander":"^12.1.0","extension-create":"workspace:*","extension-develop":"workspace:*","semver":"^7.6.3","update-check":"^1.5.4","webextension-polyfill":"^0.12.0"},"devDependencies":{"@rslib/core":"^0.6.9","@types/mock-fs":"^4.13.4","@types/semver":"^7.5.8","mock-fs":"^5.4.1","tsconfig":"*","typescript":"5.7.2"}}');
89
+ var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"https://github.com/cezaraugusto/extension.git","directory":"programs/cli"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.js","require":"./dist/cli.js"}},"main":"./dist/cli.js","types":"./dist/cli.d.ts","files":["dist","types"],"bin":{"extension":"./dist/cli.js"},"name":"extension","version":"2.0.0-rc.33","description":"Create cross-browser extensions with no build configuration.","author":{"name":"Cezar Augusto","email":"boss@cezaraugusto.net","url":"https://cezaraugusto.com"},"scripts":{"watch":"rslib build --watch","compile:types":"bash install_scripts.sh","compile:readme-files":"node ./scripts/copyMarkdownFilesToCli.js","compile:cli":"rslib build","compile":"pnpm compile:readme-files && pnpm compile:cli && pnpm compile:types","clean":"rm -rf dist","test":"echo \\"Note: no test specified\\" && exit 0","test:cli":"vitest run"},"keywords":["zero-config","build","develop","browser","extension","chrome extension","edge extension","firefox extension","safari extension","web","react","typescript"],"dependencies":{"chalk":"^5.3.0","@types/chrome":"^0.0.287","@types/node":"^22.10.1","@types/react":"^19.0.1","@types/react-dom":"^19.0.1","commander":"^12.1.0","extension-create":"workspace:*","extension-develop":"workspace:*","semver":"^7.6.3","update-check":"^1.5.4","webextension-polyfill":"^0.12.0"},"devDependencies":{"@rslib/core":"^0.6.9","@types/mock-fs":"^4.13.4","@types/semver":"^7.5.8","mock-fs":"^5.4.1","tsconfig":"*","typescript":"5.7.2"}}');
90
90
  check_updates_checkUpdates(package_namespaceObject);
91
91
  const extensionJs = external_commander_namespaceObject.program;
92
92
  const vendors = (browser)=>'all' === browser ? 'chrome,edge,firefox'.split(',') : browser.split(',');
@@ -11,6 +11,7 @@ type ExtensionBrowser =
11
11
  | 'firefox'
12
12
  | 'chromium-based'
13
13
  | 'gecko-based'
14
+
14
15
  type ExtensionMode = 'development' | 'production'
15
16
 
16
17
  interface ExtensionEnv {
@@ -23,26 +24,37 @@ interface ExtensionEnv {
23
24
  EXTENSION_ENV: ExtensionMode
24
25
  }
25
26
 
26
- declare namespace NodeJS {
27
- interface ProcessEnv extends ExtensionEnv {
27
+ // Global augmentations
28
+ declare global {
29
+ namespace NodeJS {
30
+ interface ProcessEnv extends ExtensionEnv {
31
+ [key: string]: string | undefined
32
+ }
33
+ }
34
+
35
+ interface ImportMetaEnv extends ExtensionEnv {
28
36
  [key: string]: string | undefined
29
37
  }
30
- }
31
38
 
32
- interface ImportMetaEnv extends ExtensionEnv {
33
- // Remove duplicate index signature since it's already inherited from ExtensionEnv
34
- }
39
+ interface ImportMeta {
40
+ readonly env: ImportMetaEnv
41
+ readonly webpackHot?: {
42
+ accept: (module?: string | string[], callback?: () => void) => void
43
+ dispose: (callback: () => void) => void
44
+ }
45
+ url: string
46
+ }
35
47
 
36
- interface ImportMeta {
37
- readonly env: ImportMetaEnv
38
- // @ts-expect-error - This is a webpack specific property
39
- readonly webpackHot?: {
40
- accept: (module?: string | string[], callback?: () => void) => void
41
- dispose: (callback: () => void) => void
48
+ interface Window {
49
+ /**
50
+ * @deprecated
51
+ * @description
52
+ * This is how Extension.js used to inject the shadow root into the window object.
53
+ * Use the shadowRoot reference from the content script instead.
54
+ */
55
+ __EXTENSION_SHADOW_ROOT__: ShadowRoot
42
56
  }
43
- url: string
44
57
  }
45
58
 
46
- interface Window {
47
- __EXTENSION_SHADOW_ROOT__: ShadowRoot
48
- }
59
+ // This export is needed for TypeScript to treat this file as a module
60
+ export {}
package/package.json CHANGED
@@ -18,13 +18,14 @@
18
18
  "main": "./dist/cli.js",
19
19
  "types": "./dist/cli.d.ts",
20
20
  "files": [
21
- "dist"
21
+ "dist",
22
+ "types"
22
23
  ],
23
24
  "bin": {
24
25
  "extension": "./dist/cli.js"
25
26
  },
26
27
  "name": "extension",
27
- "version": "2.0.0-rc.31",
28
+ "version": "2.0.0-rc.33",
28
29
  "description": "Create cross-browser extensions with no build configuration.",
29
30
  "author": {
30
31
  "name": "Cezar Augusto",
@@ -48,7 +49,6 @@
48
49
  "dependencies": {
49
50
  "chalk": "^5.3.0",
50
51
  "@types/chrome": "^0.0.287",
51
- "@types/firefox-webext-browser": "^120.0.4",
52
52
  "@types/node": "^22.10.1",
53
53
  "@types/react": "^19.0.1",
54
54
  "@types/react-dom": "^19.0.1",
@@ -56,8 +56,8 @@
56
56
  "semver": "^7.6.3",
57
57
  "update-check": "^1.5.4",
58
58
  "webextension-polyfill": "^0.12.0",
59
- "extension-create": "2.0.0-rc.31",
60
- "extension-develop": "2.0.0-rc.31"
59
+ "extension-create": "2.0.0-rc.33",
60
+ "extension-develop": "2.0.0-rc.33"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@rslib/core": "^0.6.9",
@@ -0,0 +1,7 @@
1
+ type CSSContentData = Readonly<Record<string, string>>
2
+
3
+ declare module '*.css' {
4
+ const content: CSSContentData
5
+
6
+ export default content
7
+ }
@@ -0,0 +1,19 @@
1
+ type CSSModuleData = Readonly<Record<string, string>>
2
+
3
+ declare module '*.module.css' {
4
+ const content: CSSModuleData
5
+
6
+ export default content
7
+ }
8
+
9
+ declare module '*.module.scss' {
10
+ const content: CSSModuleData
11
+
12
+ export default content
13
+ }
14
+
15
+ declare module '*.module.sass' {
16
+ const content: CSSModuleData
17
+
18
+ export default content
19
+ }
@@ -0,0 +1,58 @@
1
+ declare module '*.png' {
2
+ const content: string
3
+
4
+ export default content
5
+ }
6
+
7
+ declare module '*.jpg' {
8
+ const content: string
9
+
10
+ export default content
11
+ }
12
+
13
+ declare module '*.jpeg' {
14
+ const content: string
15
+
16
+ export default content
17
+ }
18
+
19
+ declare module '*.gif' {
20
+ const content: string
21
+
22
+ export default content
23
+ }
24
+
25
+ declare module '*.webp' {
26
+ const content: string
27
+
28
+ export default content
29
+ }
30
+
31
+ declare module '*.avif' {
32
+ const content: string
33
+
34
+ export default content
35
+ }
36
+
37
+ declare module '*.ico' {
38
+ const content: string
39
+
40
+ export default content
41
+ }
42
+
43
+ declare module '*.bmp' {
44
+ const content: string
45
+
46
+ export default content
47
+ }
48
+
49
+ declare module '*.svg' {
50
+ /**
51
+ * Use `any` to avoid conflicts with
52
+ * `@svgr/webpack` plugin or
53
+ * `babel-plugin-inline-react-svg` plugin.
54
+ */
55
+ const content: any
56
+
57
+ export default content
58
+ }
@@ -0,0 +1,60 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="chrome" />
3
+ /// <reference types="./js-frameworks.d.ts" />
4
+ /// <reference path="./css-content.d.ts" />
5
+ /// <reference path="./css-modules.d.ts" />
6
+ /// <reference path="./images.d.ts" />
7
+
8
+ type ExtensionBrowser =
9
+ | 'chrome'
10
+ | 'edge'
11
+ | 'firefox'
12
+ | 'chromium-based'
13
+ | 'gecko-based'
14
+
15
+ type ExtensionMode = 'development' | 'production'
16
+
17
+ interface ExtensionEnv {
18
+ EXTENSION_BROWSER: ExtensionBrowser
19
+ EXTENSION_MODE: ExtensionMode
20
+ EXTENSION_PUBLIC_BROWSER: ExtensionBrowser
21
+ EXTENSION_PUBLIC_MODE: ExtensionMode
22
+ EXTENSION_PUBLIC_DESCRIPTION_TEXT: string
23
+ EXTENSION_PUBLIC_OPENAI_API_KEY: string
24
+ EXTENSION_ENV: ExtensionMode
25
+ }
26
+
27
+ // Global augmentations
28
+ declare global {
29
+ namespace NodeJS {
30
+ interface ProcessEnv extends ExtensionEnv {
31
+ [key: string]: string | undefined
32
+ }
33
+ }
34
+
35
+ interface ImportMetaEnv extends ExtensionEnv {
36
+ [key: string]: string | undefined
37
+ }
38
+
39
+ interface ImportMeta {
40
+ readonly env: ImportMetaEnv
41
+ readonly webpackHot?: {
42
+ accept: (module?: string | string[], callback?: () => void) => void
43
+ dispose: (callback: () => void) => void
44
+ }
45
+ url: string
46
+ }
47
+
48
+ interface Window {
49
+ /**
50
+ * @deprecated
51
+ * @description
52
+ * This is how Extension.js used to inject the shadow root into the window object.
53
+ * Use the shadowRoot reference from the content script instead.
54
+ */
55
+ __EXTENSION_SHADOW_ROOT__: ShadowRoot
56
+ }
57
+ }
58
+
59
+ // This export is needed for TypeScript to treat this file as a module
60
+ export {}
package/types/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="react" />
3
+ /// <reference types="react-dom" />
4
+ /// <reference types="chrome" />
5
+ /// <reference path="./css-content.d.ts" />
6
+ /// <reference path="./css-modules.d.ts" />
7
+ /// <reference path="./images.d.ts" />
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="react-dom" />
3
+ /// <reference types="svelte" />
@@ -0,0 +1 @@
1
+ /// <reference types="webextension-polyfill" />
package/dist/types.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export type BrowsersSupported = 'chrome' | 'edge' | 'firefox' | 'chromium-based' | 'gecko-based' | 'all';
2
- export interface CreateOptions {
3
- template?: string;
4
- targetDir?: string;
5
- }
6
- export interface DevOptions {
7
- port?: number;
8
- browser?: BrowsersSupported;
9
- }
10
- export interface StartOptions {
11
- port?: number;
12
- browser?: BrowsersSupported;
13
- }
14
- export interface BuildOptions {
15
- browser?: BrowsersSupported;
16
- }