extension-create 2.0.0-alpha.24 → 2.0.0-alpha.26

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 (37) hide show
  1. package/dist/test-template-config-babel/README.md +35 -0
  2. package/dist/test-template-config-babel/babel.config.json +4 -0
  3. package/dist/test-template-config-babel/extension.config.js +17 -0
  4. package/dist/test-template-config-babel/images/babel.png +0 -0
  5. package/dist/test-template-config-babel/images/extension_128.png +0 -0
  6. package/dist/test-template-config-babel/images/extension_16.png +0 -0
  7. package/dist/test-template-config-babel/images/extension_48.png +0 -0
  8. package/dist/test-template-config-babel/manifest.json +15 -0
  9. package/dist/test-template-config-babel/newtab/index.html +40 -0
  10. package/dist/test-template-config-babel/newtab/scripts.js +11 -0
  11. package/dist/test-template-config-babel/newtab/styles.css +22 -0
  12. package/dist/test-template-config-babel/package.json +24 -0
  13. package/dist/test-template-config-stylelint/.stylelintrc.json +3 -0
  14. package/dist/test-template-config-stylelint/newtab/index.html +1 -1
  15. package/dist/test-template-config-stylelint/package.json +3 -2
  16. package/dist/test-template-content-extension-config/README.md +35 -0
  17. package/dist/test-template-content-extension-config/background.ts +1 -0
  18. package/dist/test-template-content-extension-config/content/ContentApp.tsx +82 -0
  19. package/dist/test-template-content-extension-config/content/scripts.tsx +17 -0
  20. package/dist/test-template-content-extension-config/content/styles.css +10 -0
  21. package/dist/test-template-content-extension-config/extension.config.js +22 -0
  22. package/dist/test-template-content-extension-config/images/chromeWindow.png +0 -0
  23. package/dist/test-template-content-extension-config/images/extension_128.png +0 -0
  24. package/dist/test-template-content-extension-config/images/extension_16.png +0 -0
  25. package/dist/test-template-content-extension-config/images/extension_48.png +0 -0
  26. package/dist/test-template-content-extension-config/images/logo.svg +9 -0
  27. package/dist/test-template-content-extension-config/images/tailwind.png +0 -0
  28. package/dist/test-template-content-extension-config/images/tailwind_bg.png +0 -0
  29. package/dist/test-template-content-extension-config/images/typescript.png +0 -0
  30. package/dist/test-template-content-extension-config/manifest.json +28 -0
  31. package/dist/test-template-content-extension-config/package.json +44 -0
  32. package/dist/test-template-content-extension-config/postcss.config.js +6 -0
  33. package/dist/test-template-content-extension-config/tailwind.config.js +8 -0
  34. package/dist/test-template-content-extension-config/tsconfig.json +22 -0
  35. package/package.json +1 -1
  36. package/dist/test-template-config-stylelint/stylelint.config.json +0 -1
  37. /package/dist/test-template-config-stylelint/newtab/{styles.css → styles.scss} +0 -0
@@ -0,0 +1,35 @@
1
+ # test-template-config-babel
2
+
3
+ > An Extension.js example.
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run the following scripts:
8
+
9
+ ### pnpm dev
10
+
11
+ **Development Mode**: This command runs your extension in development mode. It will launch a new browser instance with your extension loaded. The page will automatically reload whenever you make changes to your code, allowing for a smooth development experience.
12
+
13
+ ```bash
14
+ pnpm dev
15
+ ```
16
+
17
+ ### pnpm start
18
+
19
+ **Production Preview**: This command runs your extension in production mode. It will launch a new browser instance with your extension loaded, simulating the environment and behavior of your extension as it will appear once published.
20
+
21
+ ```bash
22
+ pnpm start
23
+ ```
24
+
25
+ ### pnpm build
26
+
27
+ **Build for Production**: This command builds your extension for production. It optimizes and bundles your extension, preparing it for deployment to the target browser's store.
28
+
29
+ ```bash
30
+ pnpm build
31
+ ```
32
+
33
+ ## Learn More
34
+
35
+ To learn more about creating cross-browser extensions with Extension.js, visit the [official documentation](https://extension.js.org).
@@ -0,0 +1,4 @@
1
+ {
2
+ "presets": ["modern-browser-extension"],
3
+ "plugins": []
4
+ }
@@ -0,0 +1,17 @@
1
+ /** @type {import('extension-develop').FileConfig} */
2
+ module.exports = {
3
+ config: (config) => {
4
+ config.module.rules.push(
5
+ // https://webpack.js.org/loaders/babel-loader/
6
+ // https://babeljs.io/docs/en/babel-loader
7
+ {
8
+ test: /\.(js|mjs|jsx|ts|tsx)$/,
9
+ include: __dirname,
10
+ exclude: /node_modules/,
11
+ loader: require.resolve('babel-loader')
12
+ }
13
+ )
14
+
15
+ return config
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "version": "0.0.1",
4
+ "name": "test-template-config-babel",
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
+ }
@@ -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>Babel 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>
20
+ <header>
21
+ <h1>
22
+ <img
23
+ class="babel"
24
+ src="../images/babel.png"
25
+ alt="The Babel logo"
26
+ width="120px"
27
+ />
28
+ <br />
29
+ Welcome to your Babel Extension
30
+ </h1>
31
+ <p>
32
+ Learn more about creating cross-browser extensions at
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,11 @@
1
+ function getManifest() {
2
+ return chrome.runtime.getManifest()
3
+ }
4
+
5
+ const manifest = getManifest()
6
+
7
+ console.table({
8
+ name: manifest.name,
9
+ version: manifest.version,
10
+ description: manifest.description
11
+ })
@@ -0,0 +1,22 @@
1
+ body {
2
+ display: flex;
3
+ justify-content: center;
4
+ align-items: center;
5
+ height: calc(100vh - 26px);
6
+ }
7
+
8
+ h1 {
9
+ font-size: 4.7em;
10
+ }
11
+
12
+ .babel:hover {
13
+ filter: grayscale(1);
14
+ transition:
15
+ filter 2s,
16
+ border-color 2s;
17
+ }
18
+
19
+ .new:hover {
20
+ filter: grayscale(0);
21
+ border-color: aquamarine;
22
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "private": true,
3
+ "name": "test-template-config-babel",
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
+ "devDependencies": {
12
+ "@babel/core": "^7.24.9",
13
+ "babel-loader": "^9.1.3",
14
+ "babel-preset-modern-browser-extension": "^0.7.0",
15
+ "stylelint": "^16.7.0",
16
+ "extension": "latest"
17
+ },
18
+ "scripts": {
19
+ "dev": "extension dev",
20
+ "start": "extension start",
21
+ "build": "extension build"
22
+ },
23
+ "dependencies": {}
24
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "stylelint-config-standard-scss"
3
+ }
@@ -14,7 +14,7 @@
14
14
  href="https://unpkg.com/sakura.css/css/sakura-dark.css"
15
15
  media="screen and (prefers-color-scheme: dark)"
16
16
  />
17
- <link rel="stylesheet" href="./styles.css" media="screen" />
17
+ <link rel="stylesheet" href="./styles.scss" media="screen" />
18
18
  </head>
19
19
  <body>
20
20
  <header>
@@ -9,14 +9,15 @@
9
9
  "url": "https://yourwebsite.com"
10
10
  },
11
11
  "scripts": {
12
- "lint:css": "stylelint '**/*.css'",
12
+ "lint:css": "npx stylelint '**/*.scss'",
13
13
  "dev": "extension dev",
14
14
  "start": "extension start",
15
15
  "build": "extension build"
16
16
  },
17
17
  "devDependencies": {
18
+ "sass": "^1.77.8",
18
19
  "stylelint": "^16.7.0",
19
- "stylelint-config-standard": "^36.0.1",
20
+ "stylelint-config-standard-scss": "^13.1.0",
20
21
  "extension": "latest"
21
22
  },
22
23
  "dependencies": {}
@@ -0,0 +1,35 @@
1
+ # test-template-content-extension-config
2
+
3
+ > An Extension.js example.
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run the following scripts:
8
+
9
+ ### pnpm dev
10
+
11
+ **Development Mode**: This command runs your extension in development mode. It will launch a new browser instance with your extension loaded. The page will automatically reload whenever you make changes to your code, allowing for a smooth development experience.
12
+
13
+ ```bash
14
+ pnpm dev
15
+ ```
16
+
17
+ ### pnpm start
18
+
19
+ **Production Preview**: This command runs your extension in production mode. It will launch a new browser instance with your extension loaded, simulating the environment and behavior of your extension as it will appear once published.
20
+
21
+ ```bash
22
+ pnpm start
23
+ ```
24
+
25
+ ### pnpm build
26
+
27
+ **Build for Production**: This command builds your extension for production. It optimizes and bundles your extension, preparing it for deployment to the target browser's store.
28
+
29
+ ```bash
30
+ pnpm build
31
+ ```
32
+
33
+ ## Learn More
34
+
35
+ To learn more about creating cross-browser extensions with Extension.js, visit the [official documentation](https://extension.js.org).
@@ -0,0 +1 @@
1
+ console.log('Hello from the background script!')
@@ -0,0 +1,82 @@
1
+ import React from 'react'
2
+ import ReactLogo from '../images/logo.svg'
3
+ import tailwindBg from '../images/tailwind_bg.png'
4
+ import typescriptLogo from '../images/typescript.png'
5
+ import tailwindLogo from '../images/tailwind.png'
6
+ import chromeWindowBg from '../images/chromeWindow.png'
7
+
8
+ export default function ContentApp() {
9
+ const [isdialogOpen, setIsDialogOpen] = React.useState(true)
10
+
11
+ if (!isdialogOpen) {
12
+ return (
13
+ <div className="mx-auto p-6">
14
+ <button
15
+ onClick={() => setIsDialogOpen(true)}
16
+ className="bg-white rounded-md p-3 text-sm font-semibold text-gray-900 shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
17
+ >
18
+ 🧩 Open content script hint <span aria-hidden="true">+</span>
19
+ </button>
20
+ </div>
21
+ )
22
+ }
23
+
24
+ return (
25
+ <div className="mx-auto max-w-7xl md:px-0 lg:p-6">
26
+ <div className="relative isolate overflow-hidden bg-gray-900 px-6 pt-16 shadow-2xl lg:rounded-3xl md:pt-24 md:h-full sm:h-[100vh] lg:flex lg:gap-x-20 lg:px-24 lg:pt-0">
27
+ <div className="absolute z-20 top-0 inset-x-0 flex justify-center overflow-hidden pointer-events-none">
28
+ <div className="w-[108rem] flex-none flex justify-end">
29
+ <picture>
30
+ <img
31
+ src={tailwindBg}
32
+ alt=""
33
+ className="w-[90rem] flex-none max-w-none hidden dark:block"
34
+ decoding="async"
35
+ />
36
+ </picture>
37
+ </div>
38
+ </div>
39
+ <div className="mx-auto max-w-md text-center lg:py-12 lg:mx-0 lg:flex-auto lg:text-left">
40
+ <div className="flex items-center justify-center space-x-4 my-4 mx-auto">
41
+ <ReactLogo className="relative inline-block w-12" />
42
+ <div className="text-3xl text-white">+</div>
43
+ <img
44
+ alt="TypeScript logo"
45
+ src={typescriptLogo}
46
+ className="relative inline-block w-12"
47
+ />
48
+ <div className="text-3xl text-white">+</div>
49
+ <img
50
+ alt="Tailwind logo"
51
+ src={tailwindLogo}
52
+ className="relative inline-block w-12"
53
+ />
54
+ </div>
55
+ <h2 className="text-3xl font-bold tracking-tight text-white sm:text-4xl">
56
+ This is a content script running React, TypeScript, and Tailwind.css
57
+ </h2>
58
+ <p className="mt-6 text-lg leading-8 text-gray-300">
59
+ Learn more about creating cross-browser extensions by{' '}
60
+ <button
61
+ onClick={() => setIsDialogOpen(false)}
62
+ className="underline hover:no-underline
63
+ "
64
+ >
65
+ closing this hint
66
+ </button>
67
+ .
68
+ </p>
69
+ </div>
70
+ <div className="relative mt-16 h-80 lg:mt-8">
71
+ <img
72
+ className="absolute left-0 top-0 w-[57rem] max-w-none rounded-md bg-white/5 ring-1 ring-white/10"
73
+ src={chromeWindowBg}
74
+ alt="Chrome window screenshot"
75
+ width="1824"
76
+ height="1080"
77
+ />
78
+ </div>
79
+ </div>
80
+ </div>
81
+ )
82
+ }
@@ -0,0 +1,17 @@
1
+ import ReactDOM from 'react-dom/client'
2
+ import ContentApp from './ContentApp'
3
+ import './styles.css'
4
+
5
+ setTimeout(initial, 1000)
6
+
7
+ function initial() {
8
+ // Create a new div element and append it to the document's body
9
+ const rootDiv = document.createElement('div')
10
+ rootDiv.id = 'extension-root'
11
+ document.body.appendChild(rootDiv)
12
+
13
+ // Use `createRoot` to create a root, then render the <App /> component
14
+ // Note that `createRoot` takes the container DOM node, not the React element
15
+ const root = ReactDOM.createRoot(rootDiv)
16
+ root.render(<ContentApp />)
17
+ }
@@ -0,0 +1,10 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ #extension-root {
6
+ position: fixed;
7
+ bottom: 0;
8
+ right: 0;
9
+ z-index: 99999;
10
+ }
@@ -0,0 +1,22 @@
1
+ /** @type {import('extension-develop').FileConfig} */
2
+ module.exports = {
3
+ config: (config) => {
4
+ config.module.rules.push(
5
+ {
6
+ test: /\.svg$/i,
7
+ type: 'asset',
8
+ // *.svg?url
9
+ resourceQuery: /url/
10
+ },
11
+ {
12
+ test: /\.svg$/i,
13
+ issuer: /\.[jt]sx?$/,
14
+ // exclude react component if *.svg?url
15
+ resourceQuery: {not: [/url/]},
16
+ use: ['@svgr/webpack']
17
+ }
18
+ )
19
+
20
+ return config
21
+ }
22
+ }
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="-11.5 -10.23174 23 20.46348">
2
+ <title>React Logo</title>
3
+ <circle cx="0" cy="0" r="2.05" fill="#61dafb"/>
4
+ <g stroke="#61dafb" stroke-width="1" fill="none">
5
+ <ellipse rx="11" ry="4.2"/>
6
+ <ellipse rx="11" ry="4.2" transform="rotate(60)"/>
7
+ <ellipse rx="11" ry="4.2" transform="rotate(120)"/>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,28 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "version": "0.0.1",
4
+ "name": "test-template-content-extension-config",
5
+ "description": "An Extension.js example.",
6
+ "background": {
7
+ "chromium:service_worker": "background.ts",
8
+ "firefox:scripts": [
9
+ "background.ts"
10
+ ]
11
+ },
12
+ "content_scripts": [
13
+ {
14
+ "matches": [
15
+ "https://extension.js.org/*"
16
+ ],
17
+ "js": [
18
+ "./content/scripts.tsx"
19
+ ]
20
+ }
21
+ ],
22
+ "icons": {
23
+ "16": "images/extension_16.png",
24
+ "48": "images/extension_48.png",
25
+ "128": "images/extension_128.png"
26
+ },
27
+ "author": "Your Name"
28
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "private": true,
3
+ "license": "MIT",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/cezaraugusto/extension.git",
7
+ "directory": "programs/create/templates/content-extension-config"
8
+ },
9
+ "name": "test-template-content-extension-config",
10
+ "description": "An Extension.js example.",
11
+ "version": "0.0.1",
12
+ "author": {
13
+ "name": "Your Name",
14
+ "email": "your@email.com",
15
+ "url": "https://yourwebsite.com"
16
+ },
17
+ "files": [
18
+ "template",
19
+ "template.json"
20
+ ],
21
+ "keywords": [
22
+ "extension",
23
+ "browser-extension",
24
+ "web-extension",
25
+ "template"
26
+ ],
27
+ "dependencies": {
28
+ "@svgr/webpack": "^8.1.0",
29
+ "react": "^18.1.0",
30
+ "react-dom": "^18.1.0",
31
+ "tailwindcss": "^3.4.1"
32
+ },
33
+ "devDependencies": {
34
+ "@types/react": "^18.0.9",
35
+ "@types/react-dom": "^18.0.5",
36
+ "typescript": "5.3.3",
37
+ "extension": "latest"
38
+ },
39
+ "scripts": {
40
+ "dev": "extension dev",
41
+ "start": "extension start",
42
+ "build": "extension build"
43
+ }
44
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {}
5
+ }
6
+ }
@@ -0,0 +1,8 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ['./content/**/*.tsx'],
4
+ theme: {
5
+ extend: {}
6
+ },
7
+ plugins: []
8
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "esModuleInterop": true,
6
+ "forceConsistentCasingInFileNames": true,
7
+ "isolatedModules": true,
8
+ "jsx": "react-jsx",
9
+ "lib": ["dom", "dom.iterable", "esnext"],
10
+ "moduleResolution": "node",
11
+ "module": "esnext",
12
+ "noEmit": true,
13
+ "resolveJsonModule": true,
14
+ "strict": true,
15
+ "target": "esnext",
16
+ "verbatimModuleSyntax": true,
17
+ "useDefineForClassFields": true,
18
+ "skipLibCheck": true
19
+ },
20
+ "include": ["./"],
21
+ "exclude": ["node_modules", "dist"]
22
+ }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=18"
10
10
  },
11
11
  "name": "extension-create",
12
- "version": "2.0.0-alpha.24",
12
+ "version": "2.0.0-alpha.26",
13
13
  "description": "The Extension.js create step",
14
14
  "main": "./dist/module.js",
15
15
  "types": "./dist/module.d.ts",
@@ -1 +0,0 @@
1
- {"extends": ["stylelint-config-standard"]}