Skip to content

Commit

Permalink
Change babel plugin to use import map as source of truth (#189)
Browse files Browse the repository at this point in the history
* change babel plugin to use import map as source of truth

* trying to get this test to run on windows
  • Loading branch information
FredKSchott authored Feb 5, 2020
1 parent 72b9d09 commit 090ac06
Show file tree
Hide file tree
Showing 52 changed files with 139 additions and 34,076 deletions.
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
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"
}
}
File renamed without changes.
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

0 comments on commit 090ac06

Please sign in to comment.