Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change babel plugin to use import map as source of truth #189

Merged
merged 2 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ www/index.md
www/dist
/node_modules
/web_modules
__tests__/**/*/web_modules
__tests__/integration/*/web_modules
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also ended up doing some cleanup of the test files. We had some test-generated files being added in git. Sorry for the spam!

3 changes: 0 additions & 3 deletions __tests__/babel-plugin/__fixtures__/addVersion/options.json

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/babel-plugin/__fixtures__/addVersion/output.js

This file was deleted.

3 changes: 0 additions & 3 deletions __tests__/babel-plugin/__fixtures__/dir/options.json

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/babel-plugin/__fixtures__/dir/output.js

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions __tests__/babel-plugin/cwd/web_modules/import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"example-dep": "./example-dep.js"
}
}
5 changes: 5 additions & 0 deletions __tests__/babel-plugin/cwd/web_modules/import-map.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"example-dep": "./example-dep.js?from=import-map.test.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"example-dep": "./test_val/example-dep.js"
}
}
3 changes: 3 additions & 0 deletions __tests__/babel-plugin/fixtures/dir/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dir": "web_modules_custom_dir"
}
1 change: 1 addition & 0 deletions __tests__/babel-plugin/fixtures/dir/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import module from '/web_modules_custom_dir/test_val/example-dep.js';
3 changes: 3 additions & 0 deletions __tests__/babel-plugin/fixtures/importMap/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"importMap": "import-map.test.json"
}
1 change: 1 addition & 0 deletions __tests__/babel-plugin/fixtures/importMap/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import module from '/web_modules/example-dep.js?from=import-map.test.json';
1 change: 1 addition & 0 deletions __tests__/babel-plugin/fixtures/optionalExtensions/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import module from './any/local/file';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import module from './any/local/file.js';
4 changes: 2 additions & 2 deletions __tests__/babel-plugin/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const path = require('path');
const pluginTester = require('babel-plugin-tester').default;
const babelPlugin = require('../../assets/babel-plugin.js');

process.chdir(__dirname);
process.chdir(path.join(__dirname, 'cwd'));

pluginTester({
plugin: babelPlugin,
pluginName: 'snowpack/assets/babel-plugin.js',
fixtures: path.join(__dirname, '__fixtures__'),
fixtures: path.join(__dirname, 'fixtures'),
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"imports": {
"dat.gui": "./dat.gui.js"
"dat.gui": "./dat.gui.js?rev=XXXXXXXXXX"
}
}
Loading