WIP: bootstrap and partial real Solana watcher implementation
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
import type * as ts from 'typescript';
|
||||
export declare const getValueOfLiteralType: (type: ts.LiteralType) => bigint | number | string;
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
||||
"name": "minimatch",
|
||||
"description": "a glob matcher in javascript",
|
||||
"version": "10.2.6",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:isaacs/minimatch"
|
||||
},
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"prepare": "tshy",
|
||||
"pretest": "npm run prepare",
|
||||
"presnap": "npm run prepare",
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"format": "prettier --write .",
|
||||
"benchmark": "node benchmark/index.js",
|
||||
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts",
|
||||
"lint": "oxlint --fix src test",
|
||||
"postsnap": "npm run lint",
|
||||
"postlint": "npm run format"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18 || 20 || >=22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.1.2",
|
||||
"mkdirp": "^3.0.1",
|
||||
"oxlint": "^1.76.0",
|
||||
"oxlint-tsgolint": "^7.0.2001",
|
||||
"prettier": "^3.9.6",
|
||||
"tap": "^21.7.5",
|
||||
"tshy": "^4.1.3",
|
||||
"typedoc": "^0.28.20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
},
|
||||
"license": "BlueOak-1.0.0",
|
||||
"tshy": {
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"selfLink": false
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./dist/esm/index.js",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^5.0.8"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
> fast-stable-stringify@0.2.0 table /var/www/fast-stable-stringify
|
||||
> node ./cli/index.js results/libs/*.json
|
||||
|
||||
| Suite | Browser | JSON.stringify@native | fast-stable-stringify@48915d2 | json-stable-stringify@1.0.1 | faster-stable-stringify@1.0.0 |
|
||||
| :---- | :-------------------------------------- | --------------------: | ----------------------------: | --------------------------: | ----------------------------: |
|
||||
| libs | Chrome 60.0.3112 (Windows 7 0.0.0) | 401.69% (±8.33%) | *154.24% (±2.21%) | 100.00% (±2.08%) | 112.80% (±2.43%) |
|
||||
| libs | Chrome Mobile 55.0.2883 (Android 6.0.0) | 442.96% (±24.6%) | *149.99% (±3.69%) | 100.00% (±4.11%) | 127.49% (±2.23%) |
|
||||
| libs | Edge 14.14393.0 (Windows 10 0.0.0) | 452.54% (±8.66%) | *131.31% (±2.46%) | 100.00% (±1.38%) | 110.88% (±1.21%) |
|
||||
| libs | Firefox 54.0.0 (Windows 7 0.0.0) | 486.58% (±18.1%) | *156.10% (±3.53%) | 100.00% (±3.59%) | 128.86% (±3.73%) |
|
||||
| libs | IE 10.0.0 (Windows 7 0.0.0) | 419.75% (±13.8%) | *199.75% (±5.28%) | 100.00% (±1.91%) | ? |
|
||||
| libs | IE 11.0.0 (Windows 7 0.0.0) | 314.45% (±5.07%) | *139.88% (±1.89%) | 100.00% (±1.14%) | ? |
|
||||
| libs | IE 9.0.0 (Windows 7 0.0.0) | 317.90% (±3.63%) | *185.72% (±1.37%) | 100.00% (±1.62%) | ? |
|
||||
| libs | Mobile Safari 10.0.0 (iOS 10.3.0) | 746.20% (±14.7%) | *128.14% (±2.21%) | 100.00% (±1.52%) | *123.21% (±3.26%) |
|
||||
| libs | Safari 10.0.1 (Mac OS X 10.12.1) | 765.32% (±15.0%) | *125.73% (±2.62%) | 100.00% (±1.39%) | 106.87% (±2.29%) |
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAUtD,CAAA"}
|
||||
@@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = prettifyLevel
|
||||
|
||||
const getPropertyValue = require('./get-property-value')
|
||||
|
||||
/**
|
||||
* @typedef {object} PrettifyLevelParams
|
||||
* @property {object} log The log object.
|
||||
* @property {PrettyContext} context The context object built from parsing
|
||||
* the options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if the passed in log has a `level` value and returns a prettified
|
||||
* string for that level if so.
|
||||
*
|
||||
* @param {PrettifyLevelParams} input
|
||||
*
|
||||
* @returns {undefined|string} If `log` does not have a `level` property then
|
||||
* `undefined` will be returned. Otherwise, a string from the specified
|
||||
* `colorizer` is returned.
|
||||
*/
|
||||
function prettifyLevel ({ log, context }) {
|
||||
const {
|
||||
colorizer,
|
||||
customLevels,
|
||||
customLevelNames,
|
||||
levelKey,
|
||||
getLevelLabelData
|
||||
} = context
|
||||
const prettifier = context.customPrettifiers?.level
|
||||
const output = getPropertyValue(log, levelKey)
|
||||
if (output === undefined) return undefined
|
||||
const labelColorized = colorizer(output, { customLevels, customLevelNames })
|
||||
if (prettifier) {
|
||||
const [label] = getLevelLabelData(output)
|
||||
return prettifier(output, levelKey, log, { label, labelColorized, colors: colorizer.colors })
|
||||
}
|
||||
return labelColorized
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { _ as default } from "../esm/_instanceof.js";
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"p521.d.ts","sourceRoot":"","sources":["src/p521.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAe,IAAI,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AACvD,sEAAsE;AACtE,eAAO,MAAM,IAAI,EAAE,OAAO,KAAa,CAAC;AACxC,sEAAsE;AACtE,eAAO,MAAM,SAAS,EAAE,OAAO,KAAa,CAAC;AAC7C,6EAA6E;AAC7E,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,MAAM,CAAqD,CAAC;AAChG,6EAA6E;AAC7E,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,MAAM,CAAuD,CAAC"}
|
||||
@@ -0,0 +1,765 @@
|
||||
# Source Map JS
|
||||
|
||||
[](https://www.npmjs.com/package/source-map-js)
|
||||
|
||||
Difference between original [source-map](https://github.com/mozilla/source-map):
|
||||
|
||||
> TL,DR: it's fork of original source-map@0.6, but with perfomance optimizations.
|
||||
|
||||
This journey starts from [source-map@0.7.0](https://github.com/mozilla/source-map/blob/master/CHANGELOG.md#070). Some part of it was rewritten to Rust and WASM and API became async.
|
||||
|
||||
It's still a major block for many libraries like PostCSS or Sass for example because they need to migrate the whole API to the async way. This is the reason why 0.6.1 has 2x more downloads than 0.7.3 while it's faster several times.
|
||||
|
||||

|
||||
|
||||
More important that WASM version has some optimizations in JS code too. This is why [community asked to create branch for 0.6 version](https://github.com/mozilla/source-map/issues/324) and port these optimizations but, sadly, the answer was «no». A bit later I discovered [the issue](https://github.com/mozilla/source-map/issues/370) created by [Ben Rothman (@benthemonkey)](https://github.com/benthemonkey) with no response at all.
|
||||
|
||||
[Roman Dvornov (@lahmatiy)](https://github.com/lahmatiy) wrote a [serveral posts](https://t.me/gorshochekvarit/76) (russian, only, sorry) about source-map library in his own Telegram channel. He mentioned the article [«Maybe you don't need Rust and WASM to speed up your JS»](https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html) written by [Vyacheslav Egorov (@mraleph)](https://github.com/mraleph). This article contains optimizations and hacks that lead to almost the same performance compare to WASM implementation.
|
||||
|
||||
I decided to fork the original source-map and port these optimizations from the article and several others PR from the original source-map.
|
||||
|
||||
---------
|
||||
|
||||
This is a library to generate and consume the source map format
|
||||
[described here][format].
|
||||
|
||||
[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
||||
|
||||
## Use with Node
|
||||
|
||||
$ npm install source-map-js
|
||||
|
||||
<!-- ## Use on the Web
|
||||
|
||||
<script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script> -->
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
<!-- `npm run toc` to regenerate the Table of Contents -->
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
## Table of Contents
|
||||
|
||||
- [Examples](#examples)
|
||||
- [Consuming a source map](#consuming-a-source-map)
|
||||
- [Generating a source map](#generating-a-source-map)
|
||||
- [With SourceNode (high level API)](#with-sourcenode-high-level-api)
|
||||
- [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
|
||||
- [API](#api)
|
||||
- [SourceMapConsumer](#sourcemapconsumer)
|
||||
- [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
|
||||
- [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
|
||||
- [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
|
||||
- [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
|
||||
- [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
|
||||
- [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
|
||||
- [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
|
||||
- [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
|
||||
- [SourceMapGenerator](#sourcemapgenerator)
|
||||
- [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
|
||||
- [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
|
||||
- [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
|
||||
- [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
|
||||
- [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
|
||||
- [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
|
||||
- [SourceNode](#sourcenode)
|
||||
- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
|
||||
- [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
|
||||
- [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
|
||||
- [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
|
||||
- [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
|
||||
- [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
|
||||
- [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
|
||||
- [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
|
||||
- [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
|
||||
- [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
|
||||
- [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Examples
|
||||
|
||||
### Consuming a source map
|
||||
|
||||
```js
|
||||
var rawSourceMap = {
|
||||
version: 3,
|
||||
file: 'min.js',
|
||||
names: ['bar', 'baz', 'n'],
|
||||
sources: ['one.js', 'two.js'],
|
||||
sourceRoot: 'http://example.com/www/js/',
|
||||
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
|
||||
};
|
||||
|
||||
var smc = new SourceMapConsumer(rawSourceMap);
|
||||
|
||||
console.log(smc.sources);
|
||||
// [ 'http://example.com/www/js/one.js',
|
||||
// 'http://example.com/www/js/two.js' ]
|
||||
|
||||
console.log(smc.originalPositionFor({
|
||||
line: 2,
|
||||
column: 28
|
||||
}));
|
||||
// { source: 'http://example.com/www/js/two.js',
|
||||
// line: 2,
|
||||
// column: 10,
|
||||
// name: 'n' }
|
||||
|
||||
console.log(smc.generatedPositionFor({
|
||||
source: 'http://example.com/www/js/two.js',
|
||||
line: 2,
|
||||
column: 10
|
||||
}));
|
||||
// { line: 2, column: 28 }
|
||||
|
||||
smc.eachMapping(function (m) {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
### Generating a source map
|
||||
|
||||
In depth guide:
|
||||
[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
|
||||
|
||||
#### With SourceNode (high level API)
|
||||
|
||||
```js
|
||||
function compile(ast) {
|
||||
switch (ast.type) {
|
||||
case 'BinaryExpression':
|
||||
return new SourceNode(
|
||||
ast.location.line,
|
||||
ast.location.column,
|
||||
ast.location.source,
|
||||
[compile(ast.left), " + ", compile(ast.right)]
|
||||
);
|
||||
case 'Literal':
|
||||
return new SourceNode(
|
||||
ast.location.line,
|
||||
ast.location.column,
|
||||
ast.location.source,
|
||||
String(ast.value)
|
||||
);
|
||||
// ...
|
||||
default:
|
||||
throw new Error("Bad AST");
|
||||
}
|
||||
}
|
||||
|
||||
var ast = parse("40 + 2", "add.js");
|
||||
console.log(compile(ast).toStringWithSourceMap({
|
||||
file: 'add.js'
|
||||
}));
|
||||
// { code: '40 + 2',
|
||||
// map: [object SourceMapGenerator] }
|
||||
```
|
||||
|
||||
#### With SourceMapGenerator (low level API)
|
||||
|
||||
```js
|
||||
var map = new SourceMapGenerator({
|
||||
file: "source-mapped.js"
|
||||
});
|
||||
|
||||
map.addMapping({
|
||||
generated: {
|
||||
line: 10,
|
||||
column: 35
|
||||
},
|
||||
source: "foo.js",
|
||||
original: {
|
||||
line: 33,
|
||||
column: 2
|
||||
},
|
||||
name: "christopher"
|
||||
});
|
||||
|
||||
console.log(map.toString());
|
||||
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Get a reference to the module:
|
||||
|
||||
```js
|
||||
// Node.js
|
||||
var sourceMap = require('source-map');
|
||||
|
||||
// Browser builds
|
||||
var sourceMap = window.sourceMap;
|
||||
|
||||
// Inside Firefox
|
||||
const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
|
||||
```
|
||||
|
||||
### SourceMapConsumer
|
||||
|
||||
A SourceMapConsumer instance represents a parsed source map which we can query
|
||||
for information about the original file positions by giving it a file position
|
||||
in the generated source.
|
||||
|
||||
#### new SourceMapConsumer(rawSourceMap)
|
||||
|
||||
The only parameter is the raw source map (either as a string which can be
|
||||
`JSON.parse`'d, or an object). According to the spec, source maps have the
|
||||
following attributes:
|
||||
|
||||
* `version`: Which version of the source map spec this map is following.
|
||||
|
||||
* `sources`: An array of URLs to the original source files.
|
||||
|
||||
* `names`: An array of identifiers which can be referenced by individual
|
||||
mappings.
|
||||
|
||||
* `sourceRoot`: Optional. The URL root from which all sources are relative.
|
||||
|
||||
* `sourcesContent`: Optional. An array of contents of the original source files.
|
||||
|
||||
* `mappings`: A string of base64 VLQs which contain the actual mappings.
|
||||
|
||||
* `file`: Optional. The generated filename this source map is associated with.
|
||||
|
||||
```js
|
||||
var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.computeColumnSpans()
|
||||
|
||||
Compute the last column for each generated mapping. The last column is
|
||||
inclusive.
|
||||
|
||||
```js
|
||||
// Before:
|
||||
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1 },
|
||||
// { line: 2,
|
||||
// column: 10 },
|
||||
// { line: 2,
|
||||
// column: 20 } ]
|
||||
|
||||
consumer.computeColumnSpans();
|
||||
|
||||
// After:
|
||||
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1,
|
||||
// lastColumn: 9 },
|
||||
// { line: 2,
|
||||
// column: 10,
|
||||
// lastColumn: 19 },
|
||||
// { line: 2,
|
||||
// column: 20,
|
||||
// lastColumn: Infinity } ]
|
||||
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
|
||||
|
||||
Returns the original source, line, and column information for the generated
|
||||
source's line and column positions provided. The only argument is an object with
|
||||
the following properties:
|
||||
|
||||
* `line`: The line number in the generated source. Line numbers in
|
||||
this library are 1-based (note that the underlying source map
|
||||
specification uses 0-based line numbers -- this library handles the
|
||||
translation).
|
||||
|
||||
* `column`: The column number in the generated source. Column numbers
|
||||
in this library are 0-based.
|
||||
|
||||
* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
|
||||
`SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
|
||||
element that is smaller than or greater than the one we are searching for,
|
||||
respectively, if the exact element cannot be found. Defaults to
|
||||
`SourceMapConsumer.GREATEST_LOWER_BOUND`.
|
||||
|
||||
and an object is returned with the following properties:
|
||||
|
||||
* `source`: The original source file, or null if this information is not
|
||||
available.
|
||||
|
||||
* `line`: The line number in the original source, or null if this information is
|
||||
not available. The line number is 1-based.
|
||||
|
||||
* `column`: The column number in the original source, or null if this
|
||||
information is not available. The column number is 0-based.
|
||||
|
||||
* `name`: The original identifier, or null if this information is not available.
|
||||
|
||||
```js
|
||||
consumer.originalPositionFor({ line: 2, column: 10 })
|
||||
// { source: 'foo.coffee',
|
||||
// line: 2,
|
||||
// column: 2,
|
||||
// name: null }
|
||||
|
||||
consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
|
||||
// { source: null,
|
||||
// line: null,
|
||||
// column: null,
|
||||
// name: null }
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
|
||||
|
||||
Returns the generated line and column information for the original source,
|
||||
line, and column positions provided. The only argument is an object with
|
||||
the following properties:
|
||||
|
||||
* `source`: The filename of the original source.
|
||||
|
||||
* `line`: The line number in the original source. The line number is
|
||||
1-based.
|
||||
|
||||
* `column`: The column number in the original source. The column
|
||||
number is 0-based.
|
||||
|
||||
and an object is returned with the following properties:
|
||||
|
||||
* `line`: The line number in the generated source, or null. The line
|
||||
number is 1-based.
|
||||
|
||||
* `column`: The column number in the generated source, or null. The
|
||||
column number is 0-based.
|
||||
|
||||
```js
|
||||
consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
|
||||
// { line: 1,
|
||||
// column: 56 }
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
|
||||
|
||||
Returns all generated line and column information for the original source, line,
|
||||
and column provided. If no column is provided, returns all mappings
|
||||
corresponding to a either the line we are searching for or the next closest line
|
||||
that has any mappings. Otherwise, returns all mappings corresponding to the
|
||||
given line and either the column we are searching for or the next closest column
|
||||
that has any offsets.
|
||||
|
||||
The only argument is an object with the following properties:
|
||||
|
||||
* `source`: The filename of the original source.
|
||||
|
||||
* `line`: The line number in the original source. The line number is
|
||||
1-based.
|
||||
|
||||
* `column`: Optional. The column number in the original source. The
|
||||
column number is 0-based.
|
||||
|
||||
and an array of objects is returned, each with the following properties:
|
||||
|
||||
* `line`: The line number in the generated source, or null. The line
|
||||
number is 1-based.
|
||||
|
||||
* `column`: The column number in the generated source, or null. The
|
||||
column number is 0-based.
|
||||
|
||||
```js
|
||||
consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1 },
|
||||
// { line: 2,
|
||||
// column: 10 },
|
||||
// { line: 2,
|
||||
// column: 20 } ]
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.hasContentsOfAllSources()
|
||||
|
||||
Return true if we have the embedded source content for every source listed in
|
||||
the source map, false otherwise.
|
||||
|
||||
In other words, if this method returns `true`, then
|
||||
`consumer.sourceContentFor(s)` will succeed for every source `s` in
|
||||
`consumer.sources`.
|
||||
|
||||
```js
|
||||
// ...
|
||||
if (consumer.hasContentsOfAllSources()) {
|
||||
consumerReadyCallback(consumer);
|
||||
} else {
|
||||
fetchSources(consumer, consumerReadyCallback);
|
||||
}
|
||||
// ...
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
|
||||
|
||||
Returns the original source content for the source provided. The only
|
||||
argument is the URL of the original source file.
|
||||
|
||||
If the source content for the given source is not found, then an error is
|
||||
thrown. Optionally, pass `true` as the second param to have `null` returned
|
||||
instead.
|
||||
|
||||
```js
|
||||
consumer.sources
|
||||
// [ "my-cool-lib.clj" ]
|
||||
|
||||
consumer.sourceContentFor("my-cool-lib.clj")
|
||||
// "..."
|
||||
|
||||
consumer.sourceContentFor("this is not in the source map");
|
||||
// Error: "this is not in the source map" is not in the source map
|
||||
|
||||
consumer.sourceContentFor("this is not in the source map", true);
|
||||
// null
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
|
||||
|
||||
Iterate over each mapping between an original source/line/column and a
|
||||
generated line/column in this source map.
|
||||
|
||||
* `callback`: The function that is called with each mapping. Mappings have the
|
||||
form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
|
||||
name }`
|
||||
|
||||
* `context`: Optional. If specified, this object will be the value of `this`
|
||||
every time that `callback` is called.
|
||||
|
||||
* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
|
||||
`SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
|
||||
the mappings sorted by the generated file's line/column order or the
|
||||
original's source/line/column order, respectively. Defaults to
|
||||
`SourceMapConsumer.GENERATED_ORDER`.
|
||||
|
||||
```js
|
||||
consumer.eachMapping(function (m) { console.log(m); })
|
||||
// ...
|
||||
// { source: 'illmatic.js',
|
||||
// generatedLine: 1,
|
||||
// generatedColumn: 0,
|
||||
// originalLine: 1,
|
||||
// originalColumn: 0,
|
||||
// name: null }
|
||||
// { source: 'illmatic.js',
|
||||
// generatedLine: 2,
|
||||
// generatedColumn: 0,
|
||||
// originalLine: 2,
|
||||
// originalColumn: 0,
|
||||
// name: null }
|
||||
// ...
|
||||
```
|
||||
### SourceMapGenerator
|
||||
|
||||
An instance of the SourceMapGenerator represents a source map which is being
|
||||
built incrementally.
|
||||
|
||||
#### new SourceMapGenerator([startOfSourceMap])
|
||||
|
||||
You may pass an object with the following properties:
|
||||
|
||||
* `file`: The filename of the generated source that this source map is
|
||||
associated with.
|
||||
|
||||
* `sourceRoot`: A root for all relative URLs in this source map.
|
||||
|
||||
* `skipValidation`: Optional. When `true`, disables validation of mappings as
|
||||
they are added. This can improve performance but should be used with
|
||||
discretion, as a last resort. Even then, one should avoid using this flag when
|
||||
running tests, if possible.
|
||||
|
||||
* `ignoreInvalidMapping`: Optional. When `true`, instead of throwing error on
|
||||
invalid mapping, it will be ignored.
|
||||
|
||||
```js
|
||||
var generator = new sourceMap.SourceMapGenerator({
|
||||
file: "my-generated-javascript-file.js",
|
||||
sourceRoot: "http://example.com/app/js/"
|
||||
});
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.fromSourceMap(sourceMapConsumer, sourceMapGeneratorOptions)
|
||||
|
||||
Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
|
||||
|
||||
* `sourceMapConsumer` The SourceMap.
|
||||
|
||||
* `sourceMapGeneratorOptions` options that will be passed to the SourceMapGenerator constructor which used under the hood.
|
||||
|
||||
```js
|
||||
var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer, {
|
||||
ignoreInvalidMapping: true,
|
||||
});
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.addMapping(mapping)
|
||||
|
||||
Add a single mapping from original source line and column to the generated
|
||||
source's line and column for this source map being created. The mapping object
|
||||
should have the following properties:
|
||||
|
||||
* `generated`: An object with the generated line and column positions.
|
||||
|
||||
* `original`: An object with the original line and column positions.
|
||||
|
||||
* `source`: The original source file (relative to the sourceRoot).
|
||||
|
||||
* `name`: An optional original token name for this mapping.
|
||||
|
||||
```js
|
||||
generator.addMapping({
|
||||
source: "module-one.scm",
|
||||
original: { line: 128, column: 0 },
|
||||
generated: { line: 3, column: 456 }
|
||||
})
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
|
||||
|
||||
Set the source content for an original source file.
|
||||
|
||||
* `sourceFile` the URL of the original source file.
|
||||
|
||||
* `sourceContent` the content of the source file.
|
||||
|
||||
```js
|
||||
generator.setSourceContent("module-one.scm",
|
||||
fs.readFileSync("path/to/module-one.scm"))
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
|
||||
|
||||
Applies a SourceMap for a source file to the SourceMap.
|
||||
Each mapping to the supplied source file is rewritten using the
|
||||
supplied SourceMap. Note: The resolution for the resulting mappings
|
||||
is the minimum of this map and the supplied map.
|
||||
|
||||
* `sourceMapConsumer`: The SourceMap to be applied.
|
||||
|
||||
* `sourceFile`: Optional. The filename of the source file.
|
||||
If omitted, sourceMapConsumer.file will be used, if it exists.
|
||||
Otherwise an error will be thrown.
|
||||
|
||||
* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
|
||||
to be applied. If relative, it is relative to the SourceMap.
|
||||
|
||||
This parameter is needed when the two SourceMaps aren't in the same
|
||||
directory, and the SourceMap to be applied contains relative source
|
||||
paths. If so, those relative source paths need to be rewritten
|
||||
relative to the SourceMap.
|
||||
|
||||
If omitted, it is assumed that both SourceMaps are in the same directory,
|
||||
thus not needing any rewriting. (Supplying `'.'` has the same effect.)
|
||||
|
||||
#### SourceMapGenerator.prototype.toString()
|
||||
|
||||
Renders the source map being generated to a string.
|
||||
|
||||
```js
|
||||
generator.toString()
|
||||
// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
|
||||
```
|
||||
|
||||
### SourceNode
|
||||
|
||||
SourceNodes provide a way to abstract over interpolating and/or concatenating
|
||||
snippets of generated JavaScript source code, while maintaining the line and
|
||||
column information associated between those snippets and the original source
|
||||
code. This is useful as the final intermediate representation a compiler might
|
||||
use before outputting the generated JS and source map.
|
||||
|
||||
#### new SourceNode([line, column, source[, chunk[, name]]])
|
||||
|
||||
* `line`: The original line number associated with this source node, or null if
|
||||
it isn't associated with an original line. The line number is 1-based.
|
||||
|
||||
* `column`: The original column number associated with this source node, or null
|
||||
if it isn't associated with an original column. The column number
|
||||
is 0-based.
|
||||
|
||||
* `source`: The original source's filename; null if no filename is provided.
|
||||
|
||||
* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
|
||||
below.
|
||||
|
||||
* `name`: Optional. The original identifier.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.cpp", [
|
||||
new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
|
||||
new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
|
||||
new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
|
||||
]);
|
||||
```
|
||||
|
||||
#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
|
||||
|
||||
Creates a SourceNode from generated code and a SourceMapConsumer.
|
||||
|
||||
* `code`: The generated code
|
||||
|
||||
* `sourceMapConsumer` The SourceMap for the generated code
|
||||
|
||||
* `relativePath` The optional path that relative sources in `sourceMapConsumer`
|
||||
should be relative to.
|
||||
|
||||
```js
|
||||
var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
|
||||
var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
|
||||
consumer);
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.add(chunk)
|
||||
|
||||
Add a chunk of generated JS to this source node.
|
||||
|
||||
* `chunk`: A string snippet of generated JS code, another instance of
|
||||
`SourceNode`, or an array where each member is one of those things.
|
||||
|
||||
```js
|
||||
node.add(" + ");
|
||||
node.add(otherNode);
|
||||
node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.prepend(chunk)
|
||||
|
||||
Prepend a chunk of generated JS to this source node.
|
||||
|
||||
* `chunk`: A string snippet of generated JS code, another instance of
|
||||
`SourceNode`, or an array where each member is one of those things.
|
||||
|
||||
```js
|
||||
node.prepend("/** Build Id: f783haef86324gf **/\n\n");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
|
||||
|
||||
Set the source content for a source file. This will be added to the
|
||||
`SourceMap` in the `sourcesContent` field.
|
||||
|
||||
* `sourceFile`: The filename of the source file
|
||||
|
||||
* `sourceContent`: The content of the source file
|
||||
|
||||
```js
|
||||
node.setSourceContent("module-one.scm",
|
||||
fs.readFileSync("path/to/module-one.scm"))
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.walk(fn)
|
||||
|
||||
Walk over the tree of JS snippets in this node and its children. The walking
|
||||
function is called once for each snippet of JS and is passed that snippet and
|
||||
the its original associated source's line/column location.
|
||||
|
||||
* `fn`: The traversal function.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.walk(function (code, loc) { console.log("WALK:", code, loc); })
|
||||
// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
|
||||
// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
|
||||
// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
|
||||
// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.walkSourceContents(fn)
|
||||
|
||||
Walk over the tree of SourceNodes. The walking function is called for each
|
||||
source file content and is passed the filename and source content.
|
||||
|
||||
* `fn`: The traversal function.
|
||||
|
||||
```js
|
||||
var a = new SourceNode(1, 2, "a.js", "generated from a");
|
||||
a.setSourceContent("a.js", "original a");
|
||||
var b = new SourceNode(1, 2, "b.js", "generated from b");
|
||||
b.setSourceContent("b.js", "original b");
|
||||
var c = new SourceNode(1, 2, "c.js", "generated from c");
|
||||
c.setSourceContent("c.js", "original c");
|
||||
|
||||
var node = new SourceNode(null, null, null, [a, b, c]);
|
||||
node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
|
||||
// WALK: a.js : original a
|
||||
// WALK: b.js : original b
|
||||
// WALK: c.js : original c
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.join(sep)
|
||||
|
||||
Like `Array.prototype.join` except for SourceNodes. Inserts the separator
|
||||
between each of this source node's children.
|
||||
|
||||
* `sep`: The separator.
|
||||
|
||||
```js
|
||||
var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
|
||||
var operand = new SourceNode(3, 4, "a.rs", "=");
|
||||
var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
|
||||
|
||||
var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
|
||||
var joinedNode = node.join(" ");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.replaceRight(pattern, replacement)
|
||||
|
||||
Call `String.prototype.replace` on the very right-most source snippet. Useful
|
||||
for trimming white space from the end of a source node, etc.
|
||||
|
||||
* `pattern`: The pattern to replace.
|
||||
|
||||
* `replacement`: The thing to replace the pattern with.
|
||||
|
||||
```js
|
||||
// Trim trailing white space.
|
||||
node.replaceRight(/\s*$/, "");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.toString()
|
||||
|
||||
Return the string representation of this source node. Walks over the tree and
|
||||
concatenates all the various snippets together to one string.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.toString()
|
||||
// 'unodostresquatro'
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
|
||||
|
||||
Returns the string representation of this tree of source nodes, plus a
|
||||
SourceMapGenerator which contains all the mappings between the generated and
|
||||
original sources.
|
||||
|
||||
The arguments are the same as those to `new SourceMapGenerator`.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.toStringWithSourceMap({ file: "my-output-file.js" })
|
||||
// { code: 'unodostresquatro',
|
||||
// map: [object SourceMapGenerator] }
|
||||
```
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
export {
|
||||
parse,
|
||||
safeParse,
|
||||
parseAsync,
|
||||
safeParseAsync,
|
||||
encode,
|
||||
decode,
|
||||
encodeAsync,
|
||||
decodeAsync,
|
||||
safeEncode,
|
||||
safeDecode,
|
||||
safeEncodeAsync,
|
||||
safeDecodeAsync,
|
||||
} from "../core/index.js";
|
||||
@@ -0,0 +1,130 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DEFAULT_EXTRA_FILE_EXTENSIONS = void 0;
|
||||
exports.createDefaultCompilerOptionsFromExtra = createDefaultCompilerOptionsFromExtra;
|
||||
exports.getCanonicalFileName = getCanonicalFileName;
|
||||
exports.ensureAbsolutePath = ensureAbsolutePath;
|
||||
exports.canonicalDirname = canonicalDirname;
|
||||
exports.getAstFromProgram = getAstFromProgram;
|
||||
exports.createHash = createHash;
|
||||
const tsconfig_utils_1 = require("@typescript-eslint/tsconfig-utils");
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
/**
|
||||
* Default compiler options for program generation
|
||||
*/
|
||||
const DEFAULT_COMPILER_OPTIONS = {
|
||||
...tsconfig_utils_1.CORE_COMPILER_OPTIONS,
|
||||
allowJs: true,
|
||||
allowNonTsExtensions: true,
|
||||
checkJs: true,
|
||||
};
|
||||
exports.DEFAULT_EXTRA_FILE_EXTENSIONS = new Set([
|
||||
ts.Extension.Cjs,
|
||||
ts.Extension.Cts,
|
||||
ts.Extension.Js,
|
||||
ts.Extension.Jsx,
|
||||
ts.Extension.Mjs,
|
||||
ts.Extension.Mts,
|
||||
ts.Extension.Ts,
|
||||
ts.Extension.Tsx,
|
||||
]);
|
||||
function createDefaultCompilerOptionsFromExtra(parseSettings) {
|
||||
if (parseSettings.debugLevel.has('typescript')) {
|
||||
return {
|
||||
...DEFAULT_COMPILER_OPTIONS,
|
||||
extendedDiagnostics: true,
|
||||
};
|
||||
}
|
||||
return DEFAULT_COMPILER_OPTIONS;
|
||||
}
|
||||
// typescript doesn't provide a ts.sys implementation for browser environments
|
||||
const useCaseSensitiveFileNames =
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/internal/eqeq-nullish
|
||||
ts.sys !== undefined ? ts.sys.useCaseSensitiveFileNames : true;
|
||||
const correctPathCasing = useCaseSensitiveFileNames
|
||||
? (filePath) => filePath
|
||||
: (filePath) => filePath.toLowerCase();
|
||||
function getCanonicalFileName(filePath) {
|
||||
let normalized = node_path_1.default.normalize(filePath);
|
||||
if (normalized.endsWith(node_path_1.default.sep)) {
|
||||
normalized = normalized.slice(0, -1);
|
||||
}
|
||||
return correctPathCasing(normalized);
|
||||
}
|
||||
function ensureAbsolutePath(p, tsconfigRootDir) {
|
||||
return node_path_1.default.resolve(tsconfigRootDir, p);
|
||||
}
|
||||
function canonicalDirname(p) {
|
||||
return node_path_1.default.dirname(p);
|
||||
}
|
||||
const DEFINITION_EXTENSIONS = [
|
||||
ts.Extension.Dts,
|
||||
ts.Extension.Dcts,
|
||||
ts.Extension.Dmts,
|
||||
];
|
||||
function getExtension(fileName) {
|
||||
if (!fileName) {
|
||||
return null;
|
||||
}
|
||||
return (DEFINITION_EXTENSIONS.find(definitionExt => fileName.endsWith(definitionExt)) ?? node_path_1.default.extname(fileName));
|
||||
}
|
||||
function getAstFromProgram(currentProgram, filePath) {
|
||||
const ast = currentProgram.getSourceFile(filePath);
|
||||
// working around https://github.com/typescript-eslint/typescript-eslint/issues/1573
|
||||
const expectedExt = getExtension(filePath);
|
||||
const returnedExt = getExtension(ast?.fileName);
|
||||
if (expectedExt !== returnedExt) {
|
||||
return undefined;
|
||||
}
|
||||
return ast && { ast, program: currentProgram };
|
||||
}
|
||||
/**
|
||||
* Hash content for compare content.
|
||||
* @param content hashed contend
|
||||
* @returns hashed result
|
||||
*/
|
||||
function createHash(content) {
|
||||
// No ts.sys in browser environments.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (ts.sys?.createHash) {
|
||||
return ts.sys.createHash(content);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
import { FSLike } from "fdir";
|
||||
|
||||
//#region src/types.d.ts
|
||||
type FileSystemAdapter = Partial<FSLike>;
|
||||
interface GlobOptions {
|
||||
/**
|
||||
* Whether to return absolute paths. Disable to have relative paths.
|
||||
* @default false
|
||||
*/
|
||||
absolute?: boolean;
|
||||
/**
|
||||
* Enables support for brace expansion syntax, like `{a,b}` or `{1..9}`.
|
||||
* @default true
|
||||
*/
|
||||
braceExpansion?: boolean;
|
||||
/**
|
||||
* Whether to match in case-sensitive mode.
|
||||
* @default true
|
||||
*/
|
||||
caseSensitiveMatch?: boolean;
|
||||
/**
|
||||
* The working directory in which to search. Results will be returned relative to this directory, unless
|
||||
* {@link absolute} is set.
|
||||
*
|
||||
* It is important to avoid globbing outside this directory when possible, even with absolute paths enabled,
|
||||
* as doing so can harm performance due to having to recalculate relative paths.
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string | URL;
|
||||
/**
|
||||
* Logs useful debug information. Meant for development purposes. Logs can change at any time.
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* Maximum directory depth to crawl.
|
||||
* @default Infinity
|
||||
*/
|
||||
deep?: number;
|
||||
/**
|
||||
* Whether to return entries that start with a dot, like `.gitignore` or `.prettierrc`.
|
||||
* @default false
|
||||
*/
|
||||
dot?: boolean;
|
||||
/**
|
||||
* Whether to automatically expand directory patterns.
|
||||
*
|
||||
* Important to disable if migrating from [`fast-glob`](https://github.com/mrmlnc/fast-glob).
|
||||
* @default true
|
||||
*/
|
||||
expandDirectories?: boolean;
|
||||
/**
|
||||
* Enables support for extglobs, like `+(pattern)`.
|
||||
* @default true
|
||||
*/
|
||||
extglob?: boolean;
|
||||
/**
|
||||
* Whether to traverse and include symbolic links. Can slightly affect performance.
|
||||
* @default true
|
||||
*/
|
||||
followSymbolicLinks?: boolean;
|
||||
/**
|
||||
* An object that overrides `node:fs` functions.
|
||||
* @default import('node:fs')
|
||||
*/
|
||||
fs?: FileSystemAdapter;
|
||||
/**
|
||||
* Enables support for matching nested directories with globstars (`**`).
|
||||
* If `false`, `**` behaves exactly like `*`.
|
||||
* @default true
|
||||
*/
|
||||
globstar?: boolean;
|
||||
/**
|
||||
* Glob patterns to exclude from the results.
|
||||
* @default []
|
||||
*/
|
||||
ignore?: string | readonly string[];
|
||||
/**
|
||||
* Enable to only return directories.
|
||||
* If `true`, disables {@link onlyFiles}.
|
||||
* @default false
|
||||
*/
|
||||
onlyDirectories?: boolean;
|
||||
/**
|
||||
* Enable to only return files.
|
||||
* @default true
|
||||
*/
|
||||
onlyFiles?: boolean;
|
||||
/**
|
||||
* @deprecated Provide patterns as the first argument instead.
|
||||
*/
|
||||
patterns?: string | readonly string[];
|
||||
/**
|
||||
* An `AbortSignal` to abort crawling the file system.
|
||||
* @default undefined
|
||||
*/
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
//#endregion
|
||||
//#region src/utils.d.ts
|
||||
/**
|
||||
* Converts a path to a pattern depending on the platform.
|
||||
* Identical to {@link escapePath} on POSIX systems.
|
||||
* @see {@link https://superchupu.dev/tinyglobby/documentation#convertPathToPattern}
|
||||
*/
|
||||
declare const convertPathToPattern: (path: string) => string;
|
||||
/**
|
||||
* Escapes a path's special characters depending on the platform.
|
||||
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
||||
*/
|
||||
declare const escapePath: (path: string) => string;
|
||||
/**
|
||||
* Checks if a pattern has dynamic parts.
|
||||
*
|
||||
* Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
|
||||
*
|
||||
* - Doesn't necessarily return `false` on patterns that include `\`.
|
||||
* - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
|
||||
* - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
|
||||
* - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
|
||||
*
|
||||
* @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
|
||||
*/
|
||||
declare function isDynamicPattern(pattern: string, options?: {
|
||||
caseSensitiveMatch: boolean;
|
||||
}): boolean;
|
||||
//#endregion
|
||||
//#region src/index.d.ts
|
||||
/**
|
||||
* Asynchronously match files following a glob pattern.
|
||||
* @see {@link https://superchupu.dev/tinyglobby/documentation#glob}
|
||||
*/
|
||||
declare function glob(patterns: string | readonly string[], options?: Omit<GlobOptions, "patterns">): Promise<string[]>;
|
||||
/**
|
||||
* @deprecated Provide patterns as the first argument instead.
|
||||
*/
|
||||
declare function glob(options: GlobOptions): Promise<string[]>;
|
||||
/**
|
||||
* Synchronously match files following a glob pattern.
|
||||
* @see {@link https://superchupu.dev/tinyglobby/documentation#globSync}
|
||||
*/
|
||||
declare function globSync(patterns: string | readonly string[], options?: Omit<GlobOptions, "patterns">): string[];
|
||||
/**
|
||||
* @deprecated Provide patterns as the first argument instead.
|
||||
*/
|
||||
declare function globSync(options: GlobOptions): string[];
|
||||
//#endregion
|
||||
export { type FileSystemAdapter, type GlobOptions, convertPathToPattern, escapePath, glob, globSync, isDynamicPattern };
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { TSESTree } from '@typescript-eslint/types';
|
||||
import type { ScopeManager } from '../ScopeManager';
|
||||
import type { Scope } from './Scope';
|
||||
import { ScopeBase } from './ScopeBase';
|
||||
import { ScopeType } from './ScopeType';
|
||||
export declare class ClassStaticBlockScope extends ScopeBase<ScopeType.classStaticBlock, TSESTree.StaticBlock, Scope> {
|
||||
constructor(scopeManager: ScopeManager, upperScope: ClassStaticBlockScope['upper'], block: ClassStaticBlockScope['block']);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
function _non_iterable_rest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
export { _non_iterable_rest as _ };
|
||||
@@ -0,0 +1,88 @@
|
||||
# @vitest/snapshot
|
||||
|
||||
[](https://npmx.dev/package/@vitest/snapshot)
|
||||
|
||||
Lightweight implementation of Jest's snapshots.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { SnapshotClient } from '@vitest/snapshot'
|
||||
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment'
|
||||
import { SnapshotManager } from '@vitest/snapshot/manager'
|
||||
|
||||
const client = new SnapshotClient({
|
||||
// you need to provide your own equality check implementation if you use it
|
||||
// this function is called when `.toMatchSnapshot({ property: 1 })` is called
|
||||
isEqual: (received, expected) =>
|
||||
equals(received, expected, [iterableEquality, subsetEquality]),
|
||||
})
|
||||
|
||||
// class that implements snapshot saving and reading
|
||||
// by default uses fs module, but you can provide your own implementation depending on the environment
|
||||
const environment = new NodeSnapshotEnvironment()
|
||||
|
||||
// you need to implement this yourselves,
|
||||
// this depends on your runner
|
||||
function getCurrentFilepath() {
|
||||
return '/file.spec.js'
|
||||
}
|
||||
function getCurrentTestName() {
|
||||
return 'test1'
|
||||
}
|
||||
|
||||
// example for inline snapshots, nothing is required to support regular snapshots,
|
||||
// just call `assert` with `isInline: false`
|
||||
function wrapper(received) {
|
||||
function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
||||
client.assert({
|
||||
received,
|
||||
message,
|
||||
isInline: true,
|
||||
inlineSnapshot,
|
||||
filepath: getCurrentFilepath(),
|
||||
name: getCurrentTestName(),
|
||||
})
|
||||
}
|
||||
return {
|
||||
// the name is hard-coded, it should be inside another function, so Vitest can find the actual test file where it was called (parses call stack trace + 2)
|
||||
// you can override this behaviour in SnapshotState's `_inferInlineSnapshotStack` method by providing your own SnapshotState to SnapshotClient constructor
|
||||
toMatchInlineSnapshot: (...args) => __INLINE_SNAPSHOT__(...args),
|
||||
}
|
||||
}
|
||||
|
||||
const options = {
|
||||
updateSnapshot: 'new',
|
||||
snapshotEnvironment: environment,
|
||||
}
|
||||
|
||||
await client.startCurrentRun(
|
||||
getCurrentFilepath(),
|
||||
getCurrentTestName(),
|
||||
options
|
||||
)
|
||||
|
||||
// this will save snapshot to a file which is returned by "snapshotEnvironment.resolvePath"
|
||||
client.assert({
|
||||
received: 'some text',
|
||||
isInline: false,
|
||||
})
|
||||
|
||||
// uses "pretty-format", so it requires quotes
|
||||
// also naming is hard-coded when parsing test files
|
||||
wrapper('text 1').toMatchInlineSnapshot()
|
||||
wrapper('text 2').toMatchInlineSnapshot('"text 2"')
|
||||
|
||||
const result = await client.finishCurrentRun() // this saves files and returns SnapshotResult
|
||||
|
||||
// you can use manager to manage several clients
|
||||
const manager = new SnapshotManager(options)
|
||||
manager.add(result)
|
||||
|
||||
// do something
|
||||
// and then read the summary
|
||||
|
||||
console.log(manager.summary)
|
||||
```
|
||||
|
||||
[GitHub](https://github.com/vitest-dev/vitest/tree/main/packages/snapshot) | [Documentation](https://vitest.dev/guide/snapshot)
|
||||
@@ -0,0 +1,217 @@
|
||||
/**
|
||||
* @fileoverview Rule that warns when identifier names are shorter or longer
|
||||
* than the values provided in configuration.
|
||||
* @author Burak Yigit Kaya aka BYK
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const { getGraphemeCount } = require("../shared/string-utils");
|
||||
const {
|
||||
getModuleExportName,
|
||||
isImportAttributeKey,
|
||||
} = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
exceptionPatterns: [],
|
||||
exceptions: [],
|
||||
min: 2,
|
||||
properties: "always",
|
||||
},
|
||||
],
|
||||
|
||||
docs: {
|
||||
description: "Enforce minimum and maximum identifier lengths",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/id-length",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
min: {
|
||||
type: "integer",
|
||||
},
|
||||
max: {
|
||||
type: "integer",
|
||||
},
|
||||
exceptions: {
|
||||
type: "array",
|
||||
uniqueItems: true,
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
exceptionPatterns: {
|
||||
type: "array",
|
||||
uniqueItems: true,
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
properties: {
|
||||
enum: ["always", "never"],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
tooShort: "Identifier name '{{name}}' is too short (< {{min}}).",
|
||||
tooShortPrivate:
|
||||
"Identifier name '#{{name}}' is too short (< {{min}}).",
|
||||
tooLong: "Identifier name '{{name}}' is too long (> {{max}}).",
|
||||
tooLongPrivate:
|
||||
"Identifier name #'{{name}}' is too long (> {{max}}).",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [options] = context.options;
|
||||
const { max: maxLength = Infinity, min: minLength } = options;
|
||||
const properties = options.properties !== "never";
|
||||
const exceptions = new Set(options.exceptions);
|
||||
const exceptionPatterns = options.exceptionPatterns.map(
|
||||
pattern => new RegExp(pattern, "u"),
|
||||
);
|
||||
const reportedNodes = new Set();
|
||||
|
||||
/**
|
||||
* Checks if a string matches the provided exception patterns
|
||||
* @param {string} name The string to check.
|
||||
* @returns {boolean} if the string is a match
|
||||
* @private
|
||||
*/
|
||||
function matchesExceptionPattern(name) {
|
||||
return exceptionPatterns.some(pattern => pattern.test(name));
|
||||
}
|
||||
|
||||
const SUPPORTED_EXPRESSIONS = {
|
||||
MemberExpression:
|
||||
properties &&
|
||||
function (parent) {
|
||||
return (
|
||||
!parent.computed &&
|
||||
// regular property assignment
|
||||
((parent.parent.left === parent &&
|
||||
parent.parent.type === "AssignmentExpression") ||
|
||||
// or the last identifier in an ObjectPattern destructuring
|
||||
(parent.parent.type === "Property" &&
|
||||
parent.parent.value === parent &&
|
||||
parent.parent.parent.type === "ObjectPattern" &&
|
||||
parent.parent.parent.parent.left ===
|
||||
parent.parent.parent))
|
||||
);
|
||||
},
|
||||
AssignmentPattern(parent, node) {
|
||||
return parent.left === node;
|
||||
},
|
||||
VariableDeclarator(parent, node) {
|
||||
return parent.id === node;
|
||||
},
|
||||
Property(parent, node) {
|
||||
if (parent.parent.type === "ObjectPattern") {
|
||||
const isKeyAndValueSame =
|
||||
parent.value.name === parent.key.name;
|
||||
|
||||
return (
|
||||
(!isKeyAndValueSame && parent.value === node) ||
|
||||
(isKeyAndValueSame && parent.key === node && properties)
|
||||
);
|
||||
}
|
||||
return (
|
||||
properties &&
|
||||
!isImportAttributeKey(node) &&
|
||||
!parent.computed &&
|
||||
parent.key.name === node.name
|
||||
);
|
||||
},
|
||||
ImportSpecifier(parent, node) {
|
||||
return (
|
||||
parent.local === node &&
|
||||
getModuleExportName(parent.imported) !==
|
||||
getModuleExportName(parent.local)
|
||||
);
|
||||
},
|
||||
ImportDefaultSpecifier: true,
|
||||
ImportNamespaceSpecifier: true,
|
||||
RestElement: true,
|
||||
FunctionExpression: true,
|
||||
ArrowFunctionExpression: true,
|
||||
ClassDeclaration: true,
|
||||
FunctionDeclaration: true,
|
||||
MethodDefinition: true,
|
||||
PropertyDefinition: true,
|
||||
CatchClause: true,
|
||||
ArrayPattern: true,
|
||||
};
|
||||
|
||||
return {
|
||||
[["Identifier", "PrivateIdentifier"]](node) {
|
||||
const name = node.name;
|
||||
const parent = node.parent;
|
||||
|
||||
const nameLength = getGraphemeCount(name);
|
||||
|
||||
const isShort = nameLength < minLength;
|
||||
const isLong = nameLength > maxLength;
|
||||
|
||||
if (
|
||||
!(isShort || isLong) ||
|
||||
exceptions.has(name) ||
|
||||
matchesExceptionPattern(name)
|
||||
) {
|
||||
return; // Nothing to report
|
||||
}
|
||||
|
||||
const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type];
|
||||
|
||||
/*
|
||||
* We used the range instead of the node because it's possible
|
||||
* for the same identifier to be represented by two different
|
||||
* nodes, with the most clear example being shorthand properties:
|
||||
* { foo }
|
||||
* In this case, "foo" is represented by one node for the name
|
||||
* and one for the value. The only way to know they are the same
|
||||
* is to look at the range.
|
||||
*/
|
||||
if (
|
||||
isValidExpression &&
|
||||
!reportedNodes.has(node.range.toString()) &&
|
||||
(isValidExpression === true ||
|
||||
isValidExpression(parent, node))
|
||||
) {
|
||||
reportedNodes.add(node.range.toString());
|
||||
|
||||
let messageId = isShort ? "tooShort" : "tooLong";
|
||||
|
||||
if (node.type === "PrivateIdentifier") {
|
||||
messageId += "Private";
|
||||
}
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
data: { name, min: minLength, max: maxLength },
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
export function merge(...sets) {
|
||||
if (sets.length > 1) {
|
||||
sets[0] = sets[0].slice(0, -1);
|
||||
const xl = sets.length - 1;
|
||||
for (let x = 1; x < xl; ++x) {
|
||||
sets[x] = sets[x].slice(1, -1);
|
||||
}
|
||||
sets[xl] = sets[xl].slice(1);
|
||||
return sets.join('');
|
||||
}
|
||||
else {
|
||||
return sets[0];
|
||||
}
|
||||
}
|
||||
export function subexp(str) {
|
||||
return "(?:" + str + ")";
|
||||
}
|
||||
export function typeOf(o) {
|
||||
return o === undefined ? "undefined" : (o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase());
|
||||
}
|
||||
export function toUpperCase(str) {
|
||||
return str.toUpperCase();
|
||||
}
|
||||
export function toArray(obj) {
|
||||
return obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];
|
||||
}
|
||||
export function assign(target, source) {
|
||||
const obj = target;
|
||||
if (source) {
|
||||
for (const key in source) {
|
||||
obj[key] = source[key];
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
//# sourceMappingURL=util.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export * from '@vitest/spy';
|
||||
@@ -0,0 +1,168 @@
|
||||
import { expect, test } from "vitest";
|
||||
import * as z from "zod/v4";
|
||||
|
||||
test("nested refinements", () => {
|
||||
const zodSchema = z
|
||||
.object({
|
||||
password: z.string().min(1),
|
||||
nested: z
|
||||
.object({
|
||||
confirm: z
|
||||
.string()
|
||||
.min(1)
|
||||
.refine((value) => value.length > 2, {
|
||||
message: "Confirm length should be > 2",
|
||||
}),
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
return data.confirm === "bar";
|
||||
},
|
||||
{
|
||||
path: ["confirm"],
|
||||
error: 'Value must be "bar"',
|
||||
}
|
||||
),
|
||||
})
|
||||
.refine(
|
||||
(data) => {
|
||||
return data.nested.confirm === data.password;
|
||||
},
|
||||
{
|
||||
path: ["nested", "confirm"],
|
||||
error: "Password and confirm must match",
|
||||
}
|
||||
);
|
||||
|
||||
const DATA = {
|
||||
password: "bar",
|
||||
nested: { confirm: "" },
|
||||
};
|
||||
expect(zodSchema.safeParse(DATA)).toMatchInlineSnapshot(`
|
||||
{
|
||||
"error": [ZodError: [
|
||||
{
|
||||
"origin": "string",
|
||||
"code": "too_small",
|
||||
"minimum": 1,
|
||||
"inclusive": true,
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Too small: expected string to have >=1 characters"
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Confirm length should be > 2"
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Value must be \\"bar\\""
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Password and confirm must match"
|
||||
}
|
||||
]],
|
||||
"success": false,
|
||||
}
|
||||
`);
|
||||
|
||||
expect(zodSchema.safeParse(DATA, { jitless: true })).toMatchInlineSnapshot(`
|
||||
{
|
||||
"error": [ZodError: [
|
||||
{
|
||||
"origin": "string",
|
||||
"code": "too_small",
|
||||
"minimum": 1,
|
||||
"inclusive": true,
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Too small: expected string to have >=1 characters"
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Confirm length should be > 2"
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Value must be \\"bar\\""
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm"
|
||||
],
|
||||
"message": "Password and confirm must match"
|
||||
}
|
||||
]],
|
||||
"success": false,
|
||||
}
|
||||
`);
|
||||
|
||||
expect(zodSchema["~standard"].validate(DATA)).toMatchInlineSnapshot(`
|
||||
{
|
||||
"issues": [
|
||||
{
|
||||
"code": "too_small",
|
||||
"inclusive": true,
|
||||
"message": "Too small: expected string to have >=1 characters",
|
||||
"minimum": 1,
|
||||
"origin": "string",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"message": "Confirm length should be > 2",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"message": "Value must be "bar"",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
"code": "custom",
|
||||
"message": "Password and confirm must match",
|
||||
"path": [
|
||||
"nested",
|
||||
"confirm",
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
`);
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @fileoverview APIs that are not officially supported by ESLint.
|
||||
* These APIs may change or be removed at any time. Use at your
|
||||
* own risk.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const { shouldUseFlatConfig } = require("./eslint/eslint");
|
||||
const builtinRules = require("./rules");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
module.exports = { builtinRules, shouldUseFlatConfig };
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
import { T as VERSION } from "./shared/bindingify-input-options-C-Zsy1EG.mjs";
|
||||
import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
|
||||
import { t as loadConfig } from "./shared/load-config-63nAW5KO.mjs";
|
||||
export { VERSION, defineConfig, loadConfig };
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "../../cjs/_tagged_template_literal_loose.cjs",
|
||||
"module": "../../esm/_tagged_template_literal_loose.js"
|
||||
}
|
||||
Reference in New Issue
Block a user