Skip to content

Commit 4d21bfd

Browse files
authored
Update demo (#37)
* Update demo * update * update * update * update * fix
1 parent 11cbd8e commit 4d21bfd

File tree

17 files changed

+166
-69
lines changed

17 files changed

+166
-69
lines changed

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
/tests/fixtures/**/*.json
66
/explorer/dist
77
/explorer/node_modules
8+
/explorer-v2/build
9+
/explorer-v2/build
10+
/explorer-v2/build-system/shim/svelte-eslint-parser.*
11+
/explorer-v2/build-system/shim/eslint-scope.*
12+
/explorer-v2/build-system/shim/eslint-plugin-svelte3.*
13+
/explorer-v2/build-system/shim/lodash.*

.github/workflows/GHPages.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ jobs:
1616
run: |+
1717
npm install
1818
npm run build
19-
cd explorer
19+
cd explorer-v2
2020
npm install
21+
npm run pre-build
2122
npm run build
2223
- name: Deploy
2324
uses: peaceiris/actions-gh-pages@v3
2425
with:
2526
github_token: ${{ secrets.GITHUB_TOKEN }}
26-
publish_dir: ./explorer/dist
27+
publish_dir: ./explorer-v2/build
2728
force_orphan: true

explorer-v2/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ node_modules
33
/.svelte-kit
44
/build
55
/functions
6+
/build-system/shim/svelte-eslint-parser.*
7+
/build-system/shim/eslint-scope.*
8+
/build-system/shim/eslint-plugin-svelte3.*
9+
/build-system/shim/lodash.*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { processors } from 'eslint-plugin-svelte3';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ScopeManager, Scope, Variable, Reference, analyze } from 'eslint-scope';
2+
export { ScopeManager, Scope, Variable, Reference, analyze };
3+
export default { ScopeManager, Scope, Variable, Reference, analyze };

explorer-v2/build-system/shim/lodash.js renamed to explorer-v2/build-system/pre-build/lodash.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import merge from '../../node_modules/lodash/merge.js';
55
import intersection from '../../node_modules/lodash/intersection.js';
66
import union from '../../node_modules/lodash/union.js';
77
import flatMap from '../../node_modules/lodash/flatMap.js';
8+
console.log('?');
89
import escapeRegExp from '../../node_modules/lodash/escapeRegExp.js';
910
import mapValues from '../../node_modules/lodash/mapValues.js';
1011
import overSome from '../../node_modules/lodash/overSome.js';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = function () {
2+
'shim-assert';
3+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { parseForESLint } from 'svelte-eslint-parser';
2+
export { parseForESLint };
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import { resolve } from 'path';
2+
import WrapperPlugin from 'wrapper-webpack-plugin';
3+
4+
const output = {
5+
path: resolve('../shim'),
6+
filename: '[name].js',
7+
library: {
8+
type: 'module'
9+
}
10+
};
11+
const alias = {
12+
assert: resolve('./shim-assert.cjs'),
13+
fs: resolve('../shim/fs.js'),
14+
path: resolve('../shim/path.js'),
15+
module: resolve('../shim/module.js'),
16+
url: resolve('../shim/url.js'),
17+
util: resolve('../shim/util.js'),
18+
typescript: resolve('../shim/typescript.js')
19+
};
20+
/** @type {import('webpack').Configuration} */
21+
const base = {
22+
output,
23+
resolve: {
24+
alias
25+
},
26+
target: ['web'],
27+
optimization: {
28+
minimize: false
29+
},
30+
mode: 'production',
31+
experiments: {
32+
outputModule: true
33+
},
34+
externalsType: 'var'
35+
};
36+
/** @type {import('webpack').Configuration[]} */
37+
export default [
38+
{
39+
...base,
40+
entry: {
41+
'eslint-scope': resolve('./eslint-scope.js')
42+
}
43+
},
44+
{
45+
...base,
46+
entry: {
47+
'svelte-eslint-parser': resolve('./svelte-eslint-parser.js')
48+
},
49+
externals: {
50+
'svelte/compiler': '$$inject_svelte_compiler$$',
51+
lodash: '$$inject_lodash$$',
52+
espree: '$$inject_espree$$',
53+
'eslint-scope': '$$inject_eslint_scope$$'
54+
},
55+
plugins: [
56+
new WrapperPlugin({
57+
test: /svelte-eslint-parser\.js/,
58+
header: `
59+
import * as $$inject_svelte_compiler$$ from 'svelte/compiler';
60+
import $$inject_lodash$$ from 'lodash';
61+
import $$inject_espree$$ from 'espree';
62+
import $$inject_eslint_scope$$ from 'eslint-scope';
63+
`
64+
})
65+
]
66+
},
67+
{
68+
...base,
69+
entry: {
70+
'eslint-plugin-svelte3': resolve('./eslint-plugin-svelte3.js')
71+
},
72+
module: {
73+
rules: [
74+
{
75+
test: /node_modules\/eslint-plugin-svelte3\/index\.js$/u,
76+
loader: 'string-replace-loader',
77+
options: {
78+
search: 'Object\\.keys\\(__require\\.cache\\)',
79+
replace: (original) => `[] /* ${original} */`,
80+
flags: ''
81+
}
82+
},
83+
{
84+
test: /node_modules\/eslint-plugin-svelte3\/index\.js$/u,
85+
loader: 'string-replace-loader',
86+
options: {
87+
search: 'require\\(linter_path\\)',
88+
replace: (original) => `{Linter:require('eslint4b')}; // ${original}`,
89+
flags: ''
90+
}
91+
},
92+
{
93+
test: /node_modules\/eslint-plugin-svelte3\/index\.js$/u,
94+
loader: 'string-replace-loader',
95+
options: {
96+
search: "throw new Error\\('Could not find ESLint Linter in require cache'\\);",
97+
replace: (original) => ` // ${original}`,
98+
flags: ''
99+
}
100+
}
101+
]
102+
},
103+
externals: {
104+
'svelte/compiler': '$$inject_svelte_compiler$$',
105+
eslint4b: '$$inject_eslint4b$$'
106+
},
107+
plugins: [
108+
new WrapperPlugin({
109+
test: /eslint-plugin-svelte3\.js/,
110+
header: `
111+
import * as $$inject_svelte_compiler$$ from 'svelte/compiler';
112+
import $$inject_eslint4b$$ from 'eslint4b';
113+
`
114+
})
115+
]
116+
},
117+
{
118+
...base,
119+
entry: {
120+
lodash: resolve('./lodash.js')
121+
}
122+
}
123+
];
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = function () {
1+
export default function () {
22
'assert shim';
3-
};
3+
}

0 commit comments

Comments
 (0)