{"_id":"webpack-sources@3.6.0","bugs":{"url":"https://github.com/webpack/webpack-sources/issues"},"dist":{"shasum":"b2e4a4f1aef1a0d60f3011eb47736c5bf7f1ed7f","tarball":"http://registry-npm.ywwl.com/webpack-sources/download/webpack-sources-3.6.0.tgz","fileCount":56,"integrity":"sha512-EIMmPVvNI0CYXyRPp34F2Qk7W37/BZVZIofS6LAUnrNjCVahS+hO4mxwFJDjQjODTGZDtVzLYoN2+1dYkhk9qA==","signatures":[{"sig":"MEQCIA5cxm9ml6u5BpB4aiYllNa8ySPqcE3uconr0ynLVYuPAiAA5Pr3MhLPjaI1vW27CpYT+/FKAd1UwFtqITMCnv2v8w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHnVFRLJQNF+GGuWQ699+AO28tSbqcJKOGa5iVGlxYfxAiEA58Z9VjcACd/S3wYKKh8otWO6Jx+9ptXyCx0sgWzmCng="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/webpack-sources@3.6.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":246797,"size":51407,"noattachment":false,"key":"/webpack-sources/-/webpack-sources-3.6.0.tgz"},"main":"lib/index.js","name":"webpack-sources","types":"types.d.ts","author":{"name":"Tobias Koppers @sokra"},"engines":{"node":">=10.13.0"},"gitHead":"50fc1db79b31694c68d386a8126ff5bfdc80faea","license":"MIT","scripts":{"fix":"npm run fix:code && npm run build:types","fmt":"npm run fmt:base -- --loglevel warn --write","lint":"npm run lint:code && npm run lint:types && npm run lint:types-test","test":"node --require ./test/helpers/validate-mappings.js --test --test-reporter=dot \"test/*.js\"","pretest":"npm run lint","release":"changeset publish","version":"changeset version && npm run fmt","fix:code":"npm run lint:code -- --fix","fmt:base":"prettier --cache --ignore-unknown .","benchmark":"node --max-old-space-size=4096 --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./benchmark/run.mjs cases","fmt:check":"npm run fmt:base -- --check","lint:code":"eslint --cache .","lint:types":"tsc","build:types":"del-cli types && tsc -p tsconfig.types.json && prettier --log-level warn --write types","test:legacy":"jest","test:coverage":"node --require ./test/helpers/validate-mappings.js --test --experimental-test-coverage --test-coverage-include=\"lib/**\" --test-reporter=dot --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info \"test/*.js\"","lint:types-test":"tsc -p tsconfig.types.test.json","benchmark:memory":"node --expose-gc --max-old-space-size=4096 ./benchmark/run.mjs memory","test:legacy:coverage":"jest --coverage","test:update-snapshots":"node --require ./test/helpers/validate-mappings.js --test --test-reporter=dot --test-update-snapshots \"test/*.js\""},"version":"3.6.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:705ff66b-3334-40dd-a026-57d03879e87e"}},"homepage":"https://github.com/webpack/webpack-sources#readme","keywords":["webpack","source-map"],"repository":{"url":"git+https://github.com/webpack/webpack-sources.git","type":"git"},"_npmVersion":"11.19.0","description":"Source code handling classes for webpack","directories":{},"maintainers":[{"name":"15000621931","email":"784487301@qq.com"},{"name":"ev1stensberg","email":"evenstensberg@gmail.com"},{"name":"__hai","email":"haijie0619@gmail.com"},{"name":"sokra","email":"tobias.koppers@googlemail.com"},{"name":"avivkeller","email":"me@aviv.sh"},{"name":"evilebottnawi","email":"sheo13666q@gmail.com"},{"name":"jhnns","email":"mail@johannesewald.de"}],"_nodeVersion":"24.21.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^30.5.2","eslint":"^9.39.5","del-cli":"^7.0.0","webpack":"^5.107.2","prettier":"^3.9.9","tinybench":"^6.0.0","source-map":"^0.8.0","typescript":"^6.0.2","@codspeed/core":"^5.5.0","@changesets/cli":"^3.0.3","sourcemap-validator":"^2.1.0","eslint-config-webpack":"^4.14.0","@changesets/get-github-info":"^1.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/webpack-sources_3.6.0_1790443377445_0.2681880732564095"},"readme":"# webpack-sources\n\nContains multiple classes which represent a `Source`. A `Source` can be asked for source code, size, source map and hash.\n\n## `Source`\n\nBase class for all sources.\n\n### Public methods\n\nAll methods should be considered as expensive as they may need to do computations.\n\n#### `source`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.source() -> String | Buffer\n```\n\nReturns the represented source code as string or Buffer (for binary Sources).\n\n#### `buffer`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.buffer() -> Buffer\n```\n\nReturns the represented source code as Buffer. Strings are converted to utf-8.\n\n#### `buffers`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.buffers() -> Buffer[]\n```\n\nReturns the represented source code as an array of Buffers. This avoids the\nintermediate `Buffer.concat` allocation performed by `buffer()` when the source\nis composed of multiple children (for example `ConcatSource`). Consumers that\ncan accept an array of buffers (e.g. writing via `fs.createWriteStream` or\n`writev`) should prefer this method for better performance.\n\nThe default implementation returns `[this.buffer()]`.\n\n#### `size`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.size() -> Number\n```\n\nReturns the size in bytes of the represented source code.\n\n#### `map`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.map(options?: Object) -> Object | null\n```\n\nReturns the SourceMap of the represented source code as JSON. May return `null` if no SourceMap is available.\n\nThe `options` object can contain the following keys:\n\n- `columns: Boolean` (default `true`): If set to false the implementation may omit mappings for columns.\n- `scopes: Boolean` (default `false`): If set to true the map carries the `scopes` field of the [Scopes proposal](https://github.com/tc39/ecma426/blob/main/proposals/scopes.md), naming for each source the bindings it declares and the expression each one reads in the generated code. Sources declare those bindings themselves — see `OriginalSource` — and a map whose sources declare none omits the field.\n\n#### `sourceAndMap`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.sourceAndMap(options?: Object) -> {\n\tsource: String | Buffer,\n\tmap: Object | null\n}\n```\n\nReturns both, source code (like `Source.prototype.source()` and SourceMap (like `Source.prototype.map()`). This method could have better performance than calling `source()` and `map()` separately.\n\nSee `map()` for `options`.\n\n#### `updateHash`\n\n<!-- eslint-skip -->\n\n```typescript\nSource.prototype.updateHash(hash: Hash) -> void\n```\n\nUpdates the provided `Hash` object with the content of the represented source code. (`Hash` is an object with an `update` method, which is called with string values)\n\n## `RawSource`\n\nRepresents source code without SourceMap.\n\n<!-- eslint-skip -->\n\n```typescript\nnew RawSource(sourceCode: String | Buffer)\n```\n\n## `OriginalSource`\n\nRepresents source code, which is a copy of the original file.\n\n<!-- eslint-skip -->\n\n```typescript\nnew OriginalSource(\n\tsourceCode: String | Buffer,\n\tname: String,\n\tscopeBindings?: Map<String, String>\n)\n```\n\n- `sourceCode`: The source code.\n- `name`: The filename of the original source code.\n- `scopeBindings`: What each name this source declares reads in the generated code, keyed by the name the source uses. Only consulted when a map is asked for with `scopes: true`, and carried through wrapping sources such as `ReplaceSource` and `ConcatSource`.\n\nOriginalSource tries to create column mappings if requested, by splitting the source code at typical statement borders (`;`, `{`, `}`).\n\n## `SourceMapSource`\n\nRepresents source code with SourceMap, optionally having an additional SourceMap for the original source.\n\n<!-- eslint-skip -->\n\n```typescript\nnew SourceMapSource(\n\tsourceCode: String | Buffer,\n\tname: String,\n\tsourceMap: Object | String | Buffer,\n\toriginalSource?: String | Buffer,\n\tinnerSourceMap?: Object | String | Buffer,\n\tremoveOriginalSource?: boolean\n)\n```\n\n- `sourceCode`: The source code.\n- `name`: The filename of the original source code.\n- `sourceMap`: The SourceMap for the source code.\n- `originalSource`: The source code of the original file. Can be omitted if the `sourceMap` already contains the original source code.\n- `innerSourceMap`: The SourceMap for the `originalSource`/`name`.\n- `removeOriginalSource`: Removes the source code for `name` from the final map, keeping only the deeper mappings for that file.\n\nThe `SourceMapSource` supports \"identity\" mappings for the `innerSourceMap`.\nWhen original source matches generated source for a mapping it's assumed to be mapped char by char allowing to keep finer mappings from `sourceMap`.\n\n## `CachedSource`\n\nDecorates a `Source` and caches returned results of `map`, `source`, `buffer`, `size` and `sourceAndMap` in memory. `updateHash` is not cached.\nIt tries to reused cached results from other methods to avoid calculations, i. e. when `source` is already cached, calling `size` will get the size from the cached source, calling `sourceAndMap` will only call `map` on the wrapped Source.\n\n<!-- eslint-skip -->\n\n```typescript\nnew CachedSource(source: Source)\nnew CachedSource(source: Source | () => Source, cachedData?: CachedData)\n```\n\nInstead of passing a `Source` object directly one can pass an function that returns a `Source` object. The function is only called when needed and once.\n\n### Public methods\n\n#### `getCachedData()`\n\nReturns the cached data for passing to the constructor. All cached entries are converted to Buffers and strings are avoided.\n\n#### `original()`\n\nReturns the original `Source` object.\n\n#### `originalLazy()`\n\nReturns the original `Source` object or a function returning these.\n\n## `PrefixSource`\n\nPrefix every line of the decorated `Source` with a provided string.\n\n<!-- eslint-skip -->\n\n```typescript\nnew PrefixSource(\n\tprefix: String,\n\tsource: Source | String | Buffer\n)\n```\n\n## `ConcatSource`\n\nConcatenate multiple `Source`s or strings to a single source.\n\n<!-- eslint-skip -->\n\n```typescript\nnew ConcatSource(\n\t...items?: Source | String\n)\n```\n\n### Public methods\n\n#### `add`\n\n<!-- eslint-skip -->\n\n```typescript\nConcatSource.prototype.add(item: Source | String)\n```\n\nAdds an item to the source.\n\n## `ReplaceSource`\n\nDecorates a `Source` with replacements and insertions of source code.\n\nThe `ReplaceSource` supports \"identity\" mappings for child source.\nWhen original source matches generated source for a mapping it's assumed to be mapped char by char allowing to split mappings at replacements/insertions.\n\n### Public methods\n\n#### `replace`\n\n<!-- eslint-skip -->\n\n```typescript\nReplaceSource.prototype.replace(\n\tstart: Number,\n\tend: Number,\n\treplacement: String\n)\n```\n\nReplaces chars from `start` (0-indexed, inclusive) to `end` (0-indexed, inclusive) with `replacement`.\n\nLocations represents locations in the original source and are not influenced by other replacements or insertions.\n\n#### `insert`\n\n<!-- eslint-skip -->\n\n```typescript\nReplaceSource.prototype.insert(\n\tpos: Number,\n\tinsertion: String\n)\n```\n\nInserts the `insertion` before char `pos` (0-indexed).\n\nLocation represents location in the original source and is not influenced by other replacements or insertions.\n\n#### `original`\n\nGet decorated `Source`.\n\n## `CompatSource`\n\nConverts a Source-like object into a real Source object.\n\n### Public methods\n\n#### static `from`\n\n<!-- eslint-skip -->\n\n```typescript\nCompatSource.from(sourceLike: any | Source)\n```\n\nIf `sourceLike` is a real Source it returns it unmodified. Otherwise it returns it wrapped in a CompatSource.\n","publish_time":1790443377550,"_cnpm_publish_time":1790443377550,"dist-tags":{"beta":"2.0.0-beta.10","latest":"3.7.0"}}