Skip to content

Commit

Permalink
Node Module Trace webpack plugin (vercel#140)
Browse files Browse the repository at this point in the history
* Initialize Node.js/TypeScript workspace

* node-module-trace Webpack plugin

* Add new fmt checks to pipeline

* Popup unwind error

* Implement --exact flag

* Yarn 3.2.2

* Reformat toml files

* Fix socket io test, 100ms timeout is too long

* remove unnecessary CI cache config

* regenerate lockfile from old lockfile, align the dependencies version

* Run nmt tests in system tmp dir

* Apply code review suggestions

* allow to wait for task completion and propagate errors and panics

* revert method addition

* spawn_root_task should be sync

Co-authored-by: Tobias Koppers <[email protected]>
  • Loading branch information
Brooooooklyn and sokra authored Jul 22, 2022
1 parent 422b5f7 commit 195b83b
Show file tree
Hide file tree
Showing 85 changed files with 32,669 additions and 19,368 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ max_line_length = 120
[{*.markdown,*.md}]
max_line_length = 80

[{*.yml,*.yaml}]
[{*.yml,*.yaml,*.json,*.ts,*.js}]
indent_size = 2
212 changes: 212 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
parser: '@typescript-eslint/parser'

parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: latest
sourceType: module
project: './tsconfig.json'

ignorePatterns:
- .yarn
- target
- dist
- node_modules
- crates
- packages/webpack-nmt/test/with-mongodb-mongoose

env:
browser: false
es6: true
node: true

plugins:
- import
- '@typescript-eslint'

extends:
- eslint:recommended

globals:
NodeJS: 'readonly'

rules:
# covered by @typescript-eslint
'space-before-function-paren': 0
'no-useless-constructor': 0
'no-unused-vars': 0
'no-case-declarations': 0
'no-dupe-class-members': 0

'comma-dangle': ['error', 'only-multiline']
'eqeqeq': [2, 'always', { 'null': 'ignore' }]
'no-undef': 2
'no-console': [2, { allow: ['error', 'warn', 'info', 'assert'] }]
'no-const-assign': 2
'no-duplicate-imports': 2
'no-restricted-syntax':
[
2,
{
'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]',
'message': Don't compare for equality against boolean literals,
},
]
'no-use-before-define': [2, { 'functions': false, 'classes': false }]
'no-var': 2
'one-var-declaration-per-line': 2
'prefer-const': 2

'import/first': 2
'import/newline-after-import': 2
'import/order':
[
2,
{
'newlines-between': 'always',
'alphabetize': { 'order': 'asc', 'caseInsensitive': true },
'pathGroups':
[
{
'pattern': '@vercel/**',
'group': 'internal',
'position': 'before',
},
],
},
]

'@typescript-eslint/adjacent-overload-signatures': 2

'@typescript-eslint/await-thenable': 2

'@typescript-eslint/consistent-type-assertions': 2

'@typescript-eslint/ban-types':
[
'error',
{
'types':
{
'String': { 'message': 'Use string instead', 'fixWith': 'string' },
'Number': { 'message': 'Use number instead', 'fixWith': 'number' },
'Boolean':
{ 'message': 'Use boolean instead', 'fixWith': 'boolean' },
'Function': { 'message': 'Use explicit type instead' },
},
},
]

'@typescript-eslint/explicit-member-accessibility':
[
'error',
{
accessibility: 'explicit',
overrides:
{
accessors: 'no-public',
constructors: 'no-public',
methods: 'no-public',
properties: 'no-public',
parameterProperties: 'explicit',
},
},
]

'@typescript-eslint/method-signature-style': 2

'@typescript-eslint/no-floating-promises': 2

'@typescript-eslint/no-implied-eval': 2

'@typescript-eslint/no-for-in-array': 2

'@typescript-eslint/no-inferrable-types': 2

'@typescript-eslint/no-invalid-void-type': 2

'@typescript-eslint/no-misused-new': 2

'@typescript-eslint/no-misused-promises': 2

'@typescript-eslint/no-namespace': 2

'@typescript-eslint/no-non-null-asserted-optional-chain': 2

'@typescript-eslint/no-throw-literal': 2

'@typescript-eslint/no-unnecessary-boolean-literal-compare': 2

'@typescript-eslint/prefer-for-of': 2

'@typescript-eslint/prefer-nullish-coalescing': 2

'@typescript-eslint/switch-exhaustiveness-check': 2

'@typescript-eslint/prefer-optional-chain': 2

'@typescript-eslint/prefer-readonly': 2

'@typescript-eslint/prefer-string-starts-ends-with': 0

'@typescript-eslint/no-array-constructor': 2

'@typescript-eslint/require-await': 2

'@typescript-eslint/return-await': 2

'@typescript-eslint/ban-ts-comment':
[
2,
{
'ts-expect-error': false,
'ts-ignore': true,
'ts-nocheck': true,
'ts-check': false,
},
]

'@typescript-eslint/naming-convention':
[
2,
{
selector: 'memberLike',
format: ['camelCase', 'PascalCase'],
modifiers: ['private'],
leadingUnderscore: 'forbid',
},
]

'@typescript-eslint/no-unused-vars':
[
2,
{
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
]
'@typescript-eslint/member-ordering':
[
2,
{
default:
[
'public-static-field',
'protected-static-field',
'private-static-field',
'public-static-method',
'protected-static-method',
'private-static-method',
'public-instance-field',
'protected-instance-field',
'private-instance-field',
'public-constructor',
'protected-constructor',
'private-constructor',
'public-instance-method',
'protected-instance-method',
'private-instance-method',
],
},
]
10 changes: 3 additions & 7 deletions .github/workflows/bench_against_node_nft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
cache-dependency-path: |
crates/turbopack/tests/node-file-trace/yarn.lock
cache: 'yarn'
node-version: 16

- name: install Node.js dependencies
run: |
yarn install --frozen-lockfile
working-directory: crates/turbopack/tests/node-file-trace
run: yarn install

- name: Install nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
Expand All @@ -42,7 +38,7 @@ jobs:
command: nextest
args: run -j 1 --no-fail-fast -r bench_against_node_nft
env:
RUSTFLAGS: "--cfg bench_against_node_nft"
RUSTFLAGS: '--cfg bench_against_node_nft'

- name: Show benchmark result
uses: actions-rs/cargo@v1
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,20 @@ jobs:
with:
command: fmt
args: --check
- name: Setup node
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 16

- name: install Node.js dependencies
run: yarn install --mode=skip-build

- name: Prettier
run: yarn prettier -c .

- name: toml
run: yarn taplo format --check

- name: eslint
run: yarn lint
10 changes: 3 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,18 @@ jobs:
uses: actions/setup-node@v3
with:
cache: 'yarn'
cache-dependency-path: |
crates/turbopack/tests/node-file-trace/yarn.lock
node-version: 16

- name: install Node.js dependencies
run: |
yarn install --frozen-lockfile
working-directory: crates/turbopack/tests/node-file-trace
yarn install
if: matrix.os.name != 'windows-latest'

- name: install Node.js dependencies
run: |
yarn install --frozen-lockfile --ignore-scripts
yarn install --mode=skip-build
yarn node-gyp install
yarn install --force
working-directory: crates/turbopack/tests/node-file-trace
yarn install
if: matrix.os.name == 'windows-latest'

- name: Install nextest
Expand Down
Loading

0 comments on commit 195b83b

Please sign in to comment.