extension-create 2.0.0-alpha.3 → 2.0.0-alpha.5
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/action/README.md +37 -0
- package/dist/action/action/index.html +40 -0
- package/dist/action/action/scripts.js +11 -0
- package/dist/action/action/styles.css +23 -0
- package/dist/action/images/extension_128.png +0 -0
- package/dist/action/images/extension_16.png +0 -0
- package/dist/action/images/extension_48.png +0 -0
- package/dist/action/manifest.json +21 -0
- package/dist/action/package.json +21 -0
- package/dist/action-chatgpt/.env.example +1 -0
- package/dist/action-chatgpt/README.md +37 -0
- package/dist/action-chatgpt/action/ActionApp.tsx +118 -0
- package/dist/action-chatgpt/action/index.html +13 -0
- package/dist/action-chatgpt/action/scripts.tsx +12 -0
- package/dist/action-chatgpt/action/styles.css +8 -0
- package/dist/action-chatgpt/extension-env.d.ts +9 -0
- package/dist/action-chatgpt/images/chatgpt.png +0 -0
- package/dist/action-chatgpt/images/extension.png +0 -0
- package/dist/action-chatgpt/images/extension_128.png +0 -0
- package/dist/action-chatgpt/images/extension_16.png +0 -0
- package/dist/action-chatgpt/images/extension_48.png +0 -0
- package/dist/action-chatgpt/manifest.json +21 -0
- package/dist/action-chatgpt/package.json +30 -0
- package/dist/action-chatgpt/postcss.config.js +6 -0
- package/dist/action-chatgpt/tailwind.config.js +8 -0
- package/dist/action-chatgpt/tsconfig.json +21 -0
- package/dist/config-stylelint/README.md +37 -0
- package/dist/config-stylelint/images/extension_128.png +0 -0
- package/dist/config-stylelint/images/extension_16.png +0 -0
- package/dist/config-stylelint/images/extension_48.png +0 -0
- package/dist/config-stylelint/images/stylelint.svg +1 -0
- package/dist/config-stylelint/manifest.json +15 -0
- package/dist/config-stylelint/newtab/index.html +40 -0
- package/dist/config-stylelint/newtab/scripts.js +11 -0
- package/dist/config-stylelint/newtab/styles.css +20 -0
- package/dist/config-stylelint/package.json +23 -0
- package/dist/config-stylelint/stylelint.config.json +1 -0
- package/dist/content/README.md +37 -0
- package/dist/content/background.js +21 -0
- package/dist/content/content/scripts.js +32 -0
- package/dist/content/content/styles.css +54 -0
- package/dist/content/images/extension_128.png +0 -0
- package/dist/content/images/extension_16.png +0 -0
- package/dist/content/images/extension_48.png +0 -0
- package/dist/content/manifest.json +35 -0
- package/dist/content/package.json +20 -0
- package/dist/content-css-module/README.md +37 -0
- package/dist/content-css-module/background.js +21 -0
- package/dist/content-css-module/content/Logo.module.css +11 -0
- package/dist/content-css-module/content/scripts.js +33 -0
- package/dist/content-css-module/content/styles.css +40 -0
- package/dist/content-css-module/images/extension_128.png +0 -0
- package/dist/content-css-module/images/extension_16.png +0 -0
- package/dist/content-css-module/images/extension_48.png +0 -0
- package/dist/content-css-module/manifest.json +35 -0
- package/dist/content-css-module/package.json +20 -0
- package/dist/content-less/README.md +37 -0
- package/dist/content-less/background.js +21 -0
- package/dist/content-less/content/scripts.js +32 -0
- package/dist/content-less/content/styles.less +51 -0
- package/dist/content-less/images/extension_128.png +0 -0
- package/dist/content-less/images/extension_16.png +0 -0
- package/dist/content-less/images/extension_48.png +0 -0
- package/dist/content-less/manifest.json +35 -0
- package/dist/content-less/package.json +21 -0
- package/dist/content-main-world/README.md +37 -0
- package/dist/content-main-world/background.js +19 -0
- package/dist/content-main-world/content/scripts.js +32 -0
- package/dist/content-main-world/content/styles.css +51 -0
- package/dist/content-main-world/images/extension_128.png +0 -0
- package/dist/content-main-world/images/extension_16.png +0 -0
- package/dist/content-main-world/images/extension_48.png +0 -0
- package/dist/content-main-world/manifest.json +37 -0
- package/dist/content-main-world/package.json +20 -0
- package/dist/content-preact/README.md +37 -0
- package/dist/content-preact/background.ts +1 -0
- package/dist/content-preact/content/ContentApp.tsx +92 -0
- package/dist/content-preact/content/scripts.tsx +14 -0
- package/dist/content-preact/content/styles.css +10 -0
- package/dist/content-preact/extension-env.d.ts +9 -0
- package/dist/content-preact/images/chromeWindow.png +0 -0
- package/dist/content-preact/images/extension_128.png +0 -0
- package/dist/content-preact/images/extension_16.png +0 -0
- package/dist/content-preact/images/extension_48.png +0 -0
- package/dist/content-preact/images/preact.png +0 -0
- package/dist/content-preact/images/tailwind.png +0 -0
- package/dist/content-preact/images/tailwind_bg.png +0 -0
- package/dist/content-preact/images/typescript.png +0 -0
- package/dist/content-preact/manifest.json +31 -0
- package/dist/content-preact/package.json +27 -0
- package/dist/content-preact/postcss.config.js +6 -0
- package/dist/content-preact/tailwind.config.js +8 -0
- package/dist/content-preact/tsconfig.json +26 -0
- package/dist/content-react/README.md +37 -0
- package/dist/content-react/background.ts +1 -0
- package/dist/content-react/content/ContentApp.tsx +86 -0
- package/dist/content-react/content/scripts.tsx +17 -0
- package/dist/content-react/content/styles.css +10 -0
- package/dist/content-react/extension-env.d.ts +9 -0
- package/dist/content-react/images/chromeWindow.png +0 -0
- package/dist/content-react/images/extension_128.png +0 -0
- package/dist/content-react/images/extension_16.png +0 -0
- package/dist/content-react/images/extension_48.png +0 -0
- package/dist/content-react/images/react.png +0 -0
- package/dist/content-react/images/tailwind.png +0 -0
- package/dist/content-react/images/tailwind_bg.png +0 -0
- package/dist/content-react/images/typescript.png +0 -0
- package/dist/content-react/manifest.json +28 -0
- package/dist/content-react/package.json +28 -0
- package/dist/content-react/postcss.config.js +6 -0
- package/dist/content-react/tailwind.config.js +8 -0
- package/dist/content-react/tsconfig.json +21 -0
- package/dist/content-sass/README.md +37 -0
- package/dist/content-sass/background.js +21 -0
- package/dist/content-sass/content/scripts.js +32 -0
- package/dist/content-sass/content/styles.scss +51 -0
- package/dist/content-sass/images/extension_128.png +0 -0
- package/dist/content-sass/images/extension_16.png +0 -0
- package/dist/content-sass/images/extension_48.png +0 -0
- package/dist/content-sass/manifest.json +35 -0
- package/dist/content-sass/package.json +21 -0
- package/dist/content-sass-module/README.md +37 -0
- package/dist/content-sass-module/background.js +21 -0
- package/dist/content-sass-module/content/Logo.module.scss +18 -0
- package/dist/content-sass-module/content/scripts.js +33 -0
- package/dist/content-sass-module/content/styles.scss +40 -0
- package/dist/content-sass-module/images/extension_128.png +0 -0
- package/dist/content-sass-module/images/extension_16.png +0 -0
- package/dist/content-sass-module/images/extension_48.png +0 -0
- package/dist/content-sass-module/manifest.json +35 -0
- package/dist/content-sass-module/package.json +21 -0
- package/dist/content-tailwind/README.md +37 -0
- package/dist/content-tailwind/background.js +21 -0
- package/dist/content-tailwind/content/content.js +45 -0
- package/dist/content-tailwind/content/scripts.js +6 -0
- package/dist/content-tailwind/content/styles.css +10 -0
- package/dist/content-tailwind/images/chromeWindow.png +0 -0
- package/dist/content-tailwind/images/extension_128.png +0 -0
- package/dist/content-tailwind/images/extension_16.png +0 -0
- package/dist/content-tailwind/images/extension_48.png +0 -0
- package/dist/content-tailwind/images/react.png +0 -0
- package/dist/content-tailwind/images/tailwind.png +0 -0
- package/dist/content-tailwind/images/tailwind_bg.png +0 -0
- package/dist/content-tailwind/manifest.json +35 -0
- package/dist/content-tailwind/package.json +23 -0
- package/dist/content-tailwind/postcss.config.js +6 -0
- package/dist/content-tailwind/tailwind.config.js +8 -0
- package/dist/content-typescript/README.md +37 -0
- package/dist/content-typescript/background.ts +26 -0
- package/dist/content-typescript/content/scripts.ts +33 -0
- package/dist/content-typescript/content/styles.css +51 -0
- package/dist/content-typescript/extension-env.d.ts +9 -0
- package/dist/content-typescript/images/extension_128.png +0 -0
- package/dist/content-typescript/images/extension_16.png +0 -0
- package/dist/content-typescript/images/extension_48.png +0 -0
- package/dist/content-typescript/images/typescript.png +0 -0
- package/dist/content-typescript/manifest.json +35 -0
- package/dist/content-typescript/package.json +21 -0
- package/dist/content-typescript/tsconfig.json +21 -0
- package/dist/content-vue/README.md +37 -0
- package/dist/content-vue/background.ts +1 -0
- package/dist/content-vue/content/ContentApp.vue +90 -0
- package/dist/content-vue/content/scripts.ts +13 -0
- package/dist/content-vue/content/shims-vue.d.ts +6 -0
- package/dist/content-vue/content/styles.css +10 -0
- package/dist/content-vue/extension-env.d.ts +9 -0
- package/dist/content-vue/images/chromeWindow.png +0 -0
- package/dist/content-vue/images/extension_128.png +0 -0
- package/dist/content-vue/images/extension_16.png +0 -0
- package/dist/content-vue/images/extension_48.png +0 -0
- package/dist/content-vue/images/tailwind.png +0 -0
- package/dist/content-vue/images/tailwind_bg.png +0 -0
- package/dist/content-vue/images/typescript.png +0 -0
- package/dist/content-vue/images/vue.svg +8 -0
- package/dist/content-vue/manifest.json +31 -0
- package/dist/content-vue/package.json +25 -0
- package/dist/content-vue/postcss.config.js +6 -0
- package/dist/content-vue/tailwind.config.js +8 -0
- package/dist/content-vue/tsconfig.json +21 -0
- package/dist/declarative_net_request/README.md +37 -0
- package/dist/declarative_net_request/images/extension_128.png +0 -0
- package/dist/declarative_net_request/images/extension_16.png +0 -0
- package/dist/declarative_net_request/images/extension_48.png +0 -0
- package/dist/declarative_net_request/manifest.json +34 -0
- package/dist/declarative_net_request/package.json +21 -0
- package/dist/declarative_net_request/public/public_ruleset.json +72 -0
- package/dist/declarative_net_request/rules_1.json +72 -0
- package/dist/init/README.md +37 -0
- package/dist/init/manifest.json +7 -0
- package/dist/init/package.json +32 -0
- package/dist/locales/README.md +37 -0
- package/dist/locales/_locales/en/messages.json +10 -0
- package/dist/locales/_locales/pt_BR/messages.json +10 -0
- package/dist/locales/action/index.html +40 -0
- package/dist/locales/action/scripts.js +3 -0
- package/dist/locales/action/styles.css +23 -0
- package/dist/locales/images/extension_128.png +0 -0
- package/dist/locales/images/extension_16.png +0 -0
- package/dist/locales/images/extension_48.png +0 -0
- package/dist/locales/manifest.json +19 -0
- package/dist/locales/package.json +21 -0
- package/dist/module.js +11 -11
- package/dist/new-less/README.md +37 -0
- package/dist/new-less/images/extension_128.png +0 -0
- package/dist/new-less/images/extension_16.png +0 -0
- package/dist/new-less/images/extension_48.png +0 -0
- package/dist/new-less/manifest.json +15 -0
- package/dist/new-less/newtab/index.html +40 -0
- package/dist/new-less/newtab/scripts.js +11 -0
- package/dist/new-less/newtab/styles.less +19 -0
- package/dist/new-less/package.json +21 -0
- package/dist/new-preact/README.md +37 -0
- package/dist/new-preact/extension-env.d.ts +9 -0
- package/dist/new-preact/images/extension_128.png +0 -0
- package/dist/new-preact/images/extension_16.png +0 -0
- package/dist/new-preact/images/extension_48.png +0 -0
- package/dist/new-preact/images/preact.png +0 -0
- package/dist/new-preact/manifest.json +15 -0
- package/dist/new-preact/newtab/NewTabApp.tsx +27 -0
- package/dist/new-preact/newtab/index.html +13 -0
- package/dist/new-preact/newtab/scripts.tsx +5 -0
- package/dist/new-preact/newtab/styles.css +32 -0
- package/dist/new-preact/package.json +27 -0
- package/dist/new-preact/tsconfig.json +21 -0
- package/dist/new-react/README.md +37 -0
- package/dist/new-react/extension-env.d.ts +9 -0
- package/dist/new-react/images/extension_128.png +0 -0
- package/dist/new-react/images/extension_16.png +0 -0
- package/dist/new-react/images/extension_48.png +0 -0
- package/dist/new-react/images/react.png +0 -0
- package/dist/new-react/manifest.json +15 -0
- package/dist/new-react/newtab/NewTabApp.tsx +27 -0
- package/dist/new-react/newtab/index.html +13 -0
- package/dist/new-react/newtab/scripts.tsx +12 -0
- package/dist/new-react/newtab/styles.css +23 -0
- package/dist/new-react/package.json +28 -0
- package/dist/new-react/tsconfig.json +21 -0
- package/dist/new-sass/README.md +37 -0
- package/dist/new-sass/images/extension_128.png +0 -0
- package/dist/new-sass/images/extension_16.png +0 -0
- package/dist/new-sass/images/extension_48.png +0 -0
- package/dist/new-sass/manifest.json +15 -0
- package/dist/new-sass/newtab/index.html +40 -0
- package/dist/new-sass/newtab/scripts.js +11 -0
- package/dist/new-sass/newtab/styles.scss +19 -0
- package/dist/new-sass/package.json +22 -0
- package/dist/new-tailwind/README.md +37 -0
- package/dist/new-tailwind/extension-env.d.ts +9 -0
- package/dist/new-tailwind/images/chromeWindow.png +0 -0
- package/dist/new-tailwind/images/extension_128.png +0 -0
- package/dist/new-tailwind/images/extension_16.png +0 -0
- package/dist/new-tailwind/images/extension_48.png +0 -0
- package/dist/new-tailwind/images/react.png +0 -0
- package/dist/new-tailwind/images/tailwind.png +0 -0
- package/dist/new-tailwind/images/tailwind_bg.png +0 -0
- package/dist/new-tailwind/manifest.json +15 -0
- package/dist/new-tailwind/newtab/NewTabApp.tsx +67 -0
- package/dist/new-tailwind/newtab/index.html +13 -0
- package/dist/new-tailwind/newtab/scripts.tsx +12 -0
- package/dist/new-tailwind/newtab/styles.css +3 -0
- package/dist/new-tailwind/package.json +28 -0
- package/dist/new-tailwind/postcss.config.js +6 -0
- package/dist/new-tailwind/tailwind.config.js +8 -0
- package/dist/new-tailwind/tsconfig.json +21 -0
- package/dist/new-typescript/README.md +37 -0
- package/dist/new-typescript/extension-env.d.ts +9 -0
- package/dist/new-typescript/images/extension_128.png +0 -0
- package/dist/new-typescript/images/extension_16.png +0 -0
- package/dist/new-typescript/images/extension_48.png +0 -0
- package/dist/new-typescript/images/typescript.png +0 -0
- package/dist/new-typescript/manifest.json +15 -0
- package/dist/new-typescript/newtab/index.html +25 -0
- package/dist/new-typescript/newtab/scripts.ts +10 -0
- package/dist/new-typescript/newtab/styles.css +18 -0
- package/dist/new-typescript/package.json +22 -0
- package/dist/new-typescript/tsconfig.json +21 -0
- package/dist/new-vue/README.md +37 -0
- package/dist/new-vue/extension-env.d.ts +9 -0
- package/dist/new-vue/images/extension_128.png +0 -0
- package/dist/new-vue/images/extension_16.png +0 -0
- package/dist/new-vue/images/extension_48.png +0 -0
- package/dist/new-vue/images/vue.svg +8 -0
- package/dist/new-vue/manifest.json +15 -0
- package/dist/new-vue/newtab/NewTabApp.vue +30 -0
- package/dist/new-vue/newtab/index.html +13 -0
- package/dist/new-vue/newtab/scripts.ts +7 -0
- package/dist/new-vue/newtab/styles.css +36 -0
- package/dist/new-vue/package.json +25 -0
- package/dist/new-vue/tsconfig.json +21 -0
- package/dist/sidebar/README.md +37 -0
- package/dist/sidebar/images/extension_128.png +0 -0
- package/dist/sidebar/images/extension_16.png +0 -0
- package/dist/sidebar/images/extension_48.png +0 -0
- package/dist/sidebar/manifest.json +25 -0
- package/dist/sidebar/package.json +21 -0
- package/dist/sidebar/puzzle.png +0 -0
- package/dist/sidebar/sidebar/index.html +39 -0
- package/dist/sidebar/sidebar/scripts.js +11 -0
- package/dist/sidebar/sidebar/styles.css +27 -0
- package/dist/sidebar/test_16.png +0 -0
- package/dist/sidebar/test_32.png +0 -0
- package/dist/sidebar/test_48.png +0 -0
- package/dist/sidebar/test_64.png +0 -0
- package/dist/special-folders-pages/README.md +37 -0
- package/dist/special-folders-pages/background.js +5 -0
- package/dist/special-folders-pages/images/extension_128.png +0 -0
- package/dist/special-folders-pages/images/extension_16.png +0 -0
- package/dist/special-folders-pages/images/extension_48.png +0 -0
- package/dist/special-folders-pages/images/notpublic-file.png +0 -0
- package/dist/special-folders-pages/manifest.json +26 -0
- package/dist/special-folders-pages/package.json +21 -0
- package/dist/special-folders-pages/pages/custom.html +8 -0
- package/dist/special-folders-pages/pages/main.css +18 -0
- package/dist/special-folders-pages/pages/main.html +16 -0
- package/dist/special-folders-pages/pages/main.js +1 -0
- package/dist/special-folders-pages/public/css/file.css +3 -0
- package/dist/special-folders-pages/public/html/file.html +8 -0
- package/dist/special-folders-pages/public/img/icon.png +0 -0
- package/dist/special-folders-pages/public/js/file.js +0 -0
- package/dist/special-folders-pages/sandbox/index.html +24 -0
- package/dist/special-folders-pages/sandbox/scripts.js +0 -0
- package/dist/special-folders-pages/sandbox/styles.css +1 -0
- package/dist/special-folders-scripts/README.md +37 -0
- package/dist/special-folders-scripts/background.js +24 -0
- package/dist/special-folders-scripts/images/extension_128.png +0 -0
- package/dist/special-folders-scripts/images/extension_16.png +0 -0
- package/dist/special-folders-scripts/images/extension_48.png +0 -0
- package/dist/special-folders-scripts/manifest.json +27 -0
- package/dist/special-folders-scripts/package.json +21 -0
- package/dist/special-folders-scripts/pages/index.css +5 -0
- package/dist/special-folders-scripts/pages/index.html +3 -0
- package/dist/special-folders-scripts/pages/index.js +1 -0
- package/dist/special-folders-scripts/public/extension.png +0 -0
- package/dist/special-folders-scripts/scripts/content-script.js +3 -0
- package/dist/storage/README.md +37 -0
- package/dist/storage/images/extension_128.png +0 -0
- package/dist/storage/images/extension_16.png +0 -0
- package/dist/storage/images/extension_48.png +0 -0
- package/dist/storage/manifest.json +15 -0
- package/dist/storage/package.json +21 -0
- package/dist/storage/schema.json +44 -0
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "declarative_net_request",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"manifest_version": 3,
|
|
5
|
+
"description": "An Extension.js example.",
|
|
6
|
+
"icons": {
|
|
7
|
+
"16": "images/extension_16.png",
|
|
8
|
+
"48": "images/extension_48.png",
|
|
9
|
+
"128": "images/extension_128.png"
|
|
10
|
+
},
|
|
11
|
+
"declarative_net_request": {
|
|
12
|
+
"rule_resources": [
|
|
13
|
+
{
|
|
14
|
+
"id": "ruleset_1",
|
|
15
|
+
"enabled": true,
|
|
16
|
+
"path": "rules_1.json"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "public_rule_1",
|
|
20
|
+
"enabled": true,
|
|
21
|
+
"path": "public/public_ruleset.json"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"permissions": [
|
|
26
|
+
"declarativeNetRequest",
|
|
27
|
+
"declarativeNetRequestFeedback",
|
|
28
|
+
"declarativeNetRequestWithHostAccess"
|
|
29
|
+
],
|
|
30
|
+
"host_permissions": [
|
|
31
|
+
"https://developer.chrome.com/"
|
|
32
|
+
],
|
|
33
|
+
"author": "Your Name"
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "declarative_net_request",
|
|
4
|
+
"description": "An Extension.js example.",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Your Name",
|
|
8
|
+
"email": "your@email.com",
|
|
9
|
+
"url": "https://yourwebsite.com"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "extension dev",
|
|
14
|
+
"start": "extension start",
|
|
15
|
+
"build": "extension build"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"extension": "latest"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"priority": 1,
|
|
5
|
+
"action": {
|
|
6
|
+
"type": "redirect",
|
|
7
|
+
"redirect": {
|
|
8
|
+
"url": "https://developer.chrome.com/docs/extensions/mv3/intro/"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"condition": {
|
|
12
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/mv2/",
|
|
13
|
+
"resourceTypes": ["main_frame"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": 2,
|
|
18
|
+
"priority": 1,
|
|
19
|
+
"action": {
|
|
20
|
+
"type": "redirect",
|
|
21
|
+
"redirect": {
|
|
22
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/action/"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"condition": {
|
|
26
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/browserAction/",
|
|
27
|
+
"resourceTypes": ["main_frame"]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": 3,
|
|
32
|
+
"priority": 1,
|
|
33
|
+
"action": {
|
|
34
|
+
"type": "redirect",
|
|
35
|
+
"redirect": {
|
|
36
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"condition": {
|
|
40
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/declarativeWebRequest/",
|
|
41
|
+
"resourceTypes": ["main_frame"]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": 4,
|
|
46
|
+
"priority": 1,
|
|
47
|
+
"action": {
|
|
48
|
+
"type": "redirect",
|
|
49
|
+
"redirect": {
|
|
50
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/action/"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"condition": {
|
|
54
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/pageAction/",
|
|
55
|
+
"resourceTypes": ["main_frame"]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": 5,
|
|
60
|
+
"priority": 1,
|
|
61
|
+
"action": {
|
|
62
|
+
"type": "redirect",
|
|
63
|
+
"redirect": {
|
|
64
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"condition": {
|
|
68
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/webRequest/",
|
|
69
|
+
"resourceTypes": ["main_frame"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"priority": 1,
|
|
5
|
+
"action": {
|
|
6
|
+
"type": "redirect",
|
|
7
|
+
"redirect": {
|
|
8
|
+
"url": "https://developer.chrome.com/docs/extensions/mv3/intro/"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"condition": {
|
|
12
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/mv2/",
|
|
13
|
+
"resourceTypes": ["main_frame"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": 2,
|
|
18
|
+
"priority": 1,
|
|
19
|
+
"action": {
|
|
20
|
+
"type": "redirect",
|
|
21
|
+
"redirect": {
|
|
22
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/action/"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"condition": {
|
|
26
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/browserAction/",
|
|
27
|
+
"resourceTypes": ["main_frame"]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": 3,
|
|
32
|
+
"priority": 1,
|
|
33
|
+
"action": {
|
|
34
|
+
"type": "redirect",
|
|
35
|
+
"redirect": {
|
|
36
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"condition": {
|
|
40
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/declarativeWebRequest/",
|
|
41
|
+
"resourceTypes": ["main_frame"]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": 4,
|
|
46
|
+
"priority": 1,
|
|
47
|
+
"action": {
|
|
48
|
+
"type": "redirect",
|
|
49
|
+
"redirect": {
|
|
50
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/action/"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"condition": {
|
|
54
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/pageAction/",
|
|
55
|
+
"resourceTypes": ["main_frame"]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": 5,
|
|
60
|
+
"priority": 1,
|
|
61
|
+
"action": {
|
|
62
|
+
"type": "redirect",
|
|
63
|
+
"redirect": {
|
|
64
|
+
"url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"condition": {
|
|
68
|
+
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/webRequest/",
|
|
69
|
+
"resourceTypes": ["main_frame"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# init
|
|
2
|
+
|
|
3
|
+
> A minimum extension template. This template includes a manifest file.
|
|
4
|
+
|
|
5
|
+
## Scripts Available
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### yarn dev
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
// Runs the app in the development mode.
|
|
13
|
+
// Will open a new browser instance with your extension loaded.
|
|
14
|
+
// The page will reload when you make changes.
|
|
15
|
+
yarn dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### yarn start
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
// Runs the app in the production mode.
|
|
22
|
+
// Will open a new browser instance with your extension loaded.
|
|
23
|
+
// This is how your browser extension will work once published.
|
|
24
|
+
yarn start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### yarn build
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
// Builds the app for production.
|
|
31
|
+
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"license": "MIT",
|
|
3
|
+
"repository": {
|
|
4
|
+
"type": "git",
|
|
5
|
+
"url": "https://github.com/extension-js/extension.git",
|
|
6
|
+
"directory": "examples/init"
|
|
7
|
+
},
|
|
8
|
+
"name": "init",
|
|
9
|
+
"description": "An Extension.js example.",
|
|
10
|
+
"version": "0.0.1",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"extension",
|
|
13
|
+
"browser-extension",
|
|
14
|
+
"web-extension",
|
|
15
|
+
"template"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "extension dev",
|
|
19
|
+
"start": "extension start",
|
|
20
|
+
"build": "extension build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"extension": "latest"
|
|
25
|
+
},
|
|
26
|
+
"private": true,
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "Your Name",
|
|
29
|
+
"email": "your@email.com",
|
|
30
|
+
"url": "https://yourwebsite.com"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# locales
|
|
2
|
+
|
|
3
|
+
> An Extension.js example.
|
|
4
|
+
|
|
5
|
+
## Scripts Available
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### yarn dev
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
// Runs the app in the development mode.
|
|
13
|
+
// Will open a new browser instance with your extension loaded.
|
|
14
|
+
// The page will reload when you make changes.
|
|
15
|
+
yarn dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### yarn start
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
// Runs the app in the production mode.
|
|
22
|
+
// Will open a new browser instance with your extension loaded.
|
|
23
|
+
// This is how your browser extension will work once published.
|
|
24
|
+
yarn start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### yarn build
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
// Builds the app for production.
|
|
31
|
+
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Action Extension</title>
|
|
7
|
+
<link
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
href="https://unpkg.com/sakura.css/css/sakura.css"
|
|
10
|
+
media="screen"
|
|
11
|
+
/>
|
|
12
|
+
<link
|
|
13
|
+
rel="stylesheet"
|
|
14
|
+
href="https://unpkg.com/sakura.css/css/sakura-dark.css"
|
|
15
|
+
media="screen and (prefers-color-scheme: dark)"
|
|
16
|
+
/>
|
|
17
|
+
<link rel="stylesheet" href="./styles.css" media="screen" />
|
|
18
|
+
</head>
|
|
19
|
+
<body class="popup">
|
|
20
|
+
<header>
|
|
21
|
+
<div>
|
|
22
|
+
<img
|
|
23
|
+
class="action"
|
|
24
|
+
src="../images/extension_128.png"
|
|
25
|
+
alt="The Extension logo"
|
|
26
|
+
width="72px"
|
|
27
|
+
/>
|
|
28
|
+
<br />
|
|
29
|
+
<h1 id="title"></h1>
|
|
30
|
+
</div>
|
|
31
|
+
<p>
|
|
32
|
+
<span id="learnMore"></span>
|
|
33
|
+
<a href="https://extension.js.org" target="_blank"
|
|
34
|
+
>https://extension.js.org</a
|
|
35
|
+
>.
|
|
36
|
+
</p>
|
|
37
|
+
</header>
|
|
38
|
+
</body>
|
|
39
|
+
<script src="./scripts.js"></script>
|
|
40
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
body {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
width: 300px;
|
|
6
|
+
padding: 2em;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
h1 {
|
|
10
|
+
font-size: 2.7em;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.action {
|
|
14
|
+
filter: grayscale(1);
|
|
15
|
+
transition:
|
|
16
|
+
filter 2s,
|
|
17
|
+
border-color 2s;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.action:hover {
|
|
21
|
+
filter: grayscale(0);
|
|
22
|
+
border-color: aquamarine;
|
|
23
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"name": "locales",
|
|
5
|
+
"author": "Your Name",
|
|
6
|
+
"default_locale": "en",
|
|
7
|
+
"description": "An Extension.js example.",
|
|
8
|
+
"icons": {
|
|
9
|
+
"16": "images/extension_16.png",
|
|
10
|
+
"48": "images/extension_48.png",
|
|
11
|
+
"128": "images/extension_128.png"
|
|
12
|
+
},
|
|
13
|
+
"action": {
|
|
14
|
+
"default_popup": "action/index.html"
|
|
15
|
+
},
|
|
16
|
+
"permissions": [
|
|
17
|
+
"activeTab"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "locales",
|
|
3
|
+
"description": "An Extension.js example.",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Your Name",
|
|
7
|
+
"email": "your@email.com",
|
|
8
|
+
"url": "https://yourwebsite.com"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "extension dev",
|
|
13
|
+
"start": "extension start",
|
|
14
|
+
"build": "extension build"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"extension": "latest"
|
|
19
|
+
},
|
|
20
|
+
"private": true
|
|
21
|
+
}
|
package/dist/module.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";var We=Object.create;var D=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var ze=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var
|
|
1
|
+
"use strict";var We=Object.create;var D=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var ze=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var s in t)D(e,s,{get:t[s],enumerable:!0})},W=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ae(t))!Ge.call(e,n)&&n!==s&&D(e,n,{get:()=>t[n],enumerable:!(i=Oe(t,n))||i.enumerable});return e};var l=(e,t,s)=>(s=e!=null?We(ze(e)):{},W(t||!e||!e.__esModule?D(s,"default",{value:e,enumerable:!0}):s,e)),Ve=e=>W(D({},"__esModule",{value:!0}),e);var qe={};je(qe,{extensionCreate:()=>Le});module.exports=Ve(qe);var C=l(require("path"));var x=l(require("path")),r=require("@colors/colors/safe"),O=l(require("fs/promises")),A=require("detect-package-manager");function z(e){let t=x.default.basename(e);return`Failed to write in the destination directory. Path for \`${t}\` is not writable.
|
|
2
2
|
Ensure you have write permissions for this folder.
|
|
3
|
-
Path: ${t}`}async function G(e,t){let
|
|
4
|
-
Conflict! Path to ${(0,r.cyan)(
|
|
3
|
+
Path: ${t}`}async function G(e,t){let s=x.default.basename(e),i=`
|
|
4
|
+
Conflict! Path to ${(0,r.cyan)(s)} includes conflicting files:
|
|
5
5
|
|
|
6
|
-
`;for(let n of t){let o=await O.default.lstat(
|
|
6
|
+
`;for(let n of t){let o=await O.default.lstat(x.default.join(e,n));i+=o.isDirectory()?`${(0,r.gray)("-")} ${(0,r.brightYellow)(n)}
|
|
7
7
|
`:`${(0,r.gray)("-")} ${(0,r.brightYellow)(n)}
|
|
8
|
-
`}return
|
|
8
|
+
`}return i+=`
|
|
9
9
|
You need to either rename/remove the files listed above, or choose a new directory name for your extension.
|
|
10
10
|
|
|
11
|
-
Path to conflicting directory: ${(0,r.underline)(e)}`,
|
|
11
|
+
Path to conflicting directory: ${(0,r.underline)(e)}`,i}function j(){return"You need to provide an extension name to create one. \nSee `--help` for command info."}function V(){return"URLs are not allowed as a project path. Either write a name or a path to a local folder."}async function X(e,t){let s=x.default.relative(process.cwd(),e),i=await(0,A.detect)(),n="npm run";switch(i){case"yarn":n="yarn dev";break;case"pnpm":n="pnpm run dev";break;default:n="npm run dev"}return`\u{1F9E9} - ${(0,r.brightGreen)("Success!")} Extension ${(0,r.cyan)(t)} created.
|
|
12
12
|
|
|
13
|
-
Now ${(0,r.brightBlue)(`cd ${(0,r.underline)(
|
|
13
|
+
Now ${(0,r.brightBlue)(`cd ${(0,r.underline)(s)}`)} and ${(0,r.brightBlue)(`${n}`)} to open a new browser instance
|
|
14
14
|
with your extension installed, loaded, and enabled for development.
|
|
15
15
|
|
|
16
|
-
${(0,r.brightGreen)("You are ready")}. Time to hack on your extension!`}function U(e){return`\u{1F423} - Starting a new browser extension named ${(0,r.cyan)(e)}...`}function Y(){return"\u{1F91E} - Checking if destination path is writeable..."}function L(){return"\u{1F50E} - Scanning for potential conflicting files..."}function q(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't create directory ${(0,r.cyan)(e)}. ${t}`}function H(e){return`\u{1F537} - Writing ${(0,r.cyan)(e)} type definitions...`}function B(e){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Failed to write the extension type definition. ${e}`}function
|
|
16
|
+
${(0,r.brightGreen)("You are ready")}. Time to hack on your extension!`}function U(e){return`\u{1F423} - Starting a new browser extension named ${(0,r.cyan)(e)}...`}function Y(){return"\u{1F91E} - Checking if destination path is writeable..."}function L(){return"\u{1F50E} - Scanning for potential conflicting files..."}function q(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't create directory ${(0,r.cyan)(e)}. ${t}`}function H(e){return`\u{1F537} - Writing ${(0,r.cyan)(e)} type definitions...`}function B(e){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Failed to write the extension type definition. ${e}`}function E(e,t){return t==="init"?`\u{1F9F0} - Installing ${(0,r.cyan)(e)}...`:`\u{1F9F0} - Installing ${(0,r.cyan)(e)} from template ${(0,r.brightBlue)(t)}...`}function k(e,t,s){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't find template ${(0,r.brightBlue)(t)} for ${(0,r.cyan)(e)}. ${s}`}function K(e){return`\u{1F332} - Initializing git repository for ${(0,r.cyan)(e)}...`}function Q(e,t,s){return`Command ${e} ${t.join(" ")} failed with exit code ${s}`}function Z(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Child process error: Can't initialize ${(0,r.brightYellow)("git")} for ${(0,r.cyan)(e)}. ${t.message}`}function ee(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't initialize ${(0,r.brightYellow)("git")} for ${(0,r.cyan)(e)}. ${t.message||t.toString()}`}function te(){return"\u{1F6E0} - Installing dependencies... (takes a moment)"}function ne(e,t,s){return`Command ${e} ${t.join(" ")} failed with exit code ${s}`}function ie(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Child process error: Can't install dependencies for ${(0,r.cyan)(e)}. ${t}`}function re(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't install dependencies for ${(0,r.cyan)(e)}. ${t.message||t.toString()}`}function se(){return"Symlink created successfully."}function oe(e,t){return`Failed to create symlink: ${e} ${t.join(" ")}`}function ae(){return`\u{1F4DD} - Writing ${(0,r.brightYellow)("package.json")} metadata...`}function le(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write ${(0,r.brightYellow)("package.json")} for ${(0,r.cyan)(e)}. ${t}`}function ce(){return`\u{1F4DC} - Writing ${(0,r.brightYellow)("manifest.json")} metadata...`}function me(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write ${(0,r.brightYellow)("manifest.json")} for ${(0,r.cyan)(e)}. ${t}`}function pe(){return`\u{1F4C4} - Writing ${(0,r.brightYellow)("README.md")} metadata...`}function ge(e,t){return`${(0,r.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Can't write the ${(0,r.brightYellow)("README.md")} file for ${(0,r.cyan)(e)}. ${t}`}function de(e){return`\u{1F91D} - Ensuring ${(0,r.cyan)(e)} folder exists...`}function fe(e){return"Error while checking directory writability: "+e}var h=l(require("fs/promises")),$=l(require("path")),ue=require("detect-package-manager");async function S(e,t){let s=await h.default.readdir(e,{withFileTypes:!0});return await h.default.mkdir(t,{recursive:!0}),await Promise.all(s.map(async i=>{let n=$.default.join(e,i.name),o=$.default.join(t,i.name);i.isDirectory()?await S(n,o):await h.default.copyFile(n,o)}))}async function y(){let e=await(0,ue.detect)(),t="npm run";switch(e){case"yarn":t="yarn";break;case"pnpm":t="pnpm run";break;default:t="npm run"}return t}function ye(e){let t=$.default.resolve(__dirname,"template");return $.default.resolve(e,t)}async function we(e,t){try{return console.log(de(t)),await h.default.mkdir(e,{recursive:!0}),!0}catch(s){return console.log(fe(s)),!1}}function J(e){return e!=="init"}function xe(e){return J(e)?!1:e==="typescript"||e.startsWith("typescript-")||e.endsWith("-typescript")}var Ee=l(require("path")),I=l(require("fs/promises"));var Xe=["LICENSE","node_modules"];async function he(e,t){console.log(U(t));try{let s=await we(e,t);console.log(Y()),s||(console.error(z(e)),process.exit(1));let i=await I.default.readdir(e);console.log(L());let n=await Promise.all(i.filter(o=>!o.startsWith(".")).filter(o=>!o.endsWith(".log")).filter(o=>!Xe.includes(o)).map(async o=>(await I.default.lstat(Ee.default.join(e,o))).isDirectory()?`${o}/`:`${o}`));if(n.length>0){let o=await G(e,n);throw new Error(o)}}catch(s){console.error(q(t,s)),process.exit(1)}}var $e=l(require("path"));async function ve(e,t,s){let i=$e.default.resolve(__dirname,"template");try{console.log(E(t,s)),await S(i,e)}catch(n){console.error(k(t,s,n)),process.exit(1)}}var p=l(require("path")),u=l(require("fs/promises")),De=l(require("go-git-it"));async function ke(e,t,s){let i=p.default.dirname(e),n=p.default.basename(s),a=`https://github.com/extension-js/extension.js/tree/main/examples/${s}`;try{await u.default.mkdir(e,{recursive:!0});let c="";process.env.EXTENSION_ENV==="development"?(console.log(E(t,s)),c=p.default.join(e,n),await u.default.cp(p.default.join(__dirname,"..","..","..","examples",n),c,{recursive:!0})):(await(0,De.default)(a,i,E(t,n)),c=p.default.join(i,n)),t!==n?await u.default.rename(c,p.default.join(i,t)):(await u.default.rename(c,p.default.join(i,t+"-temp")),await u.default.cp(p.default.join(i,t+"-temp",n),p.default.join(i,t),{recursive:!0}),await u.default.rm(p.default.join(i,t+"-temp"),{recursive:!0}))}catch(c){console.error(k(t,n,c)),process.exit(1)}}var v=l(require("path")),P=l(require("fs/promises"));var Ue={dev:process.env.EXTENSION_ENV==="development"?"node node_modules/extension dev":"extension dev",start:process.env.EXTENSION_ENV==="development"?"node node_modules/extension start":"extension start",build:process.env.EXTENSION_ENV==="development"?"node node_modules/extension build":"extension build"};async function be(e,t,s){let i=ye(process.cwd()),n=J(s)?v.default.join(e,"package.json"):v.default.join(i,"package.json"),o=await P.default.readFile(n),a=JSON.parse(o.toString());a.scripts=a.scripts||{},a.dependencies=a.dependencies||{},a.devDependencies={...a.devDependencies||{},extension:process.env.EXTENSION_ENV==="development"?"*":"latest"};let c={...a,name:v.default.basename(e),private:!0,scripts:{...a.scripts,...Ue},dependencies:a.dependencies,devDependencies:a.devDependencies,author:{name:"Your Name",email:"your@email.com",url:"https://yourwebsite.com"}};try{console.log(ae()),await P.default.writeFile(v.default.join(e,"package.json"),JSON.stringify(c,null,2))}catch(g){console.error(le(t,g)),process.exit(1)}}var Ce=l(require("path")),Se=require("cross-spawn"),Je=l(require("fs"));var Te=l(require("path")),M=require("cross-spawn");async function Fe(e){let t=Te.default.join(__dirname,"../../cli"),s=await y(),i=["link"];await new Promise((n,o)=>{(0,M.spawn)(s,i,{cwd:t}).on("close",()=>{(0,M.spawn)(s,[...i,"extension"],{stdio:"inherit",cwd:e}).on("close",g=>{g===0?(console.log(se()),n()):o(new Error(oe(s,i)))})})}),console.log("Symlink creation completed.")}function Ye(){return["install","--silent"]}async function Ie(e,t){console.time("installDependencies");let s=Ce.default.join(e,"node_modules"),i=await y(),n=Ye();console.log(te()),process.env.EXTENSION_ENV==="development"&&await Fe(e);try{let o=process.cwd();process.chdir(e),await Je.default.promises.mkdir(s,{recursive:!0});let a=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",c=(0,Se.spawn)(i,n,{stdio:a});await new Promise((g,d)=>{c.on("close",w=>{process.chdir(o),w!==0?d(new Error(ne(i,n,w))):g()}),c.on("error",w=>{process.chdir(o),console.error(ie(t,w)),d(w)})}),console.timeEnd("installDependencies")}catch(o){console.error(re(t,o)),process.exit(1)}}var b=l(require("path")),T=l(require("fs/promises"));async function Pe(e,t){let s=await T.default.readFile(b.default.join(__dirname,"template","README.md"),"utf-8"),i=await y(),n=require(b.default.join(e,"manifest.json")),o=s.replaceAll("[projectName]",t).replaceAll("[templateDescription]",n.description).replaceAll("[runCommand]",i);try{console.log(pe()),await T.default.mkdir(e,{recursive:!0}),await T.default.writeFile(b.default.join(e,"README.md"),o)}catch(a){console.error(ge(t,a)),process.exit(1)}}var F=l(require("path")),_=l(require("fs/promises"));async function Me(e,t){let s=F.default.join(e,"manifest.json"),i=await _.default.readFile(s),o={...JSON.parse(i.toString()),name:F.default.basename(e),author:"Your Name"};try{console.log(ce()),await _.default.writeFile(F.default.join(e,"manifest.json"),JSON.stringify(o,null,2))}catch(a){console.error(me(t,a)),process.exit(1)}}var R=l(require("path")),N=l(require("fs/promises"));async function _e(e,t){let s=R.default.join(e,"extension-env.d.ts"),i=process.env.EXTENSION_ENV==="development"?R.default.resolve(process.cwd(),"programs/develop/types"):"extension-develop/dist/types",n=`// Required Extension.js types for TypeScript projects.
|
|
17
17
|
// This file auto-generated and should not be excluded.
|
|
18
18
|
// If you need extra types, consider creating a new *.d.ts and
|
|
19
19
|
// referencing it in the "include" array in your tsconfig.json file.
|
|
20
20
|
// See https://www.typescriptlang.org/tsconfig#include for info.
|
|
21
|
-
/// <reference types="${
|
|
21
|
+
/// <reference types="${i}/index.d.ts" />
|
|
22
22
|
|
|
23
23
|
// Polyfill types for browser.* APIs.
|
|
24
|
-
/// <reference types="${
|
|
25
|
-
`;try{await
|
|
24
|
+
/// <reference types="${i}/polyfill.d.ts" />
|
|
25
|
+
`;try{await N.default.mkdir(e,{recursive:!0}),console.log(H(t)),await N.default.writeFile(s,n)}catch(o){console.error(B(o)),process.exit(1)}}var Re=require("cross-spawn");async function Ne(e,t){let s="git",i=["init","--quiet"];console.log(K(t));try{let n=process.cwd();process.chdir(e);let o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",a=(0,Re.spawn)(s,i,{stdio:o});await new Promise((c,g)=>{a.on("close",d=>{process.chdir(n),d!==0?g(new Error(Q(s,i,d))):c()}),a.on("error",d=>{process.chdir(n),console.error(Z(t,d)),g(d)})})}catch(n){console.error(ee(t,n)),process.exit(1)}}async function Le(e,{template:t="init",noInstall:s=!1}){if(!e)throw new Error(j());if(e.startsWith("http"))throw new Error(V());let i=C.default.isAbsolute(e)?e:C.default.join(process.cwd(),e),n=C.default.basename(i);try{await he(i,n),t==="init"?await ve(i,n,t):await ke(i,n,t),await be(i,n,t),s||await Ie(i,n),await Pe(i,n),await Me(i,n),await Ne(i,n),xe(t)&&await _e(i,n);let o=await X(i,n);console.log(o)}catch(o){throw console.error(o),o}}0&&(module.exports={extensionCreate});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# new-less
|
|
2
|
+
|
|
3
|
+
> An Extension.js example.
|
|
4
|
+
|
|
5
|
+
## Scripts Available
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### yarn dev
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
// Runs the app in the development mode.
|
|
13
|
+
// Will open a new browser instance with your extension loaded.
|
|
14
|
+
// The page will reload when you make changes.
|
|
15
|
+
yarn dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### yarn start
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
// Runs the app in the production mode.
|
|
22
|
+
// Will open a new browser instance with your extension loaded.
|
|
23
|
+
// This is how your browser extension will work once published.
|
|
24
|
+
yarn start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### yarn build
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
// Builds the app for production.
|
|
31
|
+
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"name": "new-less",
|
|
5
|
+
"description": "An Extension.js example.",
|
|
6
|
+
"icons": {
|
|
7
|
+
"16": "images/extension_16.png",
|
|
8
|
+
"48": "images/extension_48.png",
|
|
9
|
+
"128": "images/extension_128.png"
|
|
10
|
+
},
|
|
11
|
+
"chrome_url_overrides": {
|
|
12
|
+
"newtab": "newtab/index.html"
|
|
13
|
+
},
|
|
14
|
+
"author": "Your Name"
|
|
15
|
+
}
|