extension-develop 2.0.0-rc.24 → 2.0.0-rc.25
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/add-hmr-accept-code.js +2 -68
- package/dist/depreacated-shadow-root.js +34 -0
- package/dist/deprecated-shadow-root.js +14 -72
- package/dist/ensure-hmr-for-scripts.js +2 -179
- package/dist/inject-chromium-client-loader.js +2 -77
- package/dist/inject-content-css-during-dev.js +10 -0
- package/dist/inject-firefox-client-loader.js +9 -81
- package/dist/minimum-chromium-file.mjs +1 -0
- package/dist/minimum-content-file.mjs +1 -0
- package/dist/minimum-firefox-file.mjs +1 -0
- package/dist/minimum-script-file.mjs +0 -0
- package/dist/module.d.ts +96 -7
- package/dist/module.js +128 -6286
- package/dist/package-lock.json +2542 -0
- package/dist/package.json +10 -0
- package/dist/resolver-loader.js +1 -0
- package/dist/resolver-module.mjs +1 -0
- package/dist/tailwind.config.js +25 -0
- package/package.json +14 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var V=Object.create;var g=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Q=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},y=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of K(t))!Y.call(e,o)&&o!==r&&g(e,o,{get:()=>t[o],enumerable:!(n=G(t,o))||n.enumerable});return e};var l=(e,t,r)=>(r=e!=null?V(X(e)):{},y(t||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),Z=e=>y(g({},"__esModule",{value:!0}),e);var he={};Q(he,{default:()=>J});module.exports=Z(he);var m=l(require("path")),z=require("schema-utils");var v=require("@swc/core"),_=require("acorn"),P=l(require("acorn-walk")),M=require("astring");function ee(e,t){let r=e;for(let n=t.length-1;n>=0;n--){if(n===0)return r.type==="Identifier"&&r.name===t[n];if(r.type!=="MemberExpression"||r.property.type!=="Identifier"||r.property.name!==t[n])return!1;r=r.object}return!0}function s(e,t){let r=t.split(".");return ee(e,r)}function u(e,t){if(e.arguments.length===0)return;let r=e.arguments[0];e.arguments[0]={type:"CallExpression",callee:{type:"Identifier",name:t},arguments:[r]}}function h(e,t){if(e.arguments.length!==0){if(t==="chrome.devtools.panels.create"||t==="browser.devtools.panels.create")e.arguments[1]={type:"CallExpression",callee:{type:"Identifier",name:"r.solve"},arguments:[e.arguments[1]]},e.arguments[2]={type:"CallExpression",callee:{type:"Identifier",name:"r.solve"},arguments:[e.arguments[2]]};else if(t==="chrome.runtime.getURL"||t==="browser.runtime.getURL"){if(e.arguments[0].type==="Literal"&&e.arguments[0].value.includes("/_favicon/"))return;e.arguments[0]={type:"CallExpression",callee:{type:"Identifier",name:"r.solve"},arguments:[e.arguments[0]]}}}}function te(e,t,r,n){(s(e,`${n}.action.setIcon`)||s(e,`${n}.browserAction.setIcon`)||s(e,`${n}.pageAction.setIcon`)||s(e,`${n}.declarativeContent.SetIcon`)||s(e,`${n}.action.setPopup`)||s(e,`${n}.browserAction.setPopup`)||s(e,`${n}.pageAction.setPopup`)||s(e,`${n}.scriptBadge.setPopup`))&&u(r,"r.solve"),s(e,`${n}.devtools.panels.create`)&&h(r,`${n}.devtools.panels.create`),s(e,`${n}.downloads.download`)&&u(r,"r.solve"),s(e,`${n}.runtime.getURL`)&&h(r,`${n}.runtime.getURL`),(s(e,`${n}.scripting.insertCSS`)||s(e,`${n}.scripting.removeCSS`)||s(e,`${n}.scripting.executeScript`))&&u(r,"r.solve"),(s(e,`${n}.scripting.registerContentScripts`)||s(e,`${n}.declarativeContent.RequestContentScript`))&&u(r,"r.solve"),s(e,`${n}.declarativeContent.RequestContentScript`)&&u(r,"r.solve"),(s(e,`${n}.tabs.create`)||s(e,`${n}.tabs.executeScript`)||s(e,`${n}.tabs.insertCSS`)||s(e,`${n}.windows.create`))&&t.length>0&&u(r,"r.solve"),s(e,`${n}.sidePanel.setOptions`)&&u(r,"r.solve"),s(e,`${n}.notifications.create`)&&u(r,"r.solve")}function E(e,t){let r=(0,v.transformSync)(e,{module:{type:"es6"},minify:t.minify,jsc:{loose:!0,target:"es2016",externalHelpers:!0,parser:{syntax:t.typescript?"typescript":"ecmascript",jsx:!t.typescript&&t.jsx,tsx:t.typescript&&t.jsx,dynamicImport:!0},transform:{react:{runtime:"automatic",importSource:"react"}}}}),n=(0,_.parse)(r.code,{sourceType:"module",ecmaVersion:"latest"});return P.simple(n,{CallExpression(i){let a=["chrome","browser"],c=i.callee,d=i.arguments;a.forEach(f=>{te(c,d,i,f)})}}),(0,M.generate)(n)}var b=l(require("fs"));var x=l(require("path"));function S(e){if(!e||!e.background)return;let t=e.background.scripts;if(t)return t.map(r=>r)}function w(e){if(!e||!e.background)return;if(e.background.service_worker)return e.background.service_worker}function D(e){if(!e||!e.content_scripts)return{"content_scripts/content-0.js":void 0};let t=i=>{if(i.js?.length!==0)return i.js?.map(a=>a)},r=i=>{if(i.css?.length!==0)return i.css?.map(a=>a)},n={},o=e.content_scripts;for(let[i,a]of o.entries()){let c=t(a),d=r(a);n[`content_scripts/content-${i}`]=[...(c||[]).filter(f=>f!=null),...(d||[]).filter(f=>f!=null)]}return n}function j(e){return!e||!e.user_scripts||!e.user_scripts.api_script?void 0:e.user_scripts.api_script}function k(e){return!e||!e.action||!e.action.default_popup?void 0:e.action.default_popup}function A(e){return!e||!e.background||!e.background.page?void 0:e.background.page}function F(e){return!e||!e.browser_action||!e.browser_action.default_popup?void 0:e.browser_action.default_popup}function O(e){let t={newtab:void 0};return!e||!e.chrome_url_overrides?{"chrome_url_overrides/newtab.html":void 0}:(e.chrome_url_overrides.history&&(t={"chrome_url_overrides/history.html":e.chrome_url_overrides.history}),e.chrome_url_overrides.newtab&&(t={"chrome_url_overrides/newtab.html":e.chrome_url_overrides.newtab}),e.chrome_url_overrides.bookmarks&&(t={"chrome_url_overrides/bookmarks.html":e.chrome_url_overrides.bookmarks}),t)}function R(e){return!e||!e.devtools_page?void 0:e.devtools_page}function I(e){return e.options_page?e.options_page:!e||!e.options_ui||!e.options_ui.page?void 0:e.options_ui.page}function N(e){return!e||!e.page_action||!e.page_action.default_popup?void 0:e.page_action.default_popup}function T(e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0.html":void 0};let t=e.sandbox.pages,r={};for(let[n,o]of t.entries()){let i=o;r[`sandbox/page-${n}.html`]=i}return r}function C(e){return!e||!e.side_panel||!e.side_panel.default_path?void 0:e.side_panel.default_path}function L(e){return!e||!e.sidebar_action||!e.sidebar_action.default_panel?void 0:e.sidebar_action.default_panel}function U(e){return{"background/scripts.js":S(e),"background/service_worker.js":w(e),...D(e),"user_scripts/apiscript.js":j(e),"action/default_popup.html":k(e),"background/page.html":A(e),"browser_action/default_popup.html":F(e),...O(e),"devtools_page.html":R(e),"options_ui/page.html":I(e),"page_action/default_popup.html":N(e),...T(e),"side_panel/default_path.html":C(e),"sidebar_action/default_panel.html":L(e)}}var ae=l(require("path")),ce=l(require("fs")),ue=require("child_process"),pe=require("package-manager-detector");var oe=l(require("path")),p=require("@colors/colors/safe");var W=l(require("path")),re=W.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),$=["chrome","edge"],ne=["firefox"],et=[...$,...ne];var se=require("console");function H(e,t){return JSON.parse(JSON.stringify(e),function(o,i){let a=o.indexOf(":");if(a===-1)return i;let c=o.substring(0,a);(c===t||c==="chromium"&&$.includes(t)||c==="chromium"&&t.includes("chromium")||c==="gecko"&&t.includes("gecko"))&&(this[o.substring(a+1)]=i)})}function de(e,t){let r=x.default.dirname(e);return Object.entries(t||{}).reduce((o,[i,a])=>{let c=x.default.relative(r,a);return o[i]=c,o},{})}function fe(e,t){let r=require(e),n=H(r,t);return U(n)}function q(e,t,r){let n=de(e,r),o=fe(e,t);return{...n,...o}}function B(e,t){let r=e.getOptions(),{manifestPath:n,includeList:o,browser:i}=r,a=JSON.stringify(q(n,i,o)),d=b.default.readFileSync(t,"utf8").replace('"__RESOLVER_MODULE_FILE_LIST__"',`${a}`);b.default.writeFileSync(t,d)}var ge={type:"object",properties:{test:{type:"string"},browser:{type:"string"},manifestPath:{type:"string"},includeList:{type:"object"},excludeList:{type:"object"},loaderOptions:{type:"object"}}};function me(e,t){if(!e.content_scripts)return[];let r=[];return e.content_scripts.forEach(n=>{n.js&&n.js.forEach(o=>{r.push(m.default.resolve(t,o))})}),r}function J(e){let t=this.getOptions();if((0,z.validate)(ge,t,{name:"resolve:loader",baseDataPath:"options"}),new RegExp(t.test).test(this.resourcePath)){let r="resolver-module.mjs";if(this.resourcePath.includes("node_modules")||this.resourcePath.includes("dist/"))return e;let n=m.default.dirname(t.manifestPath);if(me(require(t.manifestPath),n).some(c=>c===this.resourcePath))return e;let i=E(e,t),a=m.default.join(__dirname,r);return B(this,a),i}return e}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c={resolverNotFoundError(){console.error('Could not resolve file path. Ensure the file exists in the "public" or "pages" directory.')},resolverHtmlError:r=>(console.error(`Could not resolve path ${r}. Either add it to the "public" directory or create a page in the "pages" directory.`),r),resolverJsError:r=>`Could not resolve path ${r}. Either add it to the "public" directory or create a script in the "scripts" directory.`,resolverStaticError:r=>`Could not resolve path ${r}. If you want to preserve this file path, add the file to the "public" directory.`};function p(r){let n=r.split("/"),t=[];for(let s of n)s===".."||s==="."||s!==""&&t.push(s);return t.join("/")}function u(r){return r?.endsWith(".html")?(console.error(c.resolverHtmlError(r)),r):r?.endsWith(".js")?(console.error(c.resolverJsError(r)),r):(r&&console.error(c.resolverStaticError(r)),r)}var l={data:"__RESOLVER_MODULE_FILE_LIST__"};function e(r){if(!r)return c.resolverNotFoundError(),"";if(r?.startsWith("http")||r?.startsWith("chrome://")||r?.startsWith("about:"))return r;if(r?.startsWith("chrome-extension://")){let s=chrome.runtime.getURL("");if(r.startsWith(s)){let o=r.replace(s,"");return chrome.runtime.getURL(e(o))}return r}if(r?.startsWith("/_favicon"))return r;let n=Object.entries(l.data).find(([s,o])=>{let i=p(r);return o===i||o===`pages/${i}`||o===`scripts/${i}`?s:!1}),t=p(r);return t.includes("public/")?"/"+t:n&&n.length?n[0]:(r!=="/"&&u(r),r)}function a(r){if(typeof r=="string")return e(r);let n=t=>({...t,...t?.path&&{path:typeof t.path=="string"?e(t.path):Object.entries(t.path).reduce((s,[o,i])=>(s[o]=e(i),s),{})},...t?.popup&&{popup:e(t.popup)},...t?.url&&{url:Array.isArray(t?.url)?t?.url.map(s=>e(s)):e(t?.url)},...t?.iconUrl&&{iconUrl:e(t.iconUrl)},...t?.files&&{files:t.files.map(s=>e(s))},...t?.js&&{js:Array.isArray(t.js)?t.js.map(s=>e(s)):t.js},...t?.css&&{css:Array.isArray(t.css)?t.css.map(s=>e(s)):t.css}});return Array.isArray(r)?r.map(t=>n(t)):{...n(r||{})}}var g={solve:a},d=g;export{d as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
|
|
4
|
+
const [, pathOrRemoteUrl] = process.argv.slice(2)
|
|
5
|
+
const projectDir = pathOrRemoteUrl.startsWith('http')
|
|
6
|
+
? process.cwd() + path.basename(pathOrRemoteUrl)
|
|
7
|
+
: path.resolve(__dirname, pathOrRemoteUrl)
|
|
8
|
+
|
|
9
|
+
const tailwindConfig = path.join(projectDir, 'tailwind.config.js')
|
|
10
|
+
|
|
11
|
+
/** @type {import('tailwindcss').Config} */
|
|
12
|
+
const tailwindConfigData = fs.existsSync(tailwindConfig)
|
|
13
|
+
? require(tailwindConfig)
|
|
14
|
+
: {content: []}
|
|
15
|
+
|
|
16
|
+
/** @type {import('tailwindcss').Config} */
|
|
17
|
+
const tailwindRootConfig = {
|
|
18
|
+
...tailwindConfigData,
|
|
19
|
+
content: [
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
21
|
+
...tailwindConfigData.content.map((file) => path.join(projectDir, file))
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = tailwindRootConfig
|
package/package.json
CHANGED
|
@@ -8,28 +8,22 @@
|
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"types": "./dist/module.d.ts",
|
|
15
|
-
"import": "./dist/module.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
11
|
+
"name": "extension-develop",
|
|
12
|
+
"version": "2.0.0-rc.25",
|
|
13
|
+
"description": "The develop step of Extension.js",
|
|
18
14
|
"main": "./dist/module.js",
|
|
19
15
|
"types": "./dist/module.d.ts",
|
|
20
16
|
"files": [
|
|
21
17
|
"dist"
|
|
22
18
|
],
|
|
23
|
-
"name": "extension-develop",
|
|
24
|
-
"version": "2.0.0-rc.24",
|
|
25
|
-
"description": "The develop step of Extension.js",
|
|
26
19
|
"author": {
|
|
27
20
|
"name": "Cezar Augusto",
|
|
28
21
|
"email": "boss@cezaraugusto.net",
|
|
29
22
|
"url": "https://cezaraugusto.com"
|
|
30
23
|
},
|
|
31
24
|
"dependencies": {
|
|
32
|
-
"@
|
|
25
|
+
"@colors/colors": "^1.6.0",
|
|
26
|
+
"@rspack/core": "^1.3.1",
|
|
33
27
|
"@rspack/dev-server": "^1.1.1",
|
|
34
28
|
"@swc/helpers": "^0.5.15",
|
|
35
29
|
"@types/firefox-webext-browser": "^120.0.4",
|
|
@@ -37,19 +31,17 @@
|
|
|
37
31
|
"adm-zip": "^0.5.16",
|
|
38
32
|
"axios": "^1.8.4",
|
|
39
33
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
40
|
-
"chalk": "^5.3.0",
|
|
41
34
|
"chokidar": "^4.0.1",
|
|
42
|
-
"chrome-
|
|
35
|
+
"chrome-location": "^1.2.1",
|
|
43
36
|
"content-security-policy-parser": "^0.6.0",
|
|
44
37
|
"cross-spawn": "^7.0.6",
|
|
45
38
|
"csv-loader": "^3.0.5",
|
|
46
39
|
"dotenv": "^16.4.7",
|
|
47
40
|
"dotenv-webpack": "^8.1.0",
|
|
48
|
-
"edge-location": "^1.
|
|
49
|
-
"firefox-location2": "1.0.0",
|
|
41
|
+
"edge-location": "^1.0.0",
|
|
50
42
|
"firefox-profile": "^4.7.0",
|
|
51
43
|
"fx-runner": "^1.4.0",
|
|
52
|
-
"go-git-it": "
|
|
44
|
+
"go-git-it": "2.0.4",
|
|
53
45
|
"ignore": "^6.0.2",
|
|
54
46
|
"loader-utils": "^3.3.1",
|
|
55
47
|
"micromatch": "^4.0.8",
|
|
@@ -69,7 +61,6 @@
|
|
|
69
61
|
"ws": "^8.18.0"
|
|
70
62
|
},
|
|
71
63
|
"devDependencies": {
|
|
72
|
-
"@rslib/core": "^0.6.9",
|
|
73
64
|
"@types/adm-zip": "^0.5.7",
|
|
74
65
|
"@types/case-sensitive-paths-webpack-plugin": "^2.1.9",
|
|
75
66
|
"@types/chrome": "^0.0.287",
|
|
@@ -78,7 +69,6 @@
|
|
|
78
69
|
"@types/jest": "^29.5.14",
|
|
79
70
|
"@types/loader-utils": "^2.0.6",
|
|
80
71
|
"@types/node": "^22.10.1",
|
|
81
|
-
"@types/sass-loader": "8.0.9",
|
|
82
72
|
"@types/webextension-polyfill": "^0.12.1",
|
|
83
73
|
"@types/ws": "^8.5.13",
|
|
84
74
|
"jest": "^29.7.0",
|
|
@@ -99,16 +89,17 @@
|
|
|
99
89
|
"react-refresh": "^0.14.2",
|
|
100
90
|
"sass-loader": "^16.0.4",
|
|
101
91
|
"svelte-loader": "^3.2.4",
|
|
92
|
+
"svelte-preprocess": "^6.0.3",
|
|
102
93
|
"vue-loader": "^17.4.2",
|
|
103
94
|
"vue-style-loader": "^4.1.3",
|
|
104
95
|
"vue-template-compiler": "^2.7.16"
|
|
105
96
|
},
|
|
106
97
|
"scripts": {
|
|
107
98
|
"clean": "rm -rf dist",
|
|
108
|
-
"watch": "
|
|
109
|
-
"compile": "
|
|
110
|
-
"test": "
|
|
111
|
-
"test:
|
|
112
|
-
"test:
|
|
99
|
+
"watch": "tsup-node ./module.ts --format cjs --dts --target=node18 --watch",
|
|
100
|
+
"compile": "tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh",
|
|
101
|
+
"test": "jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.*'",
|
|
102
|
+
"test:coverage": "jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts' --coverage",
|
|
103
|
+
"test:build": "jest ./build.spec.ts --no-cache --detectOpenHandles --forceExit"
|
|
113
104
|
}
|
|
114
105
|
}
|