forked from parcel-bundler/parcel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web Extension Transformer (parcel-bundler#5304)
- Loading branch information
Showing
45 changed files
with
1,150 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@parcel/config-default", | ||
"transformers": { | ||
"manifest.json": ["@parcel/transformer-webextension"] | ||
}, | ||
"packagers": { | ||
"manifest.json": "@parcel/packager-raw-url" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "@parcel/config-webextension", | ||
"version": "2.0.0-beta.1", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/parcel" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/parcel-bundler/parcel.git" | ||
}, | ||
"main": "index.json", | ||
"dependencies": { | ||
"@parcel/config-default": "2.0.0-beta.1", | ||
"@parcel/transformer-webextension": "2.0.0-beta.1", | ||
"@parcel/packager-raw-url": "2.0.0-beta.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/webextension/.parcelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["@parcel/config-webextension"] | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/core/integration-tests/test/integration/webextension/_locales/en_US/messages.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"prompt_for_name": { | ||
"message": "What's your name?", | ||
"description": "Ask for the user's name" | ||
}, | ||
"hello": { | ||
"message": "Hello, $USER$", | ||
"description": "Greet the user", | ||
"placeholders": { | ||
"user": { | ||
"content": "$1", | ||
"example": "Cira" | ||
} | ||
} | ||
}, | ||
"bye": { | ||
"message": "Goodbye, $USER$. Come back to $OUR_SITE$ soon!", | ||
"description": "Say goodbye to the user", | ||
"placeholders": { | ||
"our_site": { | ||
"content": "Example.com" | ||
}, | ||
"user": { | ||
"content": "$1", | ||
"example": "Cira" | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/webextension/dicts/tmp.aff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
World!! |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/webextension/dicts/tmp.dic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello |
31 changes: 31 additions & 0 deletions
31
packages/core/integration-tests/test/integration/webextension/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Parcel WebExt", | ||
"version": "0.1.2.65535", | ||
"default_locale": "en_US", | ||
"icons": { | ||
"100": "src/assets/foo.png" | ||
}, | ||
"background": { | ||
"scripts": ["./src/background.js"], | ||
"persistent": true | ||
}, | ||
"browser_action": { | ||
"default_icon": { | ||
"100": "src/assets/foo.png" | ||
}, | ||
"default_popup": "src/popup.html" | ||
}, | ||
"content_scripts": [{ | ||
"matches": ["https://v2.parceljs.org/*"], | ||
"js": ["src/content.js"], | ||
"css": ["src/content.css"] | ||
}], | ||
"dictionaries": { | ||
"en-US": "./dicts/tmp.dic" | ||
}, | ||
"devtools_page": "src/devtools.html", | ||
"web_accessible_resources": [ | ||
"src/assets/**/*.txt" | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/webextension/src/assets/a.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello Parcel WebExt! |
Binary file added
BIN
+255 Bytes
packages/core/integration-tests/test/integration/webextension/src/assets/foo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/webextension/src/assets/nested/b.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello Parcel WebExt (VERSION B)! |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/webextension/src/background.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('Hello Parcel!') |
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/webextension/src/content.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div::before { | ||
content: 'Hello Parcel!' | ||
} |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/webextension/src/content.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('Hello Parcel! CONTENT EDITION') |
11 changes: 11 additions & 0 deletions
11
packages/core/integration-tests/test/integration/webextension/src/devtools.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Devtools</title> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
packages/core/integration-tests/test/integration/webextension/src/popup.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Popup</title> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import path from 'path'; | ||
import {bundle, assertBundles} from '@parcel/test-utils'; | ||
|
||
describe('webextension', function() { | ||
it('should resolve a full webextension bundle', async function() { | ||
let b = await bundle( | ||
path.join(__dirname, '/integration/webextension/manifest.json'), | ||
); | ||
assertBundles(b, [ | ||
{ | ||
name: 'tmp.aff', | ||
assets: ['tmp.aff'], | ||
}, | ||
{ | ||
name: 'tmp.dic', | ||
assets: ['tmp.dic'], | ||
}, | ||
{ | ||
name: 'messages.json', | ||
assets: ['messages.json'], | ||
}, | ||
{ | ||
name: 'manifest.json', | ||
assets: ['manifest.json'], | ||
}, | ||
// next three are implemented to have the same name, but theoretically | ||
{assets: ['a.txt']}, | ||
{assets: ['b.txt']}, | ||
{assets: ['foo.png']}, | ||
{assets: ['popup.html']}, | ||
{assets: ['devtools.html']}, | ||
{assets: ['content.js']}, | ||
{assets: ['content.css']}, | ||
{assets: ['background.js']}, | ||
]); | ||
}); | ||
// TODO: Test error-checking | ||
}); |
Oops, something went wrong.