Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webpack/webpack-sources
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.2
Choose a base ref
...
head repository: webpack/webpack-sources
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 38,465 additions and 33,995 deletions.
  1. +0 −70 .eslintrc.js
  2. +37 −12 .github/workflows/test.yml
  3. +15 −6 .prettierrc.js
  4. +11 −0 eslint.config.mjs
  5. +13 −0 jest.config.js
  6. +183 −57 lib/CachedSource.js
  7. +40 −1 lib/CompatSource.js
  8. +150 −75 lib/ConcatSource.js
  9. +104 −49 lib/OriginalSource.js
  10. +56 −12 lib/PrefixSource.js
  11. +80 −18 lib/RawSource.js
  12. +150 −74 lib/ReplaceSource.js
  13. +27 −2 lib/SizeOnlySource.js
  14. +53 −2 lib/Source.js
  15. +226 −100 lib/SourceMapSource.js
  16. +94 −42 lib/helpers/createMappingsSerializer.js
  17. +73 −43 lib/helpers/getFromStreamChunks.js
  18. +14 −3 lib/helpers/getGeneratedSourceInfo.js
  19. +7 −0 lib/helpers/getName.js
  20. +8 −1 lib/helpers/getSource.js
  21. +39 −30 lib/helpers/readMappings.js
  22. +33 −0 lib/helpers/splitIntoLines.js
  23. +53 −0 lib/helpers/splitIntoPotentialTokens.js
  24. +48 −25 lib/helpers/streamAndGetSourceAndMap.js
  25. +47 −20 lib/helpers/streamChunks.js
  26. +172 −87 lib/helpers/streamChunksOfCombinedSourceMap.js
  27. +38 −25 lib/helpers/streamChunksOfRawSource.js
  28. +319 −32 lib/helpers/streamChunksOfSourceMap.js
  29. +117 −0 lib/helpers/stringBufferUtils.js
  30. +112 −22 lib/index.js
  31. +38 −25 package.json
  32. +88 −36 test/CachedSource.js
  33. +12 −6 test/CompatSource.js
  34. +91 −36 test/ConcatSource.js
  35. +178 −106 test/Fuzzy.js
  36. +107 −33 test/OriginalSource.js
  37. +27 −23 test/PrefixSource.js
  38. +116 −0 test/RawSource.js
  39. +125 −81 test/ReplaceSource.js
  40. +8 −5 test/SizeOnlySource.js
  41. +455 −19 test/SourceMapSource.js
  42. +53 −0 test/__mocks__/createMappingsSerializer.js
  43. +28,944 −30,378 test/__snapshots__/Fuzzy.js.snap
  44. +1,174 −0 test/fixtures/es6-promise.js
  45. +1 −0 test/fixtures/es6-promise.map
  46. +73 −19 test/helpers.js
  47. +7 −3 test/package-entry.js
  48. +15 −0 tsconfig.json
  49. +15 −0 tsconfig.types.json
  50. +17 −0 tsconfig.types.test.json
  51. +461 −0 types.d.ts
  52. +4,141 −2,417 yarn.lock
70 changes: 0 additions & 70 deletions .eslintrc.js

This file was deleted.

49 changes: 37 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -9,29 +9,54 @@ on:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "yarn"
- run: yarn --frozen-lockfile
- name: Cache eslint result
uses: actions/cache@v4
with:
path: .eslintcache
key: lint-eslint-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/eslint.config.mjs') }}
restore-keys: lint-eslint-
- run: yarn lint
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x, 22.x, 24.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/github-script@v7
id: calculate_architecture
with:
result-encoding: string
script: |
if ('${{ matrix.os }}' === 'macos-latest' && ('${{ matrix['node-version'] }}' === '10.x' || '${{ matrix['node-version'] }}' === '12.x' || '${{ matrix['node-version'] }}' === '14.x')) {
return "x64"
} else {
return ''
}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
architecture: ${{ steps.calculate_architecture.outputs.result }}
cache: "yarn"
- run: yarn --frozen-lockfile --ignore-engines
if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x'
- run: yarn --frozen-lockfile
- uses: actions/cache@v1
with:
path: .eslintcache
key: lint-${{ env.GITHUB_SHA }}
restore-keys: lint-
- run: yarn lint
if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x'
- run: yarn cover
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v5
with:
flags: integration
functionalities: gcov
token: ${{ secrets.CODECOV_TOKEN }}
21 changes: 15 additions & 6 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
"use strict";

module.exports = {
printWidth: 80,
useTabs: true,
tabWidth: 2,
trailingComma: "none",
arrowParens: "avoid",
trailingComma: "all",
arrowParens: "always",
overrides: [
{
files: "*.json",
options: {
useTabs: false
}
}
]
parser: "json",
useTabs: false,
},
},
{
files: "*.{cts,mts,ts}",
options: {
parser: "typescript",
},
},
],
};
11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "eslint/config";
import config from "eslint-config-webpack";

export default defineConfig([
{
extends: [config],
rules: {
"n/prefer-node-protocol": "off",
},
},
]);
13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use strict";

/** @type {import('jest').Config} */
const config = {
prettierPath: require.resolve("prettier-2"),
forceExit: true,
testMatch: ["<rootDir>/test/*.js"],
testPathIgnorePatterns: ["<rootDir>/test/helpers.js"],
transformIgnorePatterns: ["<rootDir>"],
testEnvironment: "node",
};

module.exports = config;
Loading