Add loan-advisor-chatgpt-app (part 10)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- loan-advisor-chatgpt-app/node_modules/source-map-js/LICENSE +28 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/README.md +765 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/binary-search.js +111 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/mapping-list.js +79 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/quick-sort.js +132 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-node.d.ts +1 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-node.js +413 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/lib/util.js +594 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/package.json +71 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/source-map.d.ts +104 -0
- loan-advisor-chatgpt-app/node_modules/source-map-js/source-map.js +8 -0
- loan-advisor-chatgpt-app/node_modules/space-separated-tokens/index.d.ts +18 -0
- loan-advisor-chatgpt-app/node_modules/space-separated-tokens/index.js +24 -0
- loan-advisor-chatgpt-app/node_modules/space-separated-tokens/license +22 -0
- loan-advisor-chatgpt-app/node_modules/space-separated-tokens/package.json +67 -0
- loan-advisor-chatgpt-app/node_modules/space-separated-tokens/readme.md +156 -0
- loan-advisor-chatgpt-app/node_modules/statuses/HISTORY.md +87 -0
- loan-advisor-chatgpt-app/node_modules/statuses/LICENSE +23 -0
- loan-advisor-chatgpt-app/node_modules/statuses/README.md +139 -0
- loan-advisor-chatgpt-app/node_modules/statuses/codes.json +65 -0
- loan-advisor-chatgpt-app/node_modules/statuses/index.js +146 -0
- loan-advisor-chatgpt-app/node_modules/statuses/package.json +49 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/index.d.ts +3 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/index.js +6 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/constant/dangerous.d.ts +7 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/constant/dangerous.js +16 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/core.d.ts +26 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/core.js +117 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/index.d.ts +24 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/index.js +36 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-basic.d.ts +7 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-basic.js +9 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-smart.d.ts +32 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-smart.js +69 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-decimal.d.ts +9 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-decimal.js +16 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-hexadecimal.d.ts +9 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-hexadecimal.js +16 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-named.d.ts +10 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-named.js +57 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/license +22 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/package.json +86 -0
- loan-advisor-chatgpt-app/node_modules/stringify-entities/readme.md +233 -0
- loan-advisor-chatgpt-app/node_modules/style-to-js/LICENSE +22 -0
- loan-advisor-chatgpt-app/node_modules/style-to-js/README.md +271 -0
- loan-advisor-chatgpt-app/node_modules/style-to-js/cjs/index.d.ts +14 -0
loan-advisor-chatgpt-app/node_modules/source-map-js/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
| 3 |
+
All rights reserved.
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright notice, this
|
| 9 |
+
list of conditions and the following disclaimer.
|
| 10 |
+
|
| 11 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 12 |
+
this list of conditions and the following disclaimer in the documentation
|
| 13 |
+
and/or other materials provided with the distribution.
|
| 14 |
+
|
| 15 |
+
* Neither the names of the Mozilla Foundation nor the names of project
|
| 16 |
+
contributors may be used to endorse or promote products derived from this
|
| 17 |
+
software without specific prior written permission.
|
| 18 |
+
|
| 19 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 20 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 21 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 22 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 23 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 24 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 25 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 26 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 27 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
loan-advisor-chatgpt-app/node_modules/source-map-js/README.md
ADDED
|
@@ -0,0 +1,765 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Source Map JS
|
| 2 |
+
|
| 3 |
+
[](https://www.npmjs.com/package/source-map-js)
|
| 4 |
+
|
| 5 |
+
Difference between original [source-map](https://github.com/mozilla/source-map):
|
| 6 |
+
|
| 7 |
+
> TL,DR: it's fork of original source-map@0.6, but with perfomance optimizations.
|
| 8 |
+
|
| 9 |
+
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.
|
| 10 |
+
|
| 11 |
+
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.
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
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.
|
| 16 |
+
|
| 17 |
+
[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.
|
| 18 |
+
|
| 19 |
+
I decided to fork the original source-map and port these optimizations from the article and several others PR from the original source-map.
|
| 20 |
+
|
| 21 |
+
---------
|
| 22 |
+
|
| 23 |
+
This is a library to generate and consume the source map format
|
| 24 |
+
[described here][format].
|
| 25 |
+
|
| 26 |
+
[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
| 27 |
+
|
| 28 |
+
## Use with Node
|
| 29 |
+
|
| 30 |
+
$ npm install source-map-js
|
| 31 |
+
|
| 32 |
+
<!-- ## Use on the Web
|
| 33 |
+
|
| 34 |
+
<script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script> -->
|
| 35 |
+
|
| 36 |
+
--------------------------------------------------------------------------------
|
| 37 |
+
|
| 38 |
+
<!-- `npm run toc` to regenerate the Table of Contents -->
|
| 39 |
+
|
| 40 |
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
| 41 |
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
| 42 |
+
## Table of Contents
|
| 43 |
+
|
| 44 |
+
- [Examples](#examples)
|
| 45 |
+
- [Consuming a source map](#consuming-a-source-map)
|
| 46 |
+
- [Generating a source map](#generating-a-source-map)
|
| 47 |
+
- [With SourceNode (high level API)](#with-sourcenode-high-level-api)
|
| 48 |
+
- [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
|
| 49 |
+
- [API](#api)
|
| 50 |
+
- [SourceMapConsumer](#sourcemapconsumer)
|
| 51 |
+
- [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
|
| 52 |
+
- [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
|
| 53 |
+
- [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
|
| 54 |
+
- [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
|
| 55 |
+
- [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
|
| 56 |
+
- [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
|
| 57 |
+
- [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
|
| 58 |
+
- [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
|
| 59 |
+
- [SourceMapGenerator](#sourcemapgenerator)
|
| 60 |
+
- [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
|
| 61 |
+
- [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
|
| 62 |
+
- [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
|
| 63 |
+
- [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
|
| 64 |
+
- [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
|
| 65 |
+
- [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
|
| 66 |
+
- [SourceNode](#sourcenode)
|
| 67 |
+
- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
|
| 68 |
+
- [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
|
| 69 |
+
- [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
|
| 70 |
+
- [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
|
| 71 |
+
- [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
|
| 72 |
+
- [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
|
| 73 |
+
- [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
|
| 74 |
+
- [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
|
| 75 |
+
- [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
|
| 76 |
+
- [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
|
| 77 |
+
- [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
|
| 78 |
+
|
| 79 |
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
| 80 |
+
|
| 81 |
+
## Examples
|
| 82 |
+
|
| 83 |
+
### Consuming a source map
|
| 84 |
+
|
| 85 |
+
```js
|
| 86 |
+
var rawSourceMap = {
|
| 87 |
+
version: 3,
|
| 88 |
+
file: 'min.js',
|
| 89 |
+
names: ['bar', 'baz', 'n'],
|
| 90 |
+
sources: ['one.js', 'two.js'],
|
| 91 |
+
sourceRoot: 'http://example.com/www/js/',
|
| 92 |
+
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
|
| 93 |
+
};
|
| 94 |
+
|
| 95 |
+
var smc = new SourceMapConsumer(rawSourceMap);
|
| 96 |
+
|
| 97 |
+
console.log(smc.sources);
|
| 98 |
+
// [ 'http://example.com/www/js/one.js',
|
| 99 |
+
// 'http://example.com/www/js/two.js' ]
|
| 100 |
+
|
| 101 |
+
console.log(smc.originalPositionFor({
|
| 102 |
+
line: 2,
|
| 103 |
+
column: 28
|
| 104 |
+
}));
|
| 105 |
+
// { source: 'http://example.com/www/js/two.js',
|
| 106 |
+
// line: 2,
|
| 107 |
+
// column: 10,
|
| 108 |
+
// name: 'n' }
|
| 109 |
+
|
| 110 |
+
console.log(smc.generatedPositionFor({
|
| 111 |
+
source: 'http://example.com/www/js/two.js',
|
| 112 |
+
line: 2,
|
| 113 |
+
column: 10
|
| 114 |
+
}));
|
| 115 |
+
// { line: 2, column: 28 }
|
| 116 |
+
|
| 117 |
+
smc.eachMapping(function (m) {
|
| 118 |
+
// ...
|
| 119 |
+
});
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### Generating a source map
|
| 123 |
+
|
| 124 |
+
In depth guide:
|
| 125 |
+
[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
|
| 126 |
+
|
| 127 |
+
#### With SourceNode (high level API)
|
| 128 |
+
|
| 129 |
+
```js
|
| 130 |
+
function compile(ast) {
|
| 131 |
+
switch (ast.type) {
|
| 132 |
+
case 'BinaryExpression':
|
| 133 |
+
return new SourceNode(
|
| 134 |
+
ast.location.line,
|
| 135 |
+
ast.location.column,
|
| 136 |
+
ast.location.source,
|
| 137 |
+
[compile(ast.left), " + ", compile(ast.right)]
|
| 138 |
+
);
|
| 139 |
+
case 'Literal':
|
| 140 |
+
return new SourceNode(
|
| 141 |
+
ast.location.line,
|
| 142 |
+
ast.location.column,
|
| 143 |
+
ast.location.source,
|
| 144 |
+
String(ast.value)
|
| 145 |
+
);
|
| 146 |
+
// ...
|
| 147 |
+
default:
|
| 148 |
+
throw new Error("Bad AST");
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
var ast = parse("40 + 2", "add.js");
|
| 153 |
+
console.log(compile(ast).toStringWithSourceMap({
|
| 154 |
+
file: 'add.js'
|
| 155 |
+
}));
|
| 156 |
+
// { code: '40 + 2',
|
| 157 |
+
// map: [object SourceMapGenerator] }
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
#### With SourceMapGenerator (low level API)
|
| 161 |
+
|
| 162 |
+
```js
|
| 163 |
+
var map = new SourceMapGenerator({
|
| 164 |
+
file: "source-mapped.js"
|
| 165 |
+
});
|
| 166 |
+
|
| 167 |
+
map.addMapping({
|
| 168 |
+
generated: {
|
| 169 |
+
line: 10,
|
| 170 |
+
column: 35
|
| 171 |
+
},
|
| 172 |
+
source: "foo.js",
|
| 173 |
+
original: {
|
| 174 |
+
line: 33,
|
| 175 |
+
column: 2
|
| 176 |
+
},
|
| 177 |
+
name: "christopher"
|
| 178 |
+
});
|
| 179 |
+
|
| 180 |
+
console.log(map.toString());
|
| 181 |
+
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
## API
|
| 185 |
+
|
| 186 |
+
Get a reference to the module:
|
| 187 |
+
|
| 188 |
+
```js
|
| 189 |
+
// Node.js
|
| 190 |
+
var sourceMap = require('source-map');
|
| 191 |
+
|
| 192 |
+
// Browser builds
|
| 193 |
+
var sourceMap = window.sourceMap;
|
| 194 |
+
|
| 195 |
+
// Inside Firefox
|
| 196 |
+
const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
### SourceMapConsumer
|
| 200 |
+
|
| 201 |
+
A SourceMapConsumer instance represents a parsed source map which we can query
|
| 202 |
+
for information about the original file positions by giving it a file position
|
| 203 |
+
in the generated source.
|
| 204 |
+
|
| 205 |
+
#### new SourceMapConsumer(rawSourceMap)
|
| 206 |
+
|
| 207 |
+
The only parameter is the raw source map (either as a string which can be
|
| 208 |
+
`JSON.parse`'d, or an object). According to the spec, source maps have the
|
| 209 |
+
following attributes:
|
| 210 |
+
|
| 211 |
+
* `version`: Which version of the source map spec this map is following.
|
| 212 |
+
|
| 213 |
+
* `sources`: An array of URLs to the original source files.
|
| 214 |
+
|
| 215 |
+
* `names`: An array of identifiers which can be referenced by individual
|
| 216 |
+
mappings.
|
| 217 |
+
|
| 218 |
+
* `sourceRoot`: Optional. The URL root from which all sources are relative.
|
| 219 |
+
|
| 220 |
+
* `sourcesContent`: Optional. An array of contents of the original source files.
|
| 221 |
+
|
| 222 |
+
* `mappings`: A string of base64 VLQs which contain the actual mappings.
|
| 223 |
+
|
| 224 |
+
* `file`: Optional. The generated filename this source map is associated with.
|
| 225 |
+
|
| 226 |
+
```js
|
| 227 |
+
var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
#### SourceMapConsumer.prototype.computeColumnSpans()
|
| 231 |
+
|
| 232 |
+
Compute the last column for each generated mapping. The last column is
|
| 233 |
+
inclusive.
|
| 234 |
+
|
| 235 |
+
```js
|
| 236 |
+
// Before:
|
| 237 |
+
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
| 238 |
+
// [ { line: 2,
|
| 239 |
+
// column: 1 },
|
| 240 |
+
// { line: 2,
|
| 241 |
+
// column: 10 },
|
| 242 |
+
// { line: 2,
|
| 243 |
+
// column: 20 } ]
|
| 244 |
+
|
| 245 |
+
consumer.computeColumnSpans();
|
| 246 |
+
|
| 247 |
+
// After:
|
| 248 |
+
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
| 249 |
+
// [ { line: 2,
|
| 250 |
+
// column: 1,
|
| 251 |
+
// lastColumn: 9 },
|
| 252 |
+
// { line: 2,
|
| 253 |
+
// column: 10,
|
| 254 |
+
// lastColumn: 19 },
|
| 255 |
+
// { line: 2,
|
| 256 |
+
// column: 20,
|
| 257 |
+
// lastColumn: Infinity } ]
|
| 258 |
+
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
|
| 262 |
+
|
| 263 |
+
Returns the original source, line, and column information for the generated
|
| 264 |
+
source's line and column positions provided. The only argument is an object with
|
| 265 |
+
the following properties:
|
| 266 |
+
|
| 267 |
+
* `line`: The line number in the generated source. Line numbers in
|
| 268 |
+
this library are 1-based (note that the underlying source map
|
| 269 |
+
specification uses 0-based line numbers -- this library handles the
|
| 270 |
+
translation).
|
| 271 |
+
|
| 272 |
+
* `column`: The column number in the generated source. Column numbers
|
| 273 |
+
in this library are 0-based.
|
| 274 |
+
|
| 275 |
+
* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
|
| 276 |
+
`SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
|
| 277 |
+
element that is smaller than or greater than the one we are searching for,
|
| 278 |
+
respectively, if the exact element cannot be found. Defaults to
|
| 279 |
+
`SourceMapConsumer.GREATEST_LOWER_BOUND`.
|
| 280 |
+
|
| 281 |
+
and an object is returned with the following properties:
|
| 282 |
+
|
| 283 |
+
* `source`: The original source file, or null if this information is not
|
| 284 |
+
available.
|
| 285 |
+
|
| 286 |
+
* `line`: The line number in the original source, or null if this information is
|
| 287 |
+
not available. The line number is 1-based.
|
| 288 |
+
|
| 289 |
+
* `column`: The column number in the original source, or null if this
|
| 290 |
+
information is not available. The column number is 0-based.
|
| 291 |
+
|
| 292 |
+
* `name`: The original identifier, or null if this information is not available.
|
| 293 |
+
|
| 294 |
+
```js
|
| 295 |
+
consumer.originalPositionFor({ line: 2, column: 10 })
|
| 296 |
+
// { source: 'foo.coffee',
|
| 297 |
+
// line: 2,
|
| 298 |
+
// column: 2,
|
| 299 |
+
// name: null }
|
| 300 |
+
|
| 301 |
+
consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
|
| 302 |
+
// { source: null,
|
| 303 |
+
// line: null,
|
| 304 |
+
// column: null,
|
| 305 |
+
// name: null }
|
| 306 |
+
```
|
| 307 |
+
|
| 308 |
+
#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
|
| 309 |
+
|
| 310 |
+
Returns the generated line and column information for the original source,
|
| 311 |
+
line, and column positions provided. The only argument is an object with
|
| 312 |
+
the following properties:
|
| 313 |
+
|
| 314 |
+
* `source`: The filename of the original source.
|
| 315 |
+
|
| 316 |
+
* `line`: The line number in the original source. The line number is
|
| 317 |
+
1-based.
|
| 318 |
+
|
| 319 |
+
* `column`: The column number in the original source. The column
|
| 320 |
+
number is 0-based.
|
| 321 |
+
|
| 322 |
+
and an object is returned with the following properties:
|
| 323 |
+
|
| 324 |
+
* `line`: The line number in the generated source, or null. The line
|
| 325 |
+
number is 1-based.
|
| 326 |
+
|
| 327 |
+
* `column`: The column number in the generated source, or null. The
|
| 328 |
+
column number is 0-based.
|
| 329 |
+
|
| 330 |
+
```js
|
| 331 |
+
consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
|
| 332 |
+
// { line: 1,
|
| 333 |
+
// column: 56 }
|
| 334 |
+
```
|
| 335 |
+
|
| 336 |
+
#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
|
| 337 |
+
|
| 338 |
+
Returns all generated line and column information for the original source, line,
|
| 339 |
+
and column provided. If no column is provided, returns all mappings
|
| 340 |
+
corresponding to a either the line we are searching for or the next closest line
|
| 341 |
+
that has any mappings. Otherwise, returns all mappings corresponding to the
|
| 342 |
+
given line and either the column we are searching for or the next closest column
|
| 343 |
+
that has any offsets.
|
| 344 |
+
|
| 345 |
+
The only argument is an object with the following properties:
|
| 346 |
+
|
| 347 |
+
* `source`: The filename of the original source.
|
| 348 |
+
|
| 349 |
+
* `line`: The line number in the original source. The line number is
|
| 350 |
+
1-based.
|
| 351 |
+
|
| 352 |
+
* `column`: Optional. The column number in the original source. The
|
| 353 |
+
column number is 0-based.
|
| 354 |
+
|
| 355 |
+
and an array of objects is returned, each with the following properties:
|
| 356 |
+
|
| 357 |
+
* `line`: The line number in the generated source, or null. The line
|
| 358 |
+
number is 1-based.
|
| 359 |
+
|
| 360 |
+
* `column`: The column number in the generated source, or null. The
|
| 361 |
+
column number is 0-based.
|
| 362 |
+
|
| 363 |
+
```js
|
| 364 |
+
consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
|
| 365 |
+
// [ { line: 2,
|
| 366 |
+
// column: 1 },
|
| 367 |
+
// { line: 2,
|
| 368 |
+
// column: 10 },
|
| 369 |
+
// { line: 2,
|
| 370 |
+
// column: 20 } ]
|
| 371 |
+
```
|
| 372 |
+
|
| 373 |
+
#### SourceMapConsumer.prototype.hasContentsOfAllSources()
|
| 374 |
+
|
| 375 |
+
Return true if we have the embedded source content for every source listed in
|
| 376 |
+
the source map, false otherwise.
|
| 377 |
+
|
| 378 |
+
In other words, if this method returns `true`, then
|
| 379 |
+
`consumer.sourceContentFor(s)` will succeed for every source `s` in
|
| 380 |
+
`consumer.sources`.
|
| 381 |
+
|
| 382 |
+
```js
|
| 383 |
+
// ...
|
| 384 |
+
if (consumer.hasContentsOfAllSources()) {
|
| 385 |
+
consumerReadyCallback(consumer);
|
| 386 |
+
} else {
|
| 387 |
+
fetchSources(consumer, consumerReadyCallback);
|
| 388 |
+
}
|
| 389 |
+
// ...
|
| 390 |
+
```
|
| 391 |
+
|
| 392 |
+
#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
|
| 393 |
+
|
| 394 |
+
Returns the original source content for the source provided. The only
|
| 395 |
+
argument is the URL of the original source file.
|
| 396 |
+
|
| 397 |
+
If the source content for the given source is not found, then an error is
|
| 398 |
+
thrown. Optionally, pass `true` as the second param to have `null` returned
|
| 399 |
+
instead.
|
| 400 |
+
|
| 401 |
+
```js
|
| 402 |
+
consumer.sources
|
| 403 |
+
// [ "my-cool-lib.clj" ]
|
| 404 |
+
|
| 405 |
+
consumer.sourceContentFor("my-cool-lib.clj")
|
| 406 |
+
// "..."
|
| 407 |
+
|
| 408 |
+
consumer.sourceContentFor("this is not in the source map");
|
| 409 |
+
// Error: "this is not in the source map" is not in the source map
|
| 410 |
+
|
| 411 |
+
consumer.sourceContentFor("this is not in the source map", true);
|
| 412 |
+
// null
|
| 413 |
+
```
|
| 414 |
+
|
| 415 |
+
#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
|
| 416 |
+
|
| 417 |
+
Iterate over each mapping between an original source/line/column and a
|
| 418 |
+
generated line/column in this source map.
|
| 419 |
+
|
| 420 |
+
* `callback`: The function that is called with each mapping. Mappings have the
|
| 421 |
+
form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
|
| 422 |
+
name }`
|
| 423 |
+
|
| 424 |
+
* `context`: Optional. If specified, this object will be the value of `this`
|
| 425 |
+
every time that `callback` is called.
|
| 426 |
+
|
| 427 |
+
* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
|
| 428 |
+
`SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
|
| 429 |
+
the mappings sorted by the generated file's line/column order or the
|
| 430 |
+
original's source/line/column order, respectively. Defaults to
|
| 431 |
+
`SourceMapConsumer.GENERATED_ORDER`.
|
| 432 |
+
|
| 433 |
+
```js
|
| 434 |
+
consumer.eachMapping(function (m) { console.log(m); })
|
| 435 |
+
// ...
|
| 436 |
+
// { source: 'illmatic.js',
|
| 437 |
+
// generatedLine: 1,
|
| 438 |
+
// generatedColumn: 0,
|
| 439 |
+
// originalLine: 1,
|
| 440 |
+
// originalColumn: 0,
|
| 441 |
+
// name: null }
|
| 442 |
+
// { source: 'illmatic.js',
|
| 443 |
+
// generatedLine: 2,
|
| 444 |
+
// generatedColumn: 0,
|
| 445 |
+
// originalLine: 2,
|
| 446 |
+
// originalColumn: 0,
|
| 447 |
+
// name: null }
|
| 448 |
+
// ...
|
| 449 |
+
```
|
| 450 |
+
### SourceMapGenerator
|
| 451 |
+
|
| 452 |
+
An instance of the SourceMapGenerator represents a source map which is being
|
| 453 |
+
built incrementally.
|
| 454 |
+
|
| 455 |
+
#### new SourceMapGenerator([startOfSourceMap])
|
| 456 |
+
|
| 457 |
+
You may pass an object with the following properties:
|
| 458 |
+
|
| 459 |
+
* `file`: The filename of the generated source that this source map is
|
| 460 |
+
associated with.
|
| 461 |
+
|
| 462 |
+
* `sourceRoot`: A root for all relative URLs in this source map.
|
| 463 |
+
|
| 464 |
+
* `skipValidation`: Optional. When `true`, disables validation of mappings as
|
| 465 |
+
they are added. This can improve performance but should be used with
|
| 466 |
+
discretion, as a last resort. Even then, one should avoid using this flag when
|
| 467 |
+
running tests, if possible.
|
| 468 |
+
|
| 469 |
+
* `ignoreInvalidMapping`: Optional. When `true`, instead of throwing error on
|
| 470 |
+
invalid mapping, it will be ignored.
|
| 471 |
+
|
| 472 |
+
```js
|
| 473 |
+
var generator = new sourceMap.SourceMapGenerator({
|
| 474 |
+
file: "my-generated-javascript-file.js",
|
| 475 |
+
sourceRoot: "http://example.com/app/js/"
|
| 476 |
+
});
|
| 477 |
+
```
|
| 478 |
+
|
| 479 |
+
#### SourceMapGenerator.fromSourceMap(sourceMapConsumer, sourceMapGeneratorOptions)
|
| 480 |
+
|
| 481 |
+
Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
|
| 482 |
+
|
| 483 |
+
* `sourceMapConsumer` The SourceMap.
|
| 484 |
+
|
| 485 |
+
* `sourceMapGeneratorOptions` options that will be passed to the SourceMapGenerator constructor which used under the hood.
|
| 486 |
+
|
| 487 |
+
```js
|
| 488 |
+
var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer, {
|
| 489 |
+
ignoreInvalidMapping: true,
|
| 490 |
+
});
|
| 491 |
+
```
|
| 492 |
+
|
| 493 |
+
#### SourceMapGenerator.prototype.addMapping(mapping)
|
| 494 |
+
|
| 495 |
+
Add a single mapping from original source line and column to the generated
|
| 496 |
+
source's line and column for this source map being created. The mapping object
|
| 497 |
+
should have the following properties:
|
| 498 |
+
|
| 499 |
+
* `generated`: An object with the generated line and column positions.
|
| 500 |
+
|
| 501 |
+
* `original`: An object with the original line and column positions.
|
| 502 |
+
|
| 503 |
+
* `source`: The original source file (relative to the sourceRoot).
|
| 504 |
+
|
| 505 |
+
* `name`: An optional original token name for this mapping.
|
| 506 |
+
|
| 507 |
+
```js
|
| 508 |
+
generator.addMapping({
|
| 509 |
+
source: "module-one.scm",
|
| 510 |
+
original: { line: 128, column: 0 },
|
| 511 |
+
generated: { line: 3, column: 456 }
|
| 512 |
+
})
|
| 513 |
+
```
|
| 514 |
+
|
| 515 |
+
#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
|
| 516 |
+
|
| 517 |
+
Set the source content for an original source file.
|
| 518 |
+
|
| 519 |
+
* `sourceFile` the URL of the original source file.
|
| 520 |
+
|
| 521 |
+
* `sourceContent` the content of the source file.
|
| 522 |
+
|
| 523 |
+
```js
|
| 524 |
+
generator.setSourceContent("module-one.scm",
|
| 525 |
+
fs.readFileSync("path/to/module-one.scm"))
|
| 526 |
+
```
|
| 527 |
+
|
| 528 |
+
#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
|
| 529 |
+
|
| 530 |
+
Applies a SourceMap for a source file to the SourceMap.
|
| 531 |
+
Each mapping to the supplied source file is rewritten using the
|
| 532 |
+
supplied SourceMap. Note: The resolution for the resulting mappings
|
| 533 |
+
is the minimum of this map and the supplied map.
|
| 534 |
+
|
| 535 |
+
* `sourceMapConsumer`: The SourceMap to be applied.
|
| 536 |
+
|
| 537 |
+
* `sourceFile`: Optional. The filename of the source file.
|
| 538 |
+
If omitted, sourceMapConsumer.file will be used, if it exists.
|
| 539 |
+
Otherwise an error will be thrown.
|
| 540 |
+
|
| 541 |
+
* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
|
| 542 |
+
to be applied. If relative, it is relative to the SourceMap.
|
| 543 |
+
|
| 544 |
+
This parameter is needed when the two SourceMaps aren't in the same
|
| 545 |
+
directory, and the SourceMap to be applied contains relative source
|
| 546 |
+
paths. If so, those relative source paths need to be rewritten
|
| 547 |
+
relative to the SourceMap.
|
| 548 |
+
|
| 549 |
+
If omitted, it is assumed that both SourceMaps are in the same directory,
|
| 550 |
+
thus not needing any rewriting. (Supplying `'.'` has the same effect.)
|
| 551 |
+
|
| 552 |
+
#### SourceMapGenerator.prototype.toString()
|
| 553 |
+
|
| 554 |
+
Renders the source map being generated to a string.
|
| 555 |
+
|
| 556 |
+
```js
|
| 557 |
+
generator.toString()
|
| 558 |
+
// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
|
| 559 |
+
```
|
| 560 |
+
|
| 561 |
+
### SourceNode
|
| 562 |
+
|
| 563 |
+
SourceNodes provide a way to abstract over interpolating and/or concatenating
|
| 564 |
+
snippets of generated JavaScript source code, while maintaining the line and
|
| 565 |
+
column information associated between those snippets and the original source
|
| 566 |
+
code. This is useful as the final intermediate representation a compiler might
|
| 567 |
+
use before outputting the generated JS and source map.
|
| 568 |
+
|
| 569 |
+
#### new SourceNode([line, column, source[, chunk[, name]]])
|
| 570 |
+
|
| 571 |
+
* `line`: The original line number associated with this source node, or null if
|
| 572 |
+
it isn't associated with an original line. The line number is 1-based.
|
| 573 |
+
|
| 574 |
+
* `column`: The original column number associated with this source node, or null
|
| 575 |
+
if it isn't associated with an original column. The column number
|
| 576 |
+
is 0-based.
|
| 577 |
+
|
| 578 |
+
* `source`: The original source's filename; null if no filename is provided.
|
| 579 |
+
|
| 580 |
+
* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
|
| 581 |
+
below.
|
| 582 |
+
|
| 583 |
+
* `name`: Optional. The original identifier.
|
| 584 |
+
|
| 585 |
+
```js
|
| 586 |
+
var node = new SourceNode(1, 2, "a.cpp", [
|
| 587 |
+
new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
|
| 588 |
+
new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
|
| 589 |
+
new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
|
| 590 |
+
]);
|
| 591 |
+
```
|
| 592 |
+
|
| 593 |
+
#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
|
| 594 |
+
|
| 595 |
+
Creates a SourceNode from generated code and a SourceMapConsumer.
|
| 596 |
+
|
| 597 |
+
* `code`: The generated code
|
| 598 |
+
|
| 599 |
+
* `sourceMapConsumer` The SourceMap for the generated code
|
| 600 |
+
|
| 601 |
+
* `relativePath` The optional path that relative sources in `sourceMapConsumer`
|
| 602 |
+
should be relative to.
|
| 603 |
+
|
| 604 |
+
```js
|
| 605 |
+
var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
|
| 606 |
+
var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
|
| 607 |
+
consumer);
|
| 608 |
+
```
|
| 609 |
+
|
| 610 |
+
#### SourceNode.prototype.add(chunk)
|
| 611 |
+
|
| 612 |
+
Add a chunk of generated JS to this source node.
|
| 613 |
+
|
| 614 |
+
* `chunk`: A string snippet of generated JS code, another instance of
|
| 615 |
+
`SourceNode`, or an array where each member is one of those things.
|
| 616 |
+
|
| 617 |
+
```js
|
| 618 |
+
node.add(" + ");
|
| 619 |
+
node.add(otherNode);
|
| 620 |
+
node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
|
| 621 |
+
```
|
| 622 |
+
|
| 623 |
+
#### SourceNode.prototype.prepend(chunk)
|
| 624 |
+
|
| 625 |
+
Prepend a chunk of generated JS to this source node.
|
| 626 |
+
|
| 627 |
+
* `chunk`: A string snippet of generated JS code, another instance of
|
| 628 |
+
`SourceNode`, or an array where each member is one of those things.
|
| 629 |
+
|
| 630 |
+
```js
|
| 631 |
+
node.prepend("/** Build Id: f783haef86324gf **/\n\n");
|
| 632 |
+
```
|
| 633 |
+
|
| 634 |
+
#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
|
| 635 |
+
|
| 636 |
+
Set the source content for a source file. This will be added to the
|
| 637 |
+
`SourceMap` in the `sourcesContent` field.
|
| 638 |
+
|
| 639 |
+
* `sourceFile`: The filename of the source file
|
| 640 |
+
|
| 641 |
+
* `sourceContent`: The content of the source file
|
| 642 |
+
|
| 643 |
+
```js
|
| 644 |
+
node.setSourceContent("module-one.scm",
|
| 645 |
+
fs.readFileSync("path/to/module-one.scm"))
|
| 646 |
+
```
|
| 647 |
+
|
| 648 |
+
#### SourceNode.prototype.walk(fn)
|
| 649 |
+
|
| 650 |
+
Walk over the tree of JS snippets in this node and its children. The walking
|
| 651 |
+
function is called once for each snippet of JS and is passed that snippet and
|
| 652 |
+
the its original associated source's line/column location.
|
| 653 |
+
|
| 654 |
+
* `fn`: The traversal function.
|
| 655 |
+
|
| 656 |
+
```js
|
| 657 |
+
var node = new SourceNode(1, 2, "a.js", [
|
| 658 |
+
new SourceNode(3, 4, "b.js", "uno"),
|
| 659 |
+
"dos",
|
| 660 |
+
[
|
| 661 |
+
"tres",
|
| 662 |
+
new SourceNode(5, 6, "c.js", "quatro")
|
| 663 |
+
]
|
| 664 |
+
]);
|
| 665 |
+
|
| 666 |
+
node.walk(function (code, loc) { console.log("WALK:", code, loc); })
|
| 667 |
+
// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
|
| 668 |
+
// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
|
| 669 |
+
// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
|
| 670 |
+
// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
|
| 671 |
+
```
|
| 672 |
+
|
| 673 |
+
#### SourceNode.prototype.walkSourceContents(fn)
|
| 674 |
+
|
| 675 |
+
Walk over the tree of SourceNodes. The walking function is called for each
|
| 676 |
+
source file content and is passed the filename and source content.
|
| 677 |
+
|
| 678 |
+
* `fn`: The traversal function.
|
| 679 |
+
|
| 680 |
+
```js
|
| 681 |
+
var a = new SourceNode(1, 2, "a.js", "generated from a");
|
| 682 |
+
a.setSourceContent("a.js", "original a");
|
| 683 |
+
var b = new SourceNode(1, 2, "b.js", "generated from b");
|
| 684 |
+
b.setSourceContent("b.js", "original b");
|
| 685 |
+
var c = new SourceNode(1, 2, "c.js", "generated from c");
|
| 686 |
+
c.setSourceContent("c.js", "original c");
|
| 687 |
+
|
| 688 |
+
var node = new SourceNode(null, null, null, [a, b, c]);
|
| 689 |
+
node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
|
| 690 |
+
// WALK: a.js : original a
|
| 691 |
+
// WALK: b.js : original b
|
| 692 |
+
// WALK: c.js : original c
|
| 693 |
+
```
|
| 694 |
+
|
| 695 |
+
#### SourceNode.prototype.join(sep)
|
| 696 |
+
|
| 697 |
+
Like `Array.prototype.join` except for SourceNodes. Inserts the separator
|
| 698 |
+
between each of this source node's children.
|
| 699 |
+
|
| 700 |
+
* `sep`: The separator.
|
| 701 |
+
|
| 702 |
+
```js
|
| 703 |
+
var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
|
| 704 |
+
var operand = new SourceNode(3, 4, "a.rs", "=");
|
| 705 |
+
var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
|
| 706 |
+
|
| 707 |
+
var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
|
| 708 |
+
var joinedNode = node.join(" ");
|
| 709 |
+
```
|
| 710 |
+
|
| 711 |
+
#### SourceNode.prototype.replaceRight(pattern, replacement)
|
| 712 |
+
|
| 713 |
+
Call `String.prototype.replace` on the very right-most source snippet. Useful
|
| 714 |
+
for trimming white space from the end of a source node, etc.
|
| 715 |
+
|
| 716 |
+
* `pattern`: The pattern to replace.
|
| 717 |
+
|
| 718 |
+
* `replacement`: The thing to replace the pattern with.
|
| 719 |
+
|
| 720 |
+
```js
|
| 721 |
+
// Trim trailing white space.
|
| 722 |
+
node.replaceRight(/\s*$/, "");
|
| 723 |
+
```
|
| 724 |
+
|
| 725 |
+
#### SourceNode.prototype.toString()
|
| 726 |
+
|
| 727 |
+
Return the string representation of this source node. Walks over the tree and
|
| 728 |
+
concatenates all the various snippets together to one string.
|
| 729 |
+
|
| 730 |
+
```js
|
| 731 |
+
var node = new SourceNode(1, 2, "a.js", [
|
| 732 |
+
new SourceNode(3, 4, "b.js", "uno"),
|
| 733 |
+
"dos",
|
| 734 |
+
[
|
| 735 |
+
"tres",
|
| 736 |
+
new SourceNode(5, 6, "c.js", "quatro")
|
| 737 |
+
]
|
| 738 |
+
]);
|
| 739 |
+
|
| 740 |
+
node.toString()
|
| 741 |
+
// 'unodostresquatro'
|
| 742 |
+
```
|
| 743 |
+
|
| 744 |
+
#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
|
| 745 |
+
|
| 746 |
+
Returns the string representation of this tree of source nodes, plus a
|
| 747 |
+
SourceMapGenerator which contains all the mappings between the generated and
|
| 748 |
+
original sources.
|
| 749 |
+
|
| 750 |
+
The arguments are the same as those to `new SourceMapGenerator`.
|
| 751 |
+
|
| 752 |
+
```js
|
| 753 |
+
var node = new SourceNode(1, 2, "a.js", [
|
| 754 |
+
new SourceNode(3, 4, "b.js", "uno"),
|
| 755 |
+
"dos",
|
| 756 |
+
[
|
| 757 |
+
"tres",
|
| 758 |
+
new SourceNode(5, 6, "c.js", "quatro")
|
| 759 |
+
]
|
| 760 |
+
]);
|
| 761 |
+
|
| 762 |
+
node.toStringWithSourceMap({ file: "my-output-file.js" })
|
| 763 |
+
// { code: 'unodostresquatro',
|
| 764 |
+
// map: [object SourceMapGenerator] }
|
| 765 |
+
```
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/binary-search.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
| 2 |
+
/*
|
| 3 |
+
* Copyright 2011 Mozilla Foundation and contributors
|
| 4 |
+
* Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
exports.GREATEST_LOWER_BOUND = 1;
|
| 9 |
+
exports.LEAST_UPPER_BOUND = 2;
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Recursive implementation of binary search.
|
| 13 |
+
*
|
| 14 |
+
* @param aLow Indices here and lower do not contain the needle.
|
| 15 |
+
* @param aHigh Indices here and higher do not contain the needle.
|
| 16 |
+
* @param aNeedle The element being searched for.
|
| 17 |
+
* @param aHaystack The non-empty array being searched.
|
| 18 |
+
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
|
| 19 |
+
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
| 20 |
+
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
| 21 |
+
* closest element that is smaller than or greater than the one we are
|
| 22 |
+
* searching for, respectively, if the exact element cannot be found.
|
| 23 |
+
*/
|
| 24 |
+
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
| 25 |
+
// This function terminates when one of the following is true:
|
| 26 |
+
//
|
| 27 |
+
// 1. We find the exact element we are looking for.
|
| 28 |
+
//
|
| 29 |
+
// 2. We did not find the exact element, but we can return the index of
|
| 30 |
+
// the next-closest element.
|
| 31 |
+
//
|
| 32 |
+
// 3. We did not find the exact element, and there is no next-closest
|
| 33 |
+
// element than the one we are searching for, so we return -1.
|
| 34 |
+
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
| 35 |
+
var cmp = aCompare(aNeedle, aHaystack[mid], true);
|
| 36 |
+
if (cmp === 0) {
|
| 37 |
+
// Found the element we are looking for.
|
| 38 |
+
return mid;
|
| 39 |
+
}
|
| 40 |
+
else if (cmp > 0) {
|
| 41 |
+
// Our needle is greater than aHaystack[mid].
|
| 42 |
+
if (aHigh - mid > 1) {
|
| 43 |
+
// The element is in the upper half.
|
| 44 |
+
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// The exact needle element was not found in this haystack. Determine if
|
| 48 |
+
// we are in termination case (3) or (2) and return the appropriate thing.
|
| 49 |
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
| 50 |
+
return aHigh < aHaystack.length ? aHigh : -1;
|
| 51 |
+
} else {
|
| 52 |
+
return mid;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
else {
|
| 56 |
+
// Our needle is less than aHaystack[mid].
|
| 57 |
+
if (mid - aLow > 1) {
|
| 58 |
+
// The element is in the lower half.
|
| 59 |
+
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
// we are in termination case (3) or (2) and return the appropriate thing.
|
| 63 |
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
| 64 |
+
return mid;
|
| 65 |
+
} else {
|
| 66 |
+
return aLow < 0 ? -1 : aLow;
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* This is an implementation of binary search which will always try and return
|
| 73 |
+
* the index of the closest element if there is no exact hit. This is because
|
| 74 |
+
* mappings between original and generated line/col pairs are single points,
|
| 75 |
+
* and there is an implicit region between each of them, so a miss just means
|
| 76 |
+
* that you aren't on the very start of a region.
|
| 77 |
+
*
|
| 78 |
+
* @param aNeedle The element you are looking for.
|
| 79 |
+
* @param aHaystack The array that is being searched.
|
| 80 |
+
* @param aCompare A function which takes the needle and an element in the
|
| 81 |
+
* array and returns -1, 0, or 1 depending on whether the needle is less
|
| 82 |
+
* than, equal to, or greater than the element, respectively.
|
| 83 |
+
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
| 84 |
+
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
| 85 |
+
* closest element that is smaller than or greater than the one we are
|
| 86 |
+
* searching for, respectively, if the exact element cannot be found.
|
| 87 |
+
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
|
| 88 |
+
*/
|
| 89 |
+
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
| 90 |
+
if (aHaystack.length === 0) {
|
| 91 |
+
return -1;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
|
| 95 |
+
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
|
| 96 |
+
if (index < 0) {
|
| 97 |
+
return -1;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// We have found either the exact element, or the next-closest element than
|
| 101 |
+
// the one we are searching for. However, there may be more than one such
|
| 102 |
+
// element. Make sure we always return the smallest of these.
|
| 103 |
+
while (index - 1 >= 0) {
|
| 104 |
+
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
| 105 |
+
break;
|
| 106 |
+
}
|
| 107 |
+
--index;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
return index;
|
| 111 |
+
};
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/mapping-list.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
| 2 |
+
/*
|
| 3 |
+
* Copyright 2014 Mozilla Foundation and contributors
|
| 4 |
+
* Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
var util = require('./util');
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Determine whether mappingB is after mappingA with respect to generated
|
| 12 |
+
* position.
|
| 13 |
+
*/
|
| 14 |
+
function generatedPositionAfter(mappingA, mappingB) {
|
| 15 |
+
// Optimized for most common case
|
| 16 |
+
var lineA = mappingA.generatedLine;
|
| 17 |
+
var lineB = mappingB.generatedLine;
|
| 18 |
+
var columnA = mappingA.generatedColumn;
|
| 19 |
+
var columnB = mappingB.generatedColumn;
|
| 20 |
+
return lineB > lineA || lineB == lineA && columnB >= columnA ||
|
| 21 |
+
util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* A data structure to provide a sorted view of accumulated mappings in a
|
| 26 |
+
* performance conscious manner. It trades a neglibable overhead in general
|
| 27 |
+
* case for a large speedup in case of mappings being added in order.
|
| 28 |
+
*/
|
| 29 |
+
function MappingList() {
|
| 30 |
+
this._array = [];
|
| 31 |
+
this._sorted = true;
|
| 32 |
+
// Serves as infimum
|
| 33 |
+
this._last = {generatedLine: -1, generatedColumn: 0};
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Iterate through internal items. This method takes the same arguments that
|
| 38 |
+
* `Array.prototype.forEach` takes.
|
| 39 |
+
*
|
| 40 |
+
* NOTE: The order of the mappings is NOT guaranteed.
|
| 41 |
+
*/
|
| 42 |
+
MappingList.prototype.unsortedForEach =
|
| 43 |
+
function MappingList_forEach(aCallback, aThisArg) {
|
| 44 |
+
this._array.forEach(aCallback, aThisArg);
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Add the given source mapping.
|
| 49 |
+
*
|
| 50 |
+
* @param Object aMapping
|
| 51 |
+
*/
|
| 52 |
+
MappingList.prototype.add = function MappingList_add(aMapping) {
|
| 53 |
+
if (generatedPositionAfter(this._last, aMapping)) {
|
| 54 |
+
this._last = aMapping;
|
| 55 |
+
this._array.push(aMapping);
|
| 56 |
+
} else {
|
| 57 |
+
this._sorted = false;
|
| 58 |
+
this._array.push(aMapping);
|
| 59 |
+
}
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Returns the flat, sorted array of mappings. The mappings are sorted by
|
| 64 |
+
* generated position.
|
| 65 |
+
*
|
| 66 |
+
* WARNING: This method returns internal data without copying, for
|
| 67 |
+
* performance. The return value must NOT be mutated, and should be treated as
|
| 68 |
+
* an immutable borrow. If you want to take ownership, you must make your own
|
| 69 |
+
* copy.
|
| 70 |
+
*/
|
| 71 |
+
MappingList.prototype.toArray = function MappingList_toArray() {
|
| 72 |
+
if (!this._sorted) {
|
| 73 |
+
this._array.sort(util.compareByGeneratedPositionsInflated);
|
| 74 |
+
this._sorted = true;
|
| 75 |
+
}
|
| 76 |
+
return this._array;
|
| 77 |
+
};
|
| 78 |
+
|
| 79 |
+
exports.MappingList = MappingList;
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/quick-sort.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
| 2 |
+
/*
|
| 3 |
+
* Copyright 2011 Mozilla Foundation and contributors
|
| 4 |
+
* Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
// It turns out that some (most?) JavaScript engines don't self-host
|
| 9 |
+
// `Array.prototype.sort`. This makes sense because C++ will likely remain
|
| 10 |
+
// faster than JS when doing raw CPU-intensive sorting. However, when using a
|
| 11 |
+
// custom comparator function, calling back and forth between the VM's C++ and
|
| 12 |
+
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
|
| 13 |
+
// worse generated code for the comparator function than would be optimal. In
|
| 14 |
+
// fact, when sorting with a comparator, these costs outweigh the benefits of
|
| 15 |
+
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
|
| 16 |
+
// a ~3500ms mean speed-up in `bench/bench.html`.
|
| 17 |
+
|
| 18 |
+
function SortTemplate(comparator) {
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Swap the elements indexed by `x` and `y` in the array `ary`.
|
| 22 |
+
*
|
| 23 |
+
* @param {Array} ary
|
| 24 |
+
* The array.
|
| 25 |
+
* @param {Number} x
|
| 26 |
+
* The index of the first item.
|
| 27 |
+
* @param {Number} y
|
| 28 |
+
* The index of the second item.
|
| 29 |
+
*/
|
| 30 |
+
function swap(ary, x, y) {
|
| 31 |
+
var temp = ary[x];
|
| 32 |
+
ary[x] = ary[y];
|
| 33 |
+
ary[y] = temp;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Returns a random integer within the range `low .. high` inclusive.
|
| 38 |
+
*
|
| 39 |
+
* @param {Number} low
|
| 40 |
+
* The lower bound on the range.
|
| 41 |
+
* @param {Number} high
|
| 42 |
+
* The upper bound on the range.
|
| 43 |
+
*/
|
| 44 |
+
function randomIntInRange(low, high) {
|
| 45 |
+
return Math.round(low + (Math.random() * (high - low)));
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* The Quick Sort algorithm.
|
| 50 |
+
*
|
| 51 |
+
* @param {Array} ary
|
| 52 |
+
* An array to sort.
|
| 53 |
+
* @param {function} comparator
|
| 54 |
+
* Function to use to compare two items.
|
| 55 |
+
* @param {Number} p
|
| 56 |
+
* Start index of the array
|
| 57 |
+
* @param {Number} r
|
| 58 |
+
* End index of the array
|
| 59 |
+
*/
|
| 60 |
+
function doQuickSort(ary, comparator, p, r) {
|
| 61 |
+
// If our lower bound is less than our upper bound, we (1) partition the
|
| 62 |
+
// array into two pieces and (2) recurse on each half. If it is not, this is
|
| 63 |
+
// the empty array and our base case.
|
| 64 |
+
|
| 65 |
+
if (p < r) {
|
| 66 |
+
// (1) Partitioning.
|
| 67 |
+
//
|
| 68 |
+
// The partitioning chooses a pivot between `p` and `r` and moves all
|
| 69 |
+
// elements that are less than or equal to the pivot to the before it, and
|
| 70 |
+
// all the elements that are greater than it after it. The effect is that
|
| 71 |
+
// once partition is done, the pivot is in the exact place it will be when
|
| 72 |
+
// the array is put in sorted order, and it will not need to be moved
|
| 73 |
+
// again. This runs in O(n) time.
|
| 74 |
+
|
| 75 |
+
// Always choose a random pivot so that an input array which is reverse
|
| 76 |
+
// sorted does not cause O(n^2) running time.
|
| 77 |
+
var pivotIndex = randomIntInRange(p, r);
|
| 78 |
+
var i = p - 1;
|
| 79 |
+
|
| 80 |
+
swap(ary, pivotIndex, r);
|
| 81 |
+
var pivot = ary[r];
|
| 82 |
+
|
| 83 |
+
// Immediately after `j` is incremented in this loop, the following hold
|
| 84 |
+
// true:
|
| 85 |
+
//
|
| 86 |
+
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
|
| 87 |
+
//
|
| 88 |
+
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
|
| 89 |
+
for (var j = p; j < r; j++) {
|
| 90 |
+
if (comparator(ary[j], pivot, false) <= 0) {
|
| 91 |
+
i += 1;
|
| 92 |
+
swap(ary, i, j);
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
swap(ary, i + 1, j);
|
| 97 |
+
var q = i + 1;
|
| 98 |
+
|
| 99 |
+
// (2) Recurse on each half.
|
| 100 |
+
|
| 101 |
+
doQuickSort(ary, comparator, p, q - 1);
|
| 102 |
+
doQuickSort(ary, comparator, q + 1, r);
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
return doQuickSort;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
function cloneSort(comparator) {
|
| 110 |
+
let template = SortTemplate.toString();
|
| 111 |
+
let templateFn = new Function(`return ${template}`)();
|
| 112 |
+
return templateFn(comparator);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Sort the given array in-place with the given comparator function.
|
| 117 |
+
*
|
| 118 |
+
* @param {Array} ary
|
| 119 |
+
* An array to sort.
|
| 120 |
+
* @param {function} comparator
|
| 121 |
+
* Function to use to compare two items.
|
| 122 |
+
*/
|
| 123 |
+
|
| 124 |
+
let sortCache = new WeakMap();
|
| 125 |
+
exports.quickSort = function (ary, comparator, start = 0) {
|
| 126 |
+
let doQuickSort = sortCache.get(comparator);
|
| 127 |
+
if (doQuickSort === void 0) {
|
| 128 |
+
doQuickSort = cloneSort(comparator);
|
| 129 |
+
sortCache.set(comparator, doQuickSort);
|
| 130 |
+
}
|
| 131 |
+
doQuickSort(ary, comparator, start, ary.length - 1);
|
| 132 |
+
};
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-consumer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export { SourceMapConsumer } from '..';
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-consumer.js
ADDED
|
@@ -0,0 +1,1188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
| 2 |
+
/*
|
| 3 |
+
* Copyright 2011 Mozilla Foundation and contributors
|
| 4 |
+
* Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
var util = require('./util');
|
| 9 |
+
var binarySearch = require('./binary-search');
|
| 10 |
+
var ArraySet = require('./array-set').ArraySet;
|
| 11 |
+
var base64VLQ = require('./base64-vlq');
|
| 12 |
+
var quickSort = require('./quick-sort').quickSort;
|
| 13 |
+
|
| 14 |
+
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
|
| 15 |
+
var sourceMap = aSourceMap;
|
| 16 |
+
if (typeof aSourceMap === 'string') {
|
| 17 |
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
return sourceMap.sections != null
|
| 21 |
+
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
|
| 22 |
+
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
|
| 26 |
+
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* The version of the source mapping spec that we are consuming.
|
| 31 |
+
*/
|
| 32 |
+
SourceMapConsumer.prototype._version = 3;
|
| 33 |
+
|
| 34 |
+
// `__generatedMappings` and `__originalMappings` are arrays that hold the
|
| 35 |
+
// parsed mapping coordinates from the source map's "mappings" attribute. They
|
| 36 |
+
// are lazily instantiated, accessed via the `_generatedMappings` and
|
| 37 |
+
// `_originalMappings` getters respectively, and we only parse the mappings
|
| 38 |
+
// and create these arrays once queried for a source location. We jump through
|
| 39 |
+
// these hoops because there can be many thousands of mappings, and parsing
|
| 40 |
+
// them is expensive, so we only want to do it if we must.
|
| 41 |
+
//
|
| 42 |
+
// Each object in the arrays is of the form:
|
| 43 |
+
//
|
| 44 |
+
// {
|
| 45 |
+
// generatedLine: The line number in the generated code,
|
| 46 |
+
// generatedColumn: The column number in the generated code,
|
| 47 |
+
// source: The path to the original source file that generated this
|
| 48 |
+
// chunk of code,
|
| 49 |
+
// originalLine: The line number in the original source that
|
| 50 |
+
// corresponds to this chunk of generated code,
|
| 51 |
+
// originalColumn: The column number in the original source that
|
| 52 |
+
// corresponds to this chunk of generated code,
|
| 53 |
+
// name: The name of the original symbol which generated this chunk of
|
| 54 |
+
// code.
|
| 55 |
+
// }
|
| 56 |
+
//
|
| 57 |
+
// All properties except for `generatedLine` and `generatedColumn` can be
|
| 58 |
+
// `null`.
|
| 59 |
+
//
|
| 60 |
+
// `_generatedMappings` is ordered by the generated positions.
|
| 61 |
+
//
|
| 62 |
+
// `_originalMappings` is ordered by the original positions.
|
| 63 |
+
|
| 64 |
+
SourceMapConsumer.prototype.__generatedMappings = null;
|
| 65 |
+
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
|
| 66 |
+
configurable: true,
|
| 67 |
+
enumerable: true,
|
| 68 |
+
get: function () {
|
| 69 |
+
if (!this.__generatedMappings) {
|
| 70 |
+
this._parseMappings(this._mappings, this.sourceRoot);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
return this.__generatedMappings;
|
| 74 |
+
}
|
| 75 |
+
});
|
| 76 |
+
|
| 77 |
+
SourceMapConsumer.prototype.__originalMappings = null;
|
| 78 |
+
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
|
| 79 |
+
configurable: true,
|
| 80 |
+
enumerable: true,
|
| 81 |
+
get: function () {
|
| 82 |
+
if (!this.__originalMappings) {
|
| 83 |
+
this._parseMappings(this._mappings, this.sourceRoot);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
return this.__originalMappings;
|
| 87 |
+
}
|
| 88 |
+
});
|
| 89 |
+
|
| 90 |
+
SourceMapConsumer.prototype._charIsMappingSeparator =
|
| 91 |
+
function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
|
| 92 |
+
var c = aStr.charAt(index);
|
| 93 |
+
return c === ";" || c === ",";
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Parse the mappings in a string in to a data structure which we can easily
|
| 98 |
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
| 99 |
+
* `this.__originalMappings` properties).
|
| 100 |
+
*/
|
| 101 |
+
SourceMapConsumer.prototype._parseMappings =
|
| 102 |
+
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
| 103 |
+
throw new Error("Subclasses must implement _parseMappings");
|
| 104 |
+
};
|
| 105 |
+
|
| 106 |
+
SourceMapConsumer.GENERATED_ORDER = 1;
|
| 107 |
+
SourceMapConsumer.ORIGINAL_ORDER = 2;
|
| 108 |
+
|
| 109 |
+
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
|
| 110 |
+
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
* Iterate over each mapping between an original source/line/column and a
|
| 114 |
+
* generated line/column in this source map.
|
| 115 |
+
*
|
| 116 |
+
* @param Function aCallback
|
| 117 |
+
* The function that is called with each mapping.
|
| 118 |
+
* @param Object aContext
|
| 119 |
+
* Optional. If specified, this object will be the value of `this` every
|
| 120 |
+
* time that `aCallback` is called.
|
| 121 |
+
* @param aOrder
|
| 122 |
+
* Either `SourceMapConsumer.GENERATED_ORDER` or
|
| 123 |
+
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
|
| 124 |
+
* iterate over the mappings sorted by the generated file's line/column
|
| 125 |
+
* order or the original's source/line/column order, respectively. Defaults to
|
| 126 |
+
* `SourceMapConsumer.GENERATED_ORDER`.
|
| 127 |
+
*/
|
| 128 |
+
SourceMapConsumer.prototype.eachMapping =
|
| 129 |
+
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
|
| 130 |
+
var context = aContext || null;
|
| 131 |
+
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
|
| 132 |
+
|
| 133 |
+
var mappings;
|
| 134 |
+
switch (order) {
|
| 135 |
+
case SourceMapConsumer.GENERATED_ORDER:
|
| 136 |
+
mappings = this._generatedMappings;
|
| 137 |
+
break;
|
| 138 |
+
case SourceMapConsumer.ORIGINAL_ORDER:
|
| 139 |
+
mappings = this._originalMappings;
|
| 140 |
+
break;
|
| 141 |
+
default:
|
| 142 |
+
throw new Error("Unknown order of iteration.");
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
var sourceRoot = this.sourceRoot;
|
| 146 |
+
var boundCallback = aCallback.bind(context);
|
| 147 |
+
var names = this._names;
|
| 148 |
+
var sources = this._sources;
|
| 149 |
+
var sourceMapURL = this._sourceMapURL;
|
| 150 |
+
|
| 151 |
+
for (var i = 0, n = mappings.length; i < n; i++) {
|
| 152 |
+
var mapping = mappings[i];
|
| 153 |
+
var source = mapping.source === null ? null : sources.at(mapping.source);
|
| 154 |
+
if(source !== null) {
|
| 155 |
+
source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
|
| 156 |
+
}
|
| 157 |
+
boundCallback({
|
| 158 |
+
source: source,
|
| 159 |
+
generatedLine: mapping.generatedLine,
|
| 160 |
+
generatedColumn: mapping.generatedColumn,
|
| 161 |
+
originalLine: mapping.originalLine,
|
| 162 |
+
originalColumn: mapping.originalColumn,
|
| 163 |
+
name: mapping.name === null ? null : names.at(mapping.name)
|
| 164 |
+
});
|
| 165 |
+
}
|
| 166 |
+
};
|
| 167 |
+
|
| 168 |
+
/**
|
| 169 |
+
* Returns all generated line and column information for the original source,
|
| 170 |
+
* line, and column provided. If no column is provided, returns all mappings
|
| 171 |
+
* corresponding to a either the line we are searching for or the next
|
| 172 |
+
* closest line that has any mappings. Otherwise, returns all mappings
|
| 173 |
+
* corresponding to the given line and either the column we are searching for
|
| 174 |
+
* or the next closest column that has any offsets.
|
| 175 |
+
*
|
| 176 |
+
* The only argument is an object with the following properties:
|
| 177 |
+
*
|
| 178 |
+
* - source: The filename of the original source.
|
| 179 |
+
* - line: The line number in the original source. The line number is 1-based.
|
| 180 |
+
* - column: Optional. the column number in the original source.
|
| 181 |
+
* The column number is 0-based.
|
| 182 |
+
*
|
| 183 |
+
* and an array of objects is returned, each with the following properties:
|
| 184 |
+
*
|
| 185 |
+
* - line: The line number in the generated source, or null. The
|
| 186 |
+
* line number is 1-based.
|
| 187 |
+
* - column: The column number in the generated source, or null.
|
| 188 |
+
* The column number is 0-based.
|
| 189 |
+
*/
|
| 190 |
+
SourceMapConsumer.prototype.allGeneratedPositionsFor =
|
| 191 |
+
function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
|
| 192 |
+
var line = util.getArg(aArgs, 'line');
|
| 193 |
+
|
| 194 |
+
// When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
|
| 195 |
+
// returns the index of the closest mapping less than the needle. By
|
| 196 |
+
// setting needle.originalColumn to 0, we thus find the last mapping for
|
| 197 |
+
// the given line, provided such a mapping exists.
|
| 198 |
+
var needle = {
|
| 199 |
+
source: util.getArg(aArgs, 'source'),
|
| 200 |
+
originalLine: line,
|
| 201 |
+
originalColumn: util.getArg(aArgs, 'column', 0)
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
needle.source = this._findSourceIndex(needle.source);
|
| 205 |
+
if (needle.source < 0) {
|
| 206 |
+
return [];
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
var mappings = [];
|
| 210 |
+
|
| 211 |
+
var index = this._findMapping(needle,
|
| 212 |
+
this._originalMappings,
|
| 213 |
+
"originalLine",
|
| 214 |
+
"originalColumn",
|
| 215 |
+
util.compareByOriginalPositions,
|
| 216 |
+
binarySearch.LEAST_UPPER_BOUND);
|
| 217 |
+
if (index >= 0) {
|
| 218 |
+
var mapping = this._originalMappings[index];
|
| 219 |
+
|
| 220 |
+
if (aArgs.column === undefined) {
|
| 221 |
+
var originalLine = mapping.originalLine;
|
| 222 |
+
|
| 223 |
+
// Iterate until either we run out of mappings, or we run into
|
| 224 |
+
// a mapping for a different line than the one we found. Since
|
| 225 |
+
// mappings are sorted, this is guaranteed to find all mappings for
|
| 226 |
+
// the line we found.
|
| 227 |
+
while (mapping && mapping.originalLine === originalLine) {
|
| 228 |
+
mappings.push({
|
| 229 |
+
line: util.getArg(mapping, 'generatedLine', null),
|
| 230 |
+
column: util.getArg(mapping, 'generatedColumn', null),
|
| 231 |
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
| 232 |
+
});
|
| 233 |
+
|
| 234 |
+
mapping = this._originalMappings[++index];
|
| 235 |
+
}
|
| 236 |
+
} else {
|
| 237 |
+
var originalColumn = mapping.originalColumn;
|
| 238 |
+
|
| 239 |
+
// Iterate until either we run out of mappings, or we run into
|
| 240 |
+
// a mapping for a different line than the one we were searching for.
|
| 241 |
+
// Since mappings are sorted, this is guaranteed to find all mappings for
|
| 242 |
+
// the line we are searching for.
|
| 243 |
+
while (mapping &&
|
| 244 |
+
mapping.originalLine === line &&
|
| 245 |
+
mapping.originalColumn == originalColumn) {
|
| 246 |
+
mappings.push({
|
| 247 |
+
line: util.getArg(mapping, 'generatedLine', null),
|
| 248 |
+
column: util.getArg(mapping, 'generatedColumn', null),
|
| 249 |
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
| 250 |
+
});
|
| 251 |
+
|
| 252 |
+
mapping = this._originalMappings[++index];
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
return mappings;
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
exports.SourceMapConsumer = SourceMapConsumer;
|
| 261 |
+
|
| 262 |
+
/**
|
| 263 |
+
* A BasicSourceMapConsumer instance represents a parsed source map which we can
|
| 264 |
+
* query for information about the original file positions by giving it a file
|
| 265 |
+
* position in the generated source.
|
| 266 |
+
*
|
| 267 |
+
* The first parameter is the raw source map (either as a JSON string, or
|
| 268 |
+
* already parsed to an object). According to the spec, source maps have the
|
| 269 |
+
* following attributes:
|
| 270 |
+
*
|
| 271 |
+
* - version: Which version of the source map spec this map is following.
|
| 272 |
+
* - sources: An array of URLs to the original source files.
|
| 273 |
+
* - names: An array of identifiers which can be referrenced by individual mappings.
|
| 274 |
+
* - sourceRoot: Optional. The URL root from which all sources are relative.
|
| 275 |
+
* - sourcesContent: Optional. An array of contents of the original source files.
|
| 276 |
+
* - mappings: A string of base64 VLQs which contain the actual mappings.
|
| 277 |
+
* - file: Optional. The generated file this source map is associated with.
|
| 278 |
+
*
|
| 279 |
+
* Here is an example source map, taken from the source map spec[0]:
|
| 280 |
+
*
|
| 281 |
+
* {
|
| 282 |
+
* version : 3,
|
| 283 |
+
* file: "out.js",
|
| 284 |
+
* sourceRoot : "",
|
| 285 |
+
* sources: ["foo.js", "bar.js"],
|
| 286 |
+
* names: ["src", "maps", "are", "fun"],
|
| 287 |
+
* mappings: "AA,AB;;ABCDE;"
|
| 288 |
+
* }
|
| 289 |
+
*
|
| 290 |
+
* The second parameter, if given, is a string whose value is the URL
|
| 291 |
+
* at which the source map was found. This URL is used to compute the
|
| 292 |
+
* sources array.
|
| 293 |
+
*
|
| 294 |
+
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
|
| 295 |
+
*/
|
| 296 |
+
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
| 297 |
+
var sourceMap = aSourceMap;
|
| 298 |
+
if (typeof aSourceMap === 'string') {
|
| 299 |
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
var version = util.getArg(sourceMap, 'version');
|
| 303 |
+
var sources = util.getArg(sourceMap, 'sources');
|
| 304 |
+
// Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
|
| 305 |
+
// requires the array) to play nice here.
|
| 306 |
+
var names = util.getArg(sourceMap, 'names', []);
|
| 307 |
+
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
|
| 308 |
+
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
|
| 309 |
+
var mappings = util.getArg(sourceMap, 'mappings');
|
| 310 |
+
var file = util.getArg(sourceMap, 'file', null);
|
| 311 |
+
|
| 312 |
+
// Once again, Sass deviates from the spec and supplies the version as a
|
| 313 |
+
// string rather than a number, so we use loose equality checking here.
|
| 314 |
+
if (version != this._version) {
|
| 315 |
+
throw new Error('Unsupported version: ' + version);
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
if (sourceRoot) {
|
| 319 |
+
sourceRoot = util.normalize(sourceRoot);
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
sources = sources
|
| 323 |
+
.map(String)
|
| 324 |
+
// Some source maps produce relative source paths like "./foo.js" instead of
|
| 325 |
+
// "foo.js". Normalize these first so that future comparisons will succeed.
|
| 326 |
+
// See bugzil.la/1090768.
|
| 327 |
+
.map(util.normalize)
|
| 328 |
+
// Always ensure that absolute sources are internally stored relative to
|
| 329 |
+
// the source root, if the source root is absolute. Not doing this would
|
| 330 |
+
// be particularly problematic when the source root is a prefix of the
|
| 331 |
+
// source (valid, but why??). See github issue #199 and bugzil.la/1188982.
|
| 332 |
+
.map(function (source) {
|
| 333 |
+
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
|
| 334 |
+
? util.relative(sourceRoot, source)
|
| 335 |
+
: source;
|
| 336 |
+
});
|
| 337 |
+
|
| 338 |
+
// Pass `true` below to allow duplicate names and sources. While source maps
|
| 339 |
+
// are intended to be compressed and deduplicated, the TypeScript compiler
|
| 340 |
+
// sometimes generates source maps with duplicates in them. See Github issue
|
| 341 |
+
// #72 and bugzil.la/889492.
|
| 342 |
+
this._names = ArraySet.fromArray(names.map(String), true);
|
| 343 |
+
this._sources = ArraySet.fromArray(sources, true);
|
| 344 |
+
|
| 345 |
+
this._absoluteSources = this._sources.toArray().map(function (s) {
|
| 346 |
+
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
| 347 |
+
});
|
| 348 |
+
|
| 349 |
+
this.sourceRoot = sourceRoot;
|
| 350 |
+
this.sourcesContent = sourcesContent;
|
| 351 |
+
this._mappings = mappings;
|
| 352 |
+
this._sourceMapURL = aSourceMapURL;
|
| 353 |
+
this.file = file;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
| 357 |
+
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* Utility function to find the index of a source. Returns -1 if not
|
| 361 |
+
* found.
|
| 362 |
+
*/
|
| 363 |
+
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
|
| 364 |
+
var relativeSource = aSource;
|
| 365 |
+
if (this.sourceRoot != null) {
|
| 366 |
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
if (this._sources.has(relativeSource)) {
|
| 370 |
+
return this._sources.indexOf(relativeSource);
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
// Maybe aSource is an absolute URL as returned by |sources|. In
|
| 374 |
+
// this case we can't simply undo the transform.
|
| 375 |
+
var i;
|
| 376 |
+
for (i = 0; i < this._absoluteSources.length; ++i) {
|
| 377 |
+
if (this._absoluteSources[i] == aSource) {
|
| 378 |
+
return i;
|
| 379 |
+
}
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
return -1;
|
| 383 |
+
};
|
| 384 |
+
|
| 385 |
+
/**
|
| 386 |
+
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
| 387 |
+
*
|
| 388 |
+
* @param SourceMapGenerator aSourceMap
|
| 389 |
+
* The source map that will be consumed.
|
| 390 |
+
* @param String aSourceMapURL
|
| 391 |
+
* The URL at which the source map can be found (optional)
|
| 392 |
+
* @returns BasicSourceMapConsumer
|
| 393 |
+
*/
|
| 394 |
+
BasicSourceMapConsumer.fromSourceMap =
|
| 395 |
+
function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
|
| 396 |
+
var smc = Object.create(BasicSourceMapConsumer.prototype);
|
| 397 |
+
|
| 398 |
+
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
|
| 399 |
+
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
|
| 400 |
+
smc.sourceRoot = aSourceMap._sourceRoot;
|
| 401 |
+
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
|
| 402 |
+
smc.sourceRoot);
|
| 403 |
+
smc.file = aSourceMap._file;
|
| 404 |
+
smc._sourceMapURL = aSourceMapURL;
|
| 405 |
+
smc._absoluteSources = smc._sources.toArray().map(function (s) {
|
| 406 |
+
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
|
| 407 |
+
});
|
| 408 |
+
|
| 409 |
+
// Because we are modifying the entries (by converting string sources and
|
| 410 |
+
// names to indices into the sources and names ArraySets), we have to make
|
| 411 |
+
// a copy of the entry or else bad things happen. Shared mutable state
|
| 412 |
+
// strikes again! See github issue #191.
|
| 413 |
+
|
| 414 |
+
var generatedMappings = aSourceMap._mappings.toArray().slice();
|
| 415 |
+
var destGeneratedMappings = smc.__generatedMappings = [];
|
| 416 |
+
var destOriginalMappings = smc.__originalMappings = [];
|
| 417 |
+
|
| 418 |
+
for (var i = 0, length = generatedMappings.length; i < length; i++) {
|
| 419 |
+
var srcMapping = generatedMappings[i];
|
| 420 |
+
var destMapping = new Mapping;
|
| 421 |
+
destMapping.generatedLine = srcMapping.generatedLine;
|
| 422 |
+
destMapping.generatedColumn = srcMapping.generatedColumn;
|
| 423 |
+
|
| 424 |
+
if (srcMapping.source) {
|
| 425 |
+
destMapping.source = sources.indexOf(srcMapping.source);
|
| 426 |
+
destMapping.originalLine = srcMapping.originalLine;
|
| 427 |
+
destMapping.originalColumn = srcMapping.originalColumn;
|
| 428 |
+
|
| 429 |
+
if (srcMapping.name) {
|
| 430 |
+
destMapping.name = names.indexOf(srcMapping.name);
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
destOriginalMappings.push(destMapping);
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
destGeneratedMappings.push(destMapping);
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
|
| 440 |
+
|
| 441 |
+
return smc;
|
| 442 |
+
};
|
| 443 |
+
|
| 444 |
+
/**
|
| 445 |
+
* The version of the source mapping spec that we are consuming.
|
| 446 |
+
*/
|
| 447 |
+
BasicSourceMapConsumer.prototype._version = 3;
|
| 448 |
+
|
| 449 |
+
/**
|
| 450 |
+
* The list of original sources.
|
| 451 |
+
*/
|
| 452 |
+
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
|
| 453 |
+
get: function () {
|
| 454 |
+
return this._absoluteSources.slice();
|
| 455 |
+
}
|
| 456 |
+
});
|
| 457 |
+
|
| 458 |
+
/**
|
| 459 |
+
* Provide the JIT with a nice shape / hidden class.
|
| 460 |
+
*/
|
| 461 |
+
function Mapping() {
|
| 462 |
+
this.generatedLine = 0;
|
| 463 |
+
this.generatedColumn = 0;
|
| 464 |
+
this.source = null;
|
| 465 |
+
this.originalLine = null;
|
| 466 |
+
this.originalColumn = null;
|
| 467 |
+
this.name = null;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
/**
|
| 471 |
+
* Parse the mappings in a string in to a data structure which we can easily
|
| 472 |
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
| 473 |
+
* `this.__originalMappings` properties).
|
| 474 |
+
*/
|
| 475 |
+
|
| 476 |
+
const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;
|
| 477 |
+
function sortGenerated(array, start) {
|
| 478 |
+
let l = array.length;
|
| 479 |
+
let n = array.length - start;
|
| 480 |
+
if (n <= 1) {
|
| 481 |
+
return;
|
| 482 |
+
} else if (n == 2) {
|
| 483 |
+
let a = array[start];
|
| 484 |
+
let b = array[start + 1];
|
| 485 |
+
if (compareGenerated(a, b) > 0) {
|
| 486 |
+
array[start] = b;
|
| 487 |
+
array[start + 1] = a;
|
| 488 |
+
}
|
| 489 |
+
} else if (n < 20) {
|
| 490 |
+
for (let i = start; i < l; i++) {
|
| 491 |
+
for (let j = i; j > start; j--) {
|
| 492 |
+
let a = array[j - 1];
|
| 493 |
+
let b = array[j];
|
| 494 |
+
if (compareGenerated(a, b) <= 0) {
|
| 495 |
+
break;
|
| 496 |
+
}
|
| 497 |
+
array[j - 1] = b;
|
| 498 |
+
array[j] = a;
|
| 499 |
+
}
|
| 500 |
+
}
|
| 501 |
+
} else {
|
| 502 |
+
quickSort(array, compareGenerated, start);
|
| 503 |
+
}
|
| 504 |
+
}
|
| 505 |
+
BasicSourceMapConsumer.prototype._parseMappings =
|
| 506 |
+
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
| 507 |
+
var generatedLine = 1;
|
| 508 |
+
var previousGeneratedColumn = 0;
|
| 509 |
+
var previousOriginalLine = 0;
|
| 510 |
+
var previousOriginalColumn = 0;
|
| 511 |
+
var previousSource = 0;
|
| 512 |
+
var previousName = 0;
|
| 513 |
+
var length = aStr.length;
|
| 514 |
+
var index = 0;
|
| 515 |
+
var cachedSegments = {};
|
| 516 |
+
var temp = {};
|
| 517 |
+
var originalMappings = [];
|
| 518 |
+
var generatedMappings = [];
|
| 519 |
+
var mapping, str, segment, end, value;
|
| 520 |
+
|
| 521 |
+
let subarrayStart = 0;
|
| 522 |
+
while (index < length) {
|
| 523 |
+
if (aStr.charAt(index) === ';') {
|
| 524 |
+
generatedLine++;
|
| 525 |
+
index++;
|
| 526 |
+
previousGeneratedColumn = 0;
|
| 527 |
+
|
| 528 |
+
sortGenerated(generatedMappings, subarrayStart);
|
| 529 |
+
subarrayStart = generatedMappings.length;
|
| 530 |
+
}
|
| 531 |
+
else if (aStr.charAt(index) === ',') {
|
| 532 |
+
index++;
|
| 533 |
+
}
|
| 534 |
+
else {
|
| 535 |
+
mapping = new Mapping();
|
| 536 |
+
mapping.generatedLine = generatedLine;
|
| 537 |
+
|
| 538 |
+
for (end = index; end < length; end++) {
|
| 539 |
+
if (this._charIsMappingSeparator(aStr, end)) {
|
| 540 |
+
break;
|
| 541 |
+
}
|
| 542 |
+
}
|
| 543 |
+
str = aStr.slice(index, end);
|
| 544 |
+
|
| 545 |
+
segment = [];
|
| 546 |
+
while (index < end) {
|
| 547 |
+
base64VLQ.decode(aStr, index, temp);
|
| 548 |
+
value = temp.value;
|
| 549 |
+
index = temp.rest;
|
| 550 |
+
segment.push(value);
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
if (segment.length === 2) {
|
| 554 |
+
throw new Error('Found a source, but no line and column');
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
if (segment.length === 3) {
|
| 558 |
+
throw new Error('Found a source and line, but no column');
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
// Generated column.
|
| 562 |
+
mapping.generatedColumn = previousGeneratedColumn + segment[0];
|
| 563 |
+
previousGeneratedColumn = mapping.generatedColumn;
|
| 564 |
+
|
| 565 |
+
if (segment.length > 1) {
|
| 566 |
+
// Original source.
|
| 567 |
+
mapping.source = previousSource + segment[1];
|
| 568 |
+
previousSource += segment[1];
|
| 569 |
+
|
| 570 |
+
// Original line.
|
| 571 |
+
mapping.originalLine = previousOriginalLine + segment[2];
|
| 572 |
+
previousOriginalLine = mapping.originalLine;
|
| 573 |
+
// Lines are stored 0-based
|
| 574 |
+
mapping.originalLine += 1;
|
| 575 |
+
|
| 576 |
+
// Original column.
|
| 577 |
+
mapping.originalColumn = previousOriginalColumn + segment[3];
|
| 578 |
+
previousOriginalColumn = mapping.originalColumn;
|
| 579 |
+
|
| 580 |
+
if (segment.length > 4) {
|
| 581 |
+
// Original name.
|
| 582 |
+
mapping.name = previousName + segment[4];
|
| 583 |
+
previousName += segment[4];
|
| 584 |
+
}
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
generatedMappings.push(mapping);
|
| 588 |
+
if (typeof mapping.originalLine === 'number') {
|
| 589 |
+
let currentSource = mapping.source;
|
| 590 |
+
while (originalMappings.length <= currentSource) {
|
| 591 |
+
originalMappings.push(null);
|
| 592 |
+
}
|
| 593 |
+
if (originalMappings[currentSource] === null) {
|
| 594 |
+
originalMappings[currentSource] = [];
|
| 595 |
+
}
|
| 596 |
+
originalMappings[currentSource].push(mapping);
|
| 597 |
+
}
|
| 598 |
+
}
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
sortGenerated(generatedMappings, subarrayStart);
|
| 602 |
+
this.__generatedMappings = generatedMappings;
|
| 603 |
+
|
| 604 |
+
for (var i = 0; i < originalMappings.length; i++) {
|
| 605 |
+
if (originalMappings[i] != null) {
|
| 606 |
+
quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);
|
| 607 |
+
}
|
| 608 |
+
}
|
| 609 |
+
this.__originalMappings = [].concat(...originalMappings);
|
| 610 |
+
};
|
| 611 |
+
|
| 612 |
+
/**
|
| 613 |
+
* Find the mapping that best matches the hypothetical "needle" mapping that
|
| 614 |
+
* we are searching for in the given "haystack" of mappings.
|
| 615 |
+
*/
|
| 616 |
+
BasicSourceMapConsumer.prototype._findMapping =
|
| 617 |
+
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
|
| 618 |
+
aColumnName, aComparator, aBias) {
|
| 619 |
+
// To return the position we are searching for, we must first find the
|
| 620 |
+
// mapping for the given position and then return the opposite position it
|
| 621 |
+
// points to. Because the mappings are sorted, we can use binary search to
|
| 622 |
+
// find the best mapping.
|
| 623 |
+
|
| 624 |
+
if (aNeedle[aLineName] <= 0) {
|
| 625 |
+
throw new TypeError('Line must be greater than or equal to 1, got '
|
| 626 |
+
+ aNeedle[aLineName]);
|
| 627 |
+
}
|
| 628 |
+
if (aNeedle[aColumnName] < 0) {
|
| 629 |
+
throw new TypeError('Column must be greater than or equal to 0, got '
|
| 630 |
+
+ aNeedle[aColumnName]);
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
|
| 634 |
+
};
|
| 635 |
+
|
| 636 |
+
/**
|
| 637 |
+
* Compute the last column for each generated mapping. The last column is
|
| 638 |
+
* inclusive.
|
| 639 |
+
*/
|
| 640 |
+
BasicSourceMapConsumer.prototype.computeColumnSpans =
|
| 641 |
+
function SourceMapConsumer_computeColumnSpans() {
|
| 642 |
+
for (var index = 0; index < this._generatedMappings.length; ++index) {
|
| 643 |
+
var mapping = this._generatedMappings[index];
|
| 644 |
+
|
| 645 |
+
// Mappings do not contain a field for the last generated columnt. We
|
| 646 |
+
// can come up with an optimistic estimate, however, by assuming that
|
| 647 |
+
// mappings are contiguous (i.e. given two consecutive mappings, the
|
| 648 |
+
// first mapping ends where the second one starts).
|
| 649 |
+
if (index + 1 < this._generatedMappings.length) {
|
| 650 |
+
var nextMapping = this._generatedMappings[index + 1];
|
| 651 |
+
|
| 652 |
+
if (mapping.generatedLine === nextMapping.generatedLine) {
|
| 653 |
+
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
|
| 654 |
+
continue;
|
| 655 |
+
}
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
// The last mapping for each line spans the entire line.
|
| 659 |
+
mapping.lastGeneratedColumn = Infinity;
|
| 660 |
+
}
|
| 661 |
+
};
|
| 662 |
+
|
| 663 |
+
/**
|
| 664 |
+
* Returns the original source, line, and column information for the generated
|
| 665 |
+
* source's line and column positions provided. The only argument is an object
|
| 666 |
+
* with the following properties:
|
| 667 |
+
*
|
| 668 |
+
* - line: The line number in the generated source. The line number
|
| 669 |
+
* is 1-based.
|
| 670 |
+
* - column: The column number in the generated source. The column
|
| 671 |
+
* number is 0-based.
|
| 672 |
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
| 673 |
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
| 674 |
+
* closest element that is smaller than or greater than the one we are
|
| 675 |
+
* searching for, respectively, if the exact element cannot be found.
|
| 676 |
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
| 677 |
+
*
|
| 678 |
+
* and an object is returned with the following properties:
|
| 679 |
+
*
|
| 680 |
+
* - source: The original source file, or null.
|
| 681 |
+
* - line: The line number in the original source, or null. The
|
| 682 |
+
* line number is 1-based.
|
| 683 |
+
* - column: The column number in the original source, or null. The
|
| 684 |
+
* column number is 0-based.
|
| 685 |
+
* - name: The original identifier, or null.
|
| 686 |
+
*/
|
| 687 |
+
BasicSourceMapConsumer.prototype.originalPositionFor =
|
| 688 |
+
function SourceMapConsumer_originalPositionFor(aArgs) {
|
| 689 |
+
var needle = {
|
| 690 |
+
generatedLine: util.getArg(aArgs, 'line'),
|
| 691 |
+
generatedColumn: util.getArg(aArgs, 'column')
|
| 692 |
+
};
|
| 693 |
+
|
| 694 |
+
var index = this._findMapping(
|
| 695 |
+
needle,
|
| 696 |
+
this._generatedMappings,
|
| 697 |
+
"generatedLine",
|
| 698 |
+
"generatedColumn",
|
| 699 |
+
util.compareByGeneratedPositionsDeflated,
|
| 700 |
+
util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
|
| 701 |
+
);
|
| 702 |
+
|
| 703 |
+
if (index >= 0) {
|
| 704 |
+
var mapping = this._generatedMappings[index];
|
| 705 |
+
|
| 706 |
+
if (mapping.generatedLine === needle.generatedLine) {
|
| 707 |
+
var source = util.getArg(mapping, 'source', null);
|
| 708 |
+
if (source !== null) {
|
| 709 |
+
source = this._sources.at(source);
|
| 710 |
+
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
| 711 |
+
}
|
| 712 |
+
var name = util.getArg(mapping, 'name', null);
|
| 713 |
+
if (name !== null) {
|
| 714 |
+
name = this._names.at(name);
|
| 715 |
+
}
|
| 716 |
+
return {
|
| 717 |
+
source: source,
|
| 718 |
+
line: util.getArg(mapping, 'originalLine', null),
|
| 719 |
+
column: util.getArg(mapping, 'originalColumn', null),
|
| 720 |
+
name: name
|
| 721 |
+
};
|
| 722 |
+
}
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
return {
|
| 726 |
+
source: null,
|
| 727 |
+
line: null,
|
| 728 |
+
column: null,
|
| 729 |
+
name: null
|
| 730 |
+
};
|
| 731 |
+
};
|
| 732 |
+
|
| 733 |
+
/**
|
| 734 |
+
* Return true if we have the source content for every source in the source
|
| 735 |
+
* map, false otherwise.
|
| 736 |
+
*/
|
| 737 |
+
BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
|
| 738 |
+
function BasicSourceMapConsumer_hasContentsOfAllSources() {
|
| 739 |
+
if (!this.sourcesContent) {
|
| 740 |
+
return false;
|
| 741 |
+
}
|
| 742 |
+
return this.sourcesContent.length >= this._sources.size() &&
|
| 743 |
+
!this.sourcesContent.some(function (sc) { return sc == null; });
|
| 744 |
+
};
|
| 745 |
+
|
| 746 |
+
/**
|
| 747 |
+
* Returns the original source content. The only argument is the url of the
|
| 748 |
+
* original source file. Returns null if no original source content is
|
| 749 |
+
* available.
|
| 750 |
+
*/
|
| 751 |
+
BasicSourceMapConsumer.prototype.sourceContentFor =
|
| 752 |
+
function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
| 753 |
+
if (!this.sourcesContent) {
|
| 754 |
+
return null;
|
| 755 |
+
}
|
| 756 |
+
|
| 757 |
+
var index = this._findSourceIndex(aSource);
|
| 758 |
+
if (index >= 0) {
|
| 759 |
+
return this.sourcesContent[index];
|
| 760 |
+
}
|
| 761 |
+
|
| 762 |
+
var relativeSource = aSource;
|
| 763 |
+
if (this.sourceRoot != null) {
|
| 764 |
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
var url;
|
| 768 |
+
if (this.sourceRoot != null
|
| 769 |
+
&& (url = util.urlParse(this.sourceRoot))) {
|
| 770 |
+
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
|
| 771 |
+
// many users. We can help them out when they expect file:// URIs to
|
| 772 |
+
// behave like it would if they were running a local HTTP server. See
|
| 773 |
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
|
| 774 |
+
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
| 775 |
+
if (url.scheme == "file"
|
| 776 |
+
&& this._sources.has(fileUriAbsPath)) {
|
| 777 |
+
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
if ((!url.path || url.path == "/")
|
| 781 |
+
&& this._sources.has("/" + relativeSource)) {
|
| 782 |
+
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
| 783 |
+
}
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
// This function is used recursively from
|
| 787 |
+
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
|
| 788 |
+
// don't want to throw if we can't find the source - we just want to
|
| 789 |
+
// return null, so we provide a flag to exit gracefully.
|
| 790 |
+
if (nullOnMissing) {
|
| 791 |
+
return null;
|
| 792 |
+
}
|
| 793 |
+
else {
|
| 794 |
+
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
| 795 |
+
}
|
| 796 |
+
};
|
| 797 |
+
|
| 798 |
+
/**
|
| 799 |
+
* Returns the generated line and column information for the original source,
|
| 800 |
+
* line, and column positions provided. The only argument is an object with
|
| 801 |
+
* the following properties:
|
| 802 |
+
*
|
| 803 |
+
* - source: The filename of the original source.
|
| 804 |
+
* - line: The line number in the original source. The line number
|
| 805 |
+
* is 1-based.
|
| 806 |
+
* - column: The column number in the original source. The column
|
| 807 |
+
* number is 0-based.
|
| 808 |
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
| 809 |
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
| 810 |
+
* closest element that is smaller than or greater than the one we are
|
| 811 |
+
* searching for, respectively, if the exact element cannot be found.
|
| 812 |
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
| 813 |
+
*
|
| 814 |
+
* and an object is returned with the following properties:
|
| 815 |
+
*
|
| 816 |
+
* - line: The line number in the generated source, or null. The
|
| 817 |
+
* line number is 1-based.
|
| 818 |
+
* - column: The column number in the generated source, or null.
|
| 819 |
+
* The column number is 0-based.
|
| 820 |
+
*/
|
| 821 |
+
BasicSourceMapConsumer.prototype.generatedPositionFor =
|
| 822 |
+
function SourceMapConsumer_generatedPositionFor(aArgs) {
|
| 823 |
+
var source = util.getArg(aArgs, 'source');
|
| 824 |
+
source = this._findSourceIndex(source);
|
| 825 |
+
if (source < 0) {
|
| 826 |
+
return {
|
| 827 |
+
line: null,
|
| 828 |
+
column: null,
|
| 829 |
+
lastColumn: null
|
| 830 |
+
};
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
var needle = {
|
| 834 |
+
source: source,
|
| 835 |
+
originalLine: util.getArg(aArgs, 'line'),
|
| 836 |
+
originalColumn: util.getArg(aArgs, 'column')
|
| 837 |
+
};
|
| 838 |
+
|
| 839 |
+
var index = this._findMapping(
|
| 840 |
+
needle,
|
| 841 |
+
this._originalMappings,
|
| 842 |
+
"originalLine",
|
| 843 |
+
"originalColumn",
|
| 844 |
+
util.compareByOriginalPositions,
|
| 845 |
+
util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
|
| 846 |
+
);
|
| 847 |
+
|
| 848 |
+
if (index >= 0) {
|
| 849 |
+
var mapping = this._originalMappings[index];
|
| 850 |
+
|
| 851 |
+
if (mapping.source === needle.source) {
|
| 852 |
+
return {
|
| 853 |
+
line: util.getArg(mapping, 'generatedLine', null),
|
| 854 |
+
column: util.getArg(mapping, 'generatedColumn', null),
|
| 855 |
+
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
|
| 856 |
+
};
|
| 857 |
+
}
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
return {
|
| 861 |
+
line: null,
|
| 862 |
+
column: null,
|
| 863 |
+
lastColumn: null
|
| 864 |
+
};
|
| 865 |
+
};
|
| 866 |
+
|
| 867 |
+
exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
|
| 868 |
+
|
| 869 |
+
/**
|
| 870 |
+
* An IndexedSourceMapConsumer instance represents a parsed source map which
|
| 871 |
+
* we can query for information. It differs from BasicSourceMapConsumer in
|
| 872 |
+
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
|
| 873 |
+
* input.
|
| 874 |
+
*
|
| 875 |
+
* The first parameter is a raw source map (either as a JSON string, or already
|
| 876 |
+
* parsed to an object). According to the spec for indexed source maps, they
|
| 877 |
+
* have the following attributes:
|
| 878 |
+
*
|
| 879 |
+
* - version: Which version of the source map spec this map is following.
|
| 880 |
+
* - file: Optional. The generated file this source map is associated with.
|
| 881 |
+
* - sections: A list of section definitions.
|
| 882 |
+
*
|
| 883 |
+
* Each value under the "sections" field has two fields:
|
| 884 |
+
* - offset: The offset into the original specified at which this section
|
| 885 |
+
* begins to apply, defined as an object with a "line" and "column"
|
| 886 |
+
* field.
|
| 887 |
+
* - map: A source map definition. This source map could also be indexed,
|
| 888 |
+
* but doesn't have to be.
|
| 889 |
+
*
|
| 890 |
+
* Instead of the "map" field, it's also possible to have a "url" field
|
| 891 |
+
* specifying a URL to retrieve a source map from, but that's currently
|
| 892 |
+
* unsupported.
|
| 893 |
+
*
|
| 894 |
+
* Here's an example source map, taken from the source map spec[0], but
|
| 895 |
+
* modified to omit a section which uses the "url" field.
|
| 896 |
+
*
|
| 897 |
+
* {
|
| 898 |
+
* version : 3,
|
| 899 |
+
* file: "app.js",
|
| 900 |
+
* sections: [{
|
| 901 |
+
* offset: {line:100, column:10},
|
| 902 |
+
* map: {
|
| 903 |
+
* version : 3,
|
| 904 |
+
* file: "section.js",
|
| 905 |
+
* sources: ["foo.js", "bar.js"],
|
| 906 |
+
* names: ["src", "maps", "are", "fun"],
|
| 907 |
+
* mappings: "AAAA,E;;ABCDE;"
|
| 908 |
+
* }
|
| 909 |
+
* }],
|
| 910 |
+
* }
|
| 911 |
+
*
|
| 912 |
+
* The second parameter, if given, is a string whose value is the URL
|
| 913 |
+
* at which the source map was found. This URL is used to compute the
|
| 914 |
+
* sources array.
|
| 915 |
+
*
|
| 916 |
+
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
|
| 917 |
+
*/
|
| 918 |
+
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
| 919 |
+
var sourceMap = aSourceMap;
|
| 920 |
+
if (typeof aSourceMap === 'string') {
|
| 921 |
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
| 922 |
+
}
|
| 923 |
+
|
| 924 |
+
var version = util.getArg(sourceMap, 'version');
|
| 925 |
+
var sections = util.getArg(sourceMap, 'sections');
|
| 926 |
+
|
| 927 |
+
if (version != this._version) {
|
| 928 |
+
throw new Error('Unsupported version: ' + version);
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
this._sources = new ArraySet();
|
| 932 |
+
this._names = new ArraySet();
|
| 933 |
+
|
| 934 |
+
var lastOffset = {
|
| 935 |
+
line: -1,
|
| 936 |
+
column: 0
|
| 937 |
+
};
|
| 938 |
+
this._sections = sections.map(function (s) {
|
| 939 |
+
if (s.url) {
|
| 940 |
+
// The url field will require support for asynchronicity.
|
| 941 |
+
// See https://github.com/mozilla/source-map/issues/16
|
| 942 |
+
throw new Error('Support for url field in sections not implemented.');
|
| 943 |
+
}
|
| 944 |
+
var offset = util.getArg(s, 'offset');
|
| 945 |
+
var offsetLine = util.getArg(offset, 'line');
|
| 946 |
+
var offsetColumn = util.getArg(offset, 'column');
|
| 947 |
+
|
| 948 |
+
if (offsetLine < lastOffset.line ||
|
| 949 |
+
(offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
|
| 950 |
+
throw new Error('Section offsets must be ordered and non-overlapping.');
|
| 951 |
+
}
|
| 952 |
+
lastOffset = offset;
|
| 953 |
+
|
| 954 |
+
return {
|
| 955 |
+
generatedOffset: {
|
| 956 |
+
// The offset fields are 0-based, but we use 1-based indices when
|
| 957 |
+
// encoding/decoding from VLQ.
|
| 958 |
+
generatedLine: offsetLine + 1,
|
| 959 |
+
generatedColumn: offsetColumn + 1
|
| 960 |
+
},
|
| 961 |
+
consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
|
| 962 |
+
}
|
| 963 |
+
});
|
| 964 |
+
}
|
| 965 |
+
|
| 966 |
+
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
| 967 |
+
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
|
| 968 |
+
|
| 969 |
+
/**
|
| 970 |
+
* The version of the source mapping spec that we are consuming.
|
| 971 |
+
*/
|
| 972 |
+
IndexedSourceMapConsumer.prototype._version = 3;
|
| 973 |
+
|
| 974 |
+
/**
|
| 975 |
+
* The list of original sources.
|
| 976 |
+
*/
|
| 977 |
+
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
|
| 978 |
+
get: function () {
|
| 979 |
+
var sources = [];
|
| 980 |
+
for (var i = 0; i < this._sections.length; i++) {
|
| 981 |
+
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
|
| 982 |
+
sources.push(this._sections[i].consumer.sources[j]);
|
| 983 |
+
}
|
| 984 |
+
}
|
| 985 |
+
return sources;
|
| 986 |
+
}
|
| 987 |
+
});
|
| 988 |
+
|
| 989 |
+
/**
|
| 990 |
+
* Returns the original source, line, and column information for the generated
|
| 991 |
+
* source's line and column positions provided. The only argument is an object
|
| 992 |
+
* with the following properties:
|
| 993 |
+
*
|
| 994 |
+
* - line: The line number in the generated source. The line number
|
| 995 |
+
* is 1-based.
|
| 996 |
+
* - column: The column number in the generated source. The column
|
| 997 |
+
* number is 0-based.
|
| 998 |
+
*
|
| 999 |
+
* and an object is returned with the following properties:
|
| 1000 |
+
*
|
| 1001 |
+
* - source: The original source file, or null.
|
| 1002 |
+
* - line: The line number in the original source, or null. The
|
| 1003 |
+
* line number is 1-based.
|
| 1004 |
+
* - column: The column number in the original source, or null. The
|
| 1005 |
+
* column number is 0-based.
|
| 1006 |
+
* - name: The original identifier, or null.
|
| 1007 |
+
*/
|
| 1008 |
+
IndexedSourceMapConsumer.prototype.originalPositionFor =
|
| 1009 |
+
function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
|
| 1010 |
+
var needle = {
|
| 1011 |
+
generatedLine: util.getArg(aArgs, 'line'),
|
| 1012 |
+
generatedColumn: util.getArg(aArgs, 'column')
|
| 1013 |
+
};
|
| 1014 |
+
|
| 1015 |
+
// Find the section containing the generated position we're trying to map
|
| 1016 |
+
// to an original position.
|
| 1017 |
+
var sectionIndex = binarySearch.search(needle, this._sections,
|
| 1018 |
+
function(needle, section) {
|
| 1019 |
+
var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
|
| 1020 |
+
if (cmp) {
|
| 1021 |
+
return cmp;
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
+
return (needle.generatedColumn -
|
| 1025 |
+
section.generatedOffset.generatedColumn);
|
| 1026 |
+
});
|
| 1027 |
+
var section = this._sections[sectionIndex];
|
| 1028 |
+
|
| 1029 |
+
if (!section) {
|
| 1030 |
+
return {
|
| 1031 |
+
source: null,
|
| 1032 |
+
line: null,
|
| 1033 |
+
column: null,
|
| 1034 |
+
name: null
|
| 1035 |
+
};
|
| 1036 |
+
}
|
| 1037 |
+
|
| 1038 |
+
return section.consumer.originalPositionFor({
|
| 1039 |
+
line: needle.generatedLine -
|
| 1040 |
+
(section.generatedOffset.generatedLine - 1),
|
| 1041 |
+
column: needle.generatedColumn -
|
| 1042 |
+
(section.generatedOffset.generatedLine === needle.generatedLine
|
| 1043 |
+
? section.generatedOffset.generatedColumn - 1
|
| 1044 |
+
: 0),
|
| 1045 |
+
bias: aArgs.bias
|
| 1046 |
+
});
|
| 1047 |
+
};
|
| 1048 |
+
|
| 1049 |
+
/**
|
| 1050 |
+
* Return true if we have the source content for every source in the source
|
| 1051 |
+
* map, false otherwise.
|
| 1052 |
+
*/
|
| 1053 |
+
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
|
| 1054 |
+
function IndexedSourceMapConsumer_hasContentsOfAllSources() {
|
| 1055 |
+
return this._sections.every(function (s) {
|
| 1056 |
+
return s.consumer.hasContentsOfAllSources();
|
| 1057 |
+
});
|
| 1058 |
+
};
|
| 1059 |
+
|
| 1060 |
+
/**
|
| 1061 |
+
* Returns the original source content. The only argument is the url of the
|
| 1062 |
+
* original source file. Returns null if no original source content is
|
| 1063 |
+
* available.
|
| 1064 |
+
*/
|
| 1065 |
+
IndexedSourceMapConsumer.prototype.sourceContentFor =
|
| 1066 |
+
function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
|
| 1067 |
+
for (var i = 0; i < this._sections.length; i++) {
|
| 1068 |
+
var section = this._sections[i];
|
| 1069 |
+
|
| 1070 |
+
var content = section.consumer.sourceContentFor(aSource, true);
|
| 1071 |
+
if (content || content === '') {
|
| 1072 |
+
return content;
|
| 1073 |
+
}
|
| 1074 |
+
}
|
| 1075 |
+
if (nullOnMissing) {
|
| 1076 |
+
return null;
|
| 1077 |
+
}
|
| 1078 |
+
else {
|
| 1079 |
+
throw new Error('"' + aSource + '" is not in the SourceMap.');
|
| 1080 |
+
}
|
| 1081 |
+
};
|
| 1082 |
+
|
| 1083 |
+
/**
|
| 1084 |
+
* Returns the generated line and column information for the original source,
|
| 1085 |
+
* line, and column positions provided. The only argument is an object with
|
| 1086 |
+
* the following properties:
|
| 1087 |
+
*
|
| 1088 |
+
* - source: The filename of the original source.
|
| 1089 |
+
* - line: The line number in the original source. The line number
|
| 1090 |
+
* is 1-based.
|
| 1091 |
+
* - column: The column number in the original source. The column
|
| 1092 |
+
* number is 0-based.
|
| 1093 |
+
*
|
| 1094 |
+
* and an object is returned with the following properties:
|
| 1095 |
+
*
|
| 1096 |
+
* - line: The line number in the generated source, or null. The
|
| 1097 |
+
* line number is 1-based.
|
| 1098 |
+
* - column: The column number in the generated source, or null.
|
| 1099 |
+
* The column number is 0-based.
|
| 1100 |
+
*/
|
| 1101 |
+
IndexedSourceMapConsumer.prototype.generatedPositionFor =
|
| 1102 |
+
function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
|
| 1103 |
+
for (var i = 0; i < this._sections.length; i++) {
|
| 1104 |
+
var section = this._sections[i];
|
| 1105 |
+
|
| 1106 |
+
// Only consider this section if the requested source is in the list of
|
| 1107 |
+
// sources of the consumer.
|
| 1108 |
+
if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
|
| 1109 |
+
continue;
|
| 1110 |
+
}
|
| 1111 |
+
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
| 1112 |
+
if (generatedPosition) {
|
| 1113 |
+
var ret = {
|
| 1114 |
+
line: generatedPosition.line +
|
| 1115 |
+
(section.generatedOffset.generatedLine - 1),
|
| 1116 |
+
column: generatedPosition.column +
|
| 1117 |
+
(section.generatedOffset.generatedLine === generatedPosition.line
|
| 1118 |
+
? section.generatedOffset.generatedColumn - 1
|
| 1119 |
+
: 0)
|
| 1120 |
+
};
|
| 1121 |
+
return ret;
|
| 1122 |
+
}
|
| 1123 |
+
}
|
| 1124 |
+
|
| 1125 |
+
return {
|
| 1126 |
+
line: null,
|
| 1127 |
+
column: null
|
| 1128 |
+
};
|
| 1129 |
+
};
|
| 1130 |
+
|
| 1131 |
+
/**
|
| 1132 |
+
* Parse the mappings in a string in to a data structure which we can easily
|
| 1133 |
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
| 1134 |
+
* `this.__originalMappings` properties).
|
| 1135 |
+
*/
|
| 1136 |
+
IndexedSourceMapConsumer.prototype._parseMappings =
|
| 1137 |
+
function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
|
| 1138 |
+
this.__generatedMappings = [];
|
| 1139 |
+
this.__originalMappings = [];
|
| 1140 |
+
for (var i = 0; i < this._sections.length; i++) {
|
| 1141 |
+
var section = this._sections[i];
|
| 1142 |
+
var sectionMappings = section.consumer._generatedMappings;
|
| 1143 |
+
for (var j = 0; j < sectionMappings.length; j++) {
|
| 1144 |
+
var mapping = sectionMappings[j];
|
| 1145 |
+
|
| 1146 |
+
var source = section.consumer._sources.at(mapping.source);
|
| 1147 |
+
if(source !== null) {
|
| 1148 |
+
source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
|
| 1149 |
+
}
|
| 1150 |
+
this._sources.add(source);
|
| 1151 |
+
source = this._sources.indexOf(source);
|
| 1152 |
+
|
| 1153 |
+
var name = null;
|
| 1154 |
+
if (mapping.name) {
|
| 1155 |
+
name = section.consumer._names.at(mapping.name);
|
| 1156 |
+
this._names.add(name);
|
| 1157 |
+
name = this._names.indexOf(name);
|
| 1158 |
+
}
|
| 1159 |
+
|
| 1160 |
+
// The mappings coming from the consumer for the section have
|
| 1161 |
+
// generated positions relative to the start of the section, so we
|
| 1162 |
+
// need to offset them to be relative to the start of the concatenated
|
| 1163 |
+
// generated file.
|
| 1164 |
+
var adjustedMapping = {
|
| 1165 |
+
source: source,
|
| 1166 |
+
generatedLine: mapping.generatedLine +
|
| 1167 |
+
(section.generatedOffset.generatedLine - 1),
|
| 1168 |
+
generatedColumn: mapping.generatedColumn +
|
| 1169 |
+
(section.generatedOffset.generatedLine === mapping.generatedLine
|
| 1170 |
+
? section.generatedOffset.generatedColumn - 1
|
| 1171 |
+
: 0),
|
| 1172 |
+
originalLine: mapping.originalLine,
|
| 1173 |
+
originalColumn: mapping.originalColumn,
|
| 1174 |
+
name: name
|
| 1175 |
+
};
|
| 1176 |
+
|
| 1177 |
+
this.__generatedMappings.push(adjustedMapping);
|
| 1178 |
+
if (typeof adjustedMapping.originalLine === 'number') {
|
| 1179 |
+
this.__originalMappings.push(adjustedMapping);
|
| 1180 |
+
}
|
| 1181 |
+
}
|
| 1182 |
+
}
|
| 1183 |
+
|
| 1184 |
+
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
|
| 1185 |
+
quickSort(this.__originalMappings, util.compareByOriginalPositions);
|
| 1186 |
+
};
|
| 1187 |
+
|
| 1188 |
+
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-generator.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export { SourceMapGenerator } from '..';
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/source-map-generator.js
ADDED
|
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
| 2 |
+
/*
|
| 3 |
+
* Copyright 2011 Mozilla Foundation and contributors
|
| 4 |
+
* Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
var base64VLQ = require('./base64-vlq');
|
| 9 |
+
var util = require('./util');
|
| 10 |
+
var ArraySet = require('./array-set').ArraySet;
|
| 11 |
+
var MappingList = require('./mapping-list').MappingList;
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* An instance of the SourceMapGenerator represents a source map which is
|
| 15 |
+
* being built incrementally. You may pass an object with the following
|
| 16 |
+
* properties:
|
| 17 |
+
*
|
| 18 |
+
* - file: The filename of the generated source.
|
| 19 |
+
* - sourceRoot: A root for all relative URLs in this source map.
|
| 20 |
+
*/
|
| 21 |
+
function SourceMapGenerator(aArgs) {
|
| 22 |
+
if (!aArgs) {
|
| 23 |
+
aArgs = {};
|
| 24 |
+
}
|
| 25 |
+
this._file = util.getArg(aArgs, 'file', null);
|
| 26 |
+
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
|
| 27 |
+
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
|
| 28 |
+
this._ignoreInvalidMapping = util.getArg(aArgs, 'ignoreInvalidMapping', false);
|
| 29 |
+
this._sources = new ArraySet();
|
| 30 |
+
this._names = new ArraySet();
|
| 31 |
+
this._mappings = new MappingList();
|
| 32 |
+
this._sourcesContents = null;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
SourceMapGenerator.prototype._version = 3;
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
| 39 |
+
*
|
| 40 |
+
* @param aSourceMapConsumer The SourceMap.
|
| 41 |
+
*/
|
| 42 |
+
SourceMapGenerator.fromSourceMap =
|
| 43 |
+
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
|
| 44 |
+
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
| 45 |
+
var generator = new SourceMapGenerator(Object.assign(generatorOps || {}, {
|
| 46 |
+
file: aSourceMapConsumer.file,
|
| 47 |
+
sourceRoot: sourceRoot
|
| 48 |
+
}));
|
| 49 |
+
aSourceMapConsumer.eachMapping(function (mapping) {
|
| 50 |
+
var newMapping = {
|
| 51 |
+
generated: {
|
| 52 |
+
line: mapping.generatedLine,
|
| 53 |
+
column: mapping.generatedColumn
|
| 54 |
+
}
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
if (mapping.source != null) {
|
| 58 |
+
newMapping.source = mapping.source;
|
| 59 |
+
if (sourceRoot != null) {
|
| 60 |
+
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
newMapping.original = {
|
| 64 |
+
line: mapping.originalLine,
|
| 65 |
+
column: mapping.originalColumn
|
| 66 |
+
};
|
| 67 |
+
|
| 68 |
+
if (mapping.name != null) {
|
| 69 |
+
newMapping.name = mapping.name;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
generator.addMapping(newMapping);
|
| 74 |
+
});
|
| 75 |
+
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
| 76 |
+
var sourceRelative = sourceFile;
|
| 77 |
+
if (sourceRoot !== null) {
|
| 78 |
+
sourceRelative = util.relative(sourceRoot, sourceFile);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
if (!generator._sources.has(sourceRelative)) {
|
| 82 |
+
generator._sources.add(sourceRelative);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
| 86 |
+
if (content != null) {
|
| 87 |
+
generator.setSourceContent(sourceFile, content);
|
| 88 |
+
}
|
| 89 |
+
});
|
| 90 |
+
return generator;
|
| 91 |
+
};
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* Add a single mapping from original source line and column to the generated
|
| 95 |
+
* source's line and column for this source map being created. The mapping
|
| 96 |
+
* object should have the following properties:
|
| 97 |
+
*
|
| 98 |
+
* - generated: An object with the generated line and column positions.
|
| 99 |
+
* - original: An object with the original line and column positions.
|
| 100 |
+
* - source: The original source file (relative to the sourceRoot).
|
| 101 |
+
* - name: An optional original token name for this mapping.
|
| 102 |
+
*/
|
| 103 |
+
SourceMapGenerator.prototype.addMapping =
|
| 104 |
+
function SourceMapGenerator_addMapping(aArgs) {
|
| 105 |
+
var generated = util.getArg(aArgs, 'generated');
|
| 106 |
+
var original = util.getArg(aArgs, 'original', null);
|
| 107 |
+
var source = util.getArg(aArgs, 'source', null);
|
| 108 |
+
var name = util.getArg(aArgs, 'name', null);
|
| 109 |
+
|
| 110 |
+
if (!this._skipValidation) {
|
| 111 |
+
if (this._validateMapping(generated, original, source, name) === false) {
|
| 112 |
+
return;
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
if (source != null) {
|
| 117 |
+
source = String(source);
|
| 118 |
+
if (!this._sources.has(source)) {
|
| 119 |
+
this._sources.add(source);
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
if (name != null) {
|
| 124 |
+
name = String(name);
|
| 125 |
+
if (!this._names.has(name)) {
|
| 126 |
+
this._names.add(name);
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
this._mappings.add({
|
| 131 |
+
generatedLine: generated.line,
|
| 132 |
+
generatedColumn: generated.column,
|
| 133 |
+
originalLine: original != null && original.line,
|
| 134 |
+
originalColumn: original != null && original.column,
|
| 135 |
+
source: source,
|
| 136 |
+
name: name
|
| 137 |
+
});
|
| 138 |
+
};
|
| 139 |
+
|
| 140 |
+
/**
|
| 141 |
+
* Set the source content for a source file.
|
| 142 |
+
*/
|
| 143 |
+
SourceMapGenerator.prototype.setSourceContent =
|
| 144 |
+
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
|
| 145 |
+
var source = aSourceFile;
|
| 146 |
+
if (this._sourceRoot != null) {
|
| 147 |
+
source = util.relative(this._sourceRoot, source);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
if (aSourceContent != null) {
|
| 151 |
+
// Add the source content to the _sourcesContents map.
|
| 152 |
+
// Create a new _sourcesContents map if the property is null.
|
| 153 |
+
if (!this._sourcesContents) {
|
| 154 |
+
this._sourcesContents = Object.create(null);
|
| 155 |
+
}
|
| 156 |
+
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
| 157 |
+
} else if (this._sourcesContents) {
|
| 158 |
+
// Remove the source file from the _sourcesContents map.
|
| 159 |
+
// If the _sourcesContents map is empty, set the property to null.
|
| 160 |
+
delete this._sourcesContents[util.toSetString(source)];
|
| 161 |
+
if (Object.keys(this._sourcesContents).length === 0) {
|
| 162 |
+
this._sourcesContents = null;
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
};
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* Applies the mappings of a sub-source-map for a specific source file to the
|
| 169 |
+
* source map being generated. Each mapping to the supplied source file is
|
| 170 |
+
* rewritten using the supplied source map. Note: The resolution for the
|
| 171 |
+
* resulting mappings is the minimium of this map and the supplied map.
|
| 172 |
+
*
|
| 173 |
+
* @param aSourceMapConsumer The source map to be applied.
|
| 174 |
+
* @param aSourceFile Optional. The filename of the source file.
|
| 175 |
+
* If omitted, SourceMapConsumer's file property will be used.
|
| 176 |
+
* @param aSourceMapPath Optional. The dirname of the path to the source map
|
| 177 |
+
* to be applied. If relative, it is relative to the SourceMapConsumer.
|
| 178 |
+
* This parameter is needed when the two source maps aren't in the same
|
| 179 |
+
* directory, and the source map to be applied contains relative source
|
| 180 |
+
* paths. If so, those relative source paths need to be rewritten
|
| 181 |
+
* relative to the SourceMapGenerator.
|
| 182 |
+
*/
|
| 183 |
+
SourceMapGenerator.prototype.applySourceMap =
|
| 184 |
+
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
|
| 185 |
+
var sourceFile = aSourceFile;
|
| 186 |
+
// If aSourceFile is omitted, we will use the file property of the SourceMap
|
| 187 |
+
if (aSourceFile == null) {
|
| 188 |
+
if (aSourceMapConsumer.file == null) {
|
| 189 |
+
throw new Error(
|
| 190 |
+
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
|
| 191 |
+
'or the source map\'s "file" property. Both were omitted.'
|
| 192 |
+
);
|
| 193 |
+
}
|
| 194 |
+
sourceFile = aSourceMapConsumer.file;
|
| 195 |
+
}
|
| 196 |
+
var sourceRoot = this._sourceRoot;
|
| 197 |
+
// Make "sourceFile" relative if an absolute Url is passed.
|
| 198 |
+
if (sourceRoot != null) {
|
| 199 |
+
sourceFile = util.relative(sourceRoot, sourceFile);
|
| 200 |
+
}
|
| 201 |
+
// Applying the SourceMap can add and remove items from the sources and
|
| 202 |
+
// the names array.
|
| 203 |
+
var newSources = new ArraySet();
|
| 204 |
+
var newNames = new ArraySet();
|
| 205 |
+
|
| 206 |
+
// Find mappings for the "sourceFile"
|
| 207 |
+
this._mappings.unsortedForEach(function (mapping) {
|
| 208 |
+
if (mapping.source === sourceFile && mapping.originalLine != null) {
|
| 209 |
+
// Check if it can be mapped by the source map, then update the mapping.
|
| 210 |
+
var original = aSourceMapConsumer.originalPositionFor({
|
| 211 |
+
line: mapping.originalLine,
|
| 212 |
+
column: mapping.originalColumn
|
| 213 |
+
});
|
| 214 |
+
if (original.source != null) {
|
| 215 |
+
// Copy mapping
|
| 216 |
+
mapping.source = original.source;
|
| 217 |
+
if (aSourceMapPath != null) {
|
| 218 |
+
mapping.source = util.join(aSourceMapPath, mapping.source)
|
| 219 |
+
}
|
| 220 |
+
if (sourceRoot != null) {
|
| 221 |
+
mapping.source = util.relative(sourceRoot, mapping.source);
|
| 222 |
+
}
|
| 223 |
+
mapping.originalLine = original.line;
|
| 224 |
+
mapping.originalColumn = original.column;
|
| 225 |
+
if (original.name != null) {
|
| 226 |
+
mapping.name = original.name;
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
var source = mapping.source;
|
| 232 |
+
if (source != null && !newSources.has(source)) {
|
| 233 |
+
newSources.add(source);
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
var name = mapping.name;
|
| 237 |
+
if (name != null && !newNames.has(name)) {
|
| 238 |
+
newNames.add(name);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
}, this);
|
| 242 |
+
this._sources = newSources;
|
| 243 |
+
this._names = newNames;
|
| 244 |
+
|
| 245 |
+
// Copy sourcesContents of applied map.
|
| 246 |
+
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
| 247 |
+
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
| 248 |
+
if (content != null) {
|
| 249 |
+
if (aSourceMapPath != null) {
|
| 250 |
+
sourceFile = util.join(aSourceMapPath, sourceFile);
|
| 251 |
+
}
|
| 252 |
+
if (sourceRoot != null) {
|
| 253 |
+
sourceFile = util.relative(sourceRoot, sourceFile);
|
| 254 |
+
}
|
| 255 |
+
this.setSourceContent(sourceFile, content);
|
| 256 |
+
}
|
| 257 |
+
}, this);
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
/**
|
| 261 |
+
* A mapping can have one of the three levels of data:
|
| 262 |
+
*
|
| 263 |
+
* 1. Just the generated position.
|
| 264 |
+
* 2. The Generated position, original position, and original source.
|
| 265 |
+
* 3. Generated and original position, original source, as well as a name
|
| 266 |
+
* token.
|
| 267 |
+
*
|
| 268 |
+
* To maintain consistency, we validate that any new mapping being added falls
|
| 269 |
+
* in to one of these categories.
|
| 270 |
+
*/
|
| 271 |
+
SourceMapGenerator.prototype._validateMapping =
|
| 272 |
+
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
|
| 273 |
+
aName) {
|
| 274 |
+
// When aOriginal is truthy but has empty values for .line and .column,
|
| 275 |
+
// it is most likely a programmer error. In this case we throw a very
|
| 276 |
+
// specific error message to try to guide them the right way.
|
| 277 |
+
// For example: https://github.com/Polymer/polymer-bundler/pull/519
|
| 278 |
+
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
|
| 279 |
+
var message = 'original.line and original.column are not numbers -- you probably meant to omit ' +
|
| 280 |
+
'the original mapping entirely and only map the generated position. If so, pass ' +
|
| 281 |
+
'null for the original mapping instead of an object with empty or null values.'
|
| 282 |
+
|
| 283 |
+
if (this._ignoreInvalidMapping) {
|
| 284 |
+
if (typeof console !== 'undefined' && console.warn) {
|
| 285 |
+
console.warn(message);
|
| 286 |
+
}
|
| 287 |
+
return false;
|
| 288 |
+
} else {
|
| 289 |
+
throw new Error(message);
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
| 294 |
+
&& aGenerated.line > 0 && aGenerated.column >= 0
|
| 295 |
+
&& !aOriginal && !aSource && !aName) {
|
| 296 |
+
// Case 1.
|
| 297 |
+
return;
|
| 298 |
+
}
|
| 299 |
+
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
| 300 |
+
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
|
| 301 |
+
&& aGenerated.line > 0 && aGenerated.column >= 0
|
| 302 |
+
&& aOriginal.line > 0 && aOriginal.column >= 0
|
| 303 |
+
&& aSource) {
|
| 304 |
+
// Cases 2 and 3.
|
| 305 |
+
return;
|
| 306 |
+
}
|
| 307 |
+
else {
|
| 308 |
+
var message = 'Invalid mapping: ' + JSON.stringify({
|
| 309 |
+
generated: aGenerated,
|
| 310 |
+
source: aSource,
|
| 311 |
+
original: aOriginal,
|
| 312 |
+
name: aName
|
| 313 |
+
});
|
| 314 |
+
|
| 315 |
+
if (this._ignoreInvalidMapping) {
|
| 316 |
+
if (typeof console !== 'undefined' && console.warn) {
|
| 317 |
+
console.warn(message);
|
| 318 |
+
}
|
| 319 |
+
return false;
|
| 320 |
+
} else {
|
| 321 |
+
throw new Error(message)
|
| 322 |
+
}
|
| 323 |
+
}
|
| 324 |
+
};
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
* Serialize the accumulated mappings in to the stream of base 64 VLQs
|
| 328 |
+
* specified by the source map format.
|
| 329 |
+
*/
|
| 330 |
+
SourceMapGenerator.prototype._serializeMappings =
|
| 331 |
+
function SourceMapGenerator_serializeMappings() {
|
| 332 |
+
var previousGeneratedColumn = 0;
|
| 333 |
+
var previousGeneratedLine = 1;
|
| 334 |
+
var previousOriginalColumn = 0;
|
| 335 |
+
var previousOriginalLine = 0;
|
| 336 |
+
var previousName = 0;
|
| 337 |
+
var previousSource = 0;
|
| 338 |
+
var result = '';
|
| 339 |
+
var next;
|
| 340 |
+
var mapping;
|
| 341 |
+
var nameIdx;
|
| 342 |
+
var sourceIdx;
|
| 343 |
+
|
| 344 |
+
var mappings = this._mappings.toArray();
|
| 345 |
+
for (var i = 0, len = mappings.length; i < len; i++) {
|
| 346 |
+
mapping = mappings[i];
|
| 347 |
+
next = ''
|
| 348 |
+
|
| 349 |
+
if (mapping.generatedLine !== previousGeneratedLine) {
|
| 350 |
+
previousGeneratedColumn = 0;
|
| 351 |
+
while (mapping.generatedLine !== previousGeneratedLine) {
|
| 352 |
+
next += ';';
|
| 353 |
+
previousGeneratedLine++;
|
| 354 |
+
}
|
| 355 |
+
}
|
| 356 |
+
else {
|
| 357 |
+
if (i > 0) {
|
| 358 |
+
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
|
| 359 |
+
continue;
|
| 360 |
+
}
|
| 361 |
+
next += ',';
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
next += base64VLQ.encode(mapping.generatedColumn
|
| 366 |
+
- previousGeneratedColumn);
|
| 367 |
+
previousGeneratedColumn = mapping.generatedColumn;
|
| 368 |
+
|
| 369 |
+
if (mapping.source != null) {
|
| 370 |
+
sourceIdx = this._sources.indexOf(mapping.source);
|
| 371 |
+
next += base64VLQ.encode(sourceIdx - previousSource);
|
| 372 |
+
previousSource = sourceIdx;
|
| 373 |
+
|
| 374 |
+
// lines are stored 0-based in SourceMap spec version 3
|
| 375 |
+
next += base64VLQ.encode(mapping.originalLine - 1
|
| 376 |
+
- previousOriginalLine);
|
| 377 |
+
previousOriginalLine = mapping.originalLine - 1;
|
| 378 |
+
|
| 379 |
+
next += base64VLQ.encode(mapping.originalColumn
|
| 380 |
+
- previousOriginalColumn);
|
| 381 |
+
previousOriginalColumn = mapping.originalColumn;
|
| 382 |
+
|
| 383 |
+
if (mapping.name != null) {
|
| 384 |
+
nameIdx = this._names.indexOf(mapping.name);
|
| 385 |
+
next += base64VLQ.encode(nameIdx - previousName);
|
| 386 |
+
previousName = nameIdx;
|
| 387 |
+
}
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
result += next;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
return result;
|
| 394 |
+
};
|
| 395 |
+
|
| 396 |
+
SourceMapGenerator.prototype._generateSourcesContent =
|
| 397 |
+
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
|
| 398 |
+
return aSources.map(function (source) {
|
| 399 |
+
if (!this._sourcesContents) {
|
| 400 |
+
return null;
|
| 401 |
+
}
|
| 402 |
+
if (aSourceRoot != null) {
|
| 403 |
+
source = util.relative(aSourceRoot, source);
|
| 404 |
+
}
|
| 405 |
+
var key = util.toSetString(source);
|
| 406 |
+
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
|
| 407 |
+
? this._sourcesContents[key]
|
| 408 |
+
: null;
|
| 409 |
+
}, this);
|
| 410 |
+
};
|
| 411 |
+
|
| 412 |
+
/**
|
| 413 |
+
* Externalize the source map.
|
| 414 |
+
*/
|
| 415 |
+
SourceMapGenerator.prototype.toJSON =
|
| 416 |
+
function SourceMapGenerator_toJSON() {
|
| 417 |
+
var map = {
|
| 418 |
+
version: this._version,
|
| 419 |
+
sources: this._sources.toArray(),
|
| 420 |
+
names: this._names.toArray(),
|
| 421 |
+
mappings: this._serializeMappings()
|
| 422 |
+
};
|
| 423 |
+
if (this._file != null) {
|
| 424 |
+
map.file = this._file;
|
| 425 |
+
}
|
| 426 |
+
if (this._sourceRoot != null) {
|
| 427 |
+
map.sourceRoot = this._sourceRoot;
|
| 428 |
+
}
|
| 429 |
+
if (this._sourcesContents) {
|
| 430 |
+
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
return map;
|
| 434 |
+
};
|
| 435 |
+
|
| 436 |
+
/**
|
| 437 |
+
* Render the source map being generated to a string.
|
| 438 |
+
*/
|
| 439 |
+
SourceMapGenerator.prototype.toString =
|
| 440 |
+
function SourceMapGenerator_toString() {
|
| 441 |
+
return JSON.stringify(this.toJSON());
|
| 442 |
+
};
|
| 443 |
+
|
| 444 |
+
exports.SourceMapGenerator = SourceMapGenerator;
|
loan-advisor-chatgpt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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
| 2 |
+
/*
|
| 3 |
+
* Copyright 2011 Mozilla Foundation and contributors
|
| 4 |
+
* Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
|
| 9 |
+
var util = require('./util');
|
| 10 |
+
|
| 11 |
+
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
|
| 12 |
+
// operating systems these days (capturing the result).
|
| 13 |
+
var REGEX_NEWLINE = /(\r?\n)/;
|
| 14 |
+
|
| 15 |
+
// Newline character code for charCodeAt() comparisons
|
| 16 |
+
var NEWLINE_CODE = 10;
|
| 17 |
+
|
| 18 |
+
// Private symbol for identifying `SourceNode`s when multiple versions of
|
| 19 |
+
// the source-map library are loaded. This MUST NOT CHANGE across
|
| 20 |
+
// versions!
|
| 21 |
+
var isSourceNode = "$$$isSourceNode$$$";
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* SourceNodes provide a way to abstract over interpolating/concatenating
|
| 25 |
+
* snippets of generated JavaScript source code while maintaining the line and
|
| 26 |
+
* column information associated with the original source code.
|
| 27 |
+
*
|
| 28 |
+
* @param aLine The original line number.
|
| 29 |
+
* @param aColumn The original column number.
|
| 30 |
+
* @param aSource The original source's filename.
|
| 31 |
+
* @param aChunks Optional. An array of strings which are snippets of
|
| 32 |
+
* generated JS, or other SourceNodes.
|
| 33 |
+
* @param aName The original identifier.
|
| 34 |
+
*/
|
| 35 |
+
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
|
| 36 |
+
this.children = [];
|
| 37 |
+
this.sourceContents = {};
|
| 38 |
+
this.line = aLine == null ? null : aLine;
|
| 39 |
+
this.column = aColumn == null ? null : aColumn;
|
| 40 |
+
this.source = aSource == null ? null : aSource;
|
| 41 |
+
this.name = aName == null ? null : aName;
|
| 42 |
+
this[isSourceNode] = true;
|
| 43 |
+
if (aChunks != null) this.add(aChunks);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Creates a SourceNode from generated code and a SourceMapConsumer.
|
| 48 |
+
*
|
| 49 |
+
* @param aGeneratedCode The generated code
|
| 50 |
+
* @param aSourceMapConsumer The SourceMap for the generated code
|
| 51 |
+
* @param aRelativePath Optional. The path that relative sources in the
|
| 52 |
+
* SourceMapConsumer should be relative to.
|
| 53 |
+
*/
|
| 54 |
+
SourceNode.fromStringWithSourceMap =
|
| 55 |
+
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
|
| 56 |
+
// The SourceNode we want to fill with the generated code
|
| 57 |
+
// and the SourceMap
|
| 58 |
+
var node = new SourceNode();
|
| 59 |
+
|
| 60 |
+
// All even indices of this array are one line of the generated code,
|
| 61 |
+
// while all odd indices are the newlines between two adjacent lines
|
| 62 |
+
// (since `REGEX_NEWLINE` captures its match).
|
| 63 |
+
// Processed fragments are accessed by calling `shiftNextLine`.
|
| 64 |
+
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
|
| 65 |
+
var remainingLinesIndex = 0;
|
| 66 |
+
var shiftNextLine = function() {
|
| 67 |
+
var lineContents = getNextLine();
|
| 68 |
+
// The last line of a file might not have a newline.
|
| 69 |
+
var newLine = getNextLine() || "";
|
| 70 |
+
return lineContents + newLine;
|
| 71 |
+
|
| 72 |
+
function getNextLine() {
|
| 73 |
+
return remainingLinesIndex < remainingLines.length ?
|
| 74 |
+
remainingLines[remainingLinesIndex++] : undefined;
|
| 75 |
+
}
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
// We need to remember the position of "remainingLines"
|
| 79 |
+
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
| 80 |
+
|
| 81 |
+
// The generate SourceNodes we need a code range.
|
| 82 |
+
// To extract it current and last mapping is used.
|
| 83 |
+
// Here we store the last mapping.
|
| 84 |
+
var lastMapping = null;
|
| 85 |
+
|
| 86 |
+
aSourceMapConsumer.eachMapping(function (mapping) {
|
| 87 |
+
if (lastMapping !== null) {
|
| 88 |
+
// We add the code from "lastMapping" to "mapping":
|
| 89 |
+
// First check if there is a new line in between.
|
| 90 |
+
if (lastGeneratedLine < mapping.generatedLine) {
|
| 91 |
+
// Associate first line with "lastMapping"
|
| 92 |
+
addMappingWithCode(lastMapping, shiftNextLine());
|
| 93 |
+
lastGeneratedLine++;
|
| 94 |
+
lastGeneratedColumn = 0;
|
| 95 |
+
// The remaining code is added without mapping
|
| 96 |
+
} else {
|
| 97 |
+
// There is no new line in between.
|
| 98 |
+
// Associate the code between "lastGeneratedColumn" and
|
| 99 |
+
// "mapping.generatedColumn" with "lastMapping"
|
| 100 |
+
var nextLine = remainingLines[remainingLinesIndex] || '';
|
| 101 |
+
var code = nextLine.substr(0, mapping.generatedColumn -
|
| 102 |
+
lastGeneratedColumn);
|
| 103 |
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
|
| 104 |
+
lastGeneratedColumn);
|
| 105 |
+
lastGeneratedColumn = mapping.generatedColumn;
|
| 106 |
+
addMappingWithCode(lastMapping, code);
|
| 107 |
+
// No more remaining code, continue
|
| 108 |
+
lastMapping = mapping;
|
| 109 |
+
return;
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
// We add the generated code until the first mapping
|
| 113 |
+
// to the SourceNode without any mapping.
|
| 114 |
+
// Each line is added as separate string.
|
| 115 |
+
while (lastGeneratedLine < mapping.generatedLine) {
|
| 116 |
+
node.add(shiftNextLine());
|
| 117 |
+
lastGeneratedLine++;
|
| 118 |
+
}
|
| 119 |
+
if (lastGeneratedColumn < mapping.generatedColumn) {
|
| 120 |
+
var nextLine = remainingLines[remainingLinesIndex] || '';
|
| 121 |
+
node.add(nextLine.substr(0, mapping.generatedColumn));
|
| 122 |
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
|
| 123 |
+
lastGeneratedColumn = mapping.generatedColumn;
|
| 124 |
+
}
|
| 125 |
+
lastMapping = mapping;
|
| 126 |
+
}, this);
|
| 127 |
+
// We have processed all mappings.
|
| 128 |
+
if (remainingLinesIndex < remainingLines.length) {
|
| 129 |
+
if (lastMapping) {
|
| 130 |
+
// Associate the remaining code in the current line with "lastMapping"
|
| 131 |
+
addMappingWithCode(lastMapping, shiftNextLine());
|
| 132 |
+
}
|
| 133 |
+
// and add the remaining lines without any mapping
|
| 134 |
+
node.add(remainingLines.splice(remainingLinesIndex).join(""));
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
// Copy sourcesContent into SourceNode
|
| 138 |
+
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
| 139 |
+
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
| 140 |
+
if (content != null) {
|
| 141 |
+
if (aRelativePath != null) {
|
| 142 |
+
sourceFile = util.join(aRelativePath, sourceFile);
|
| 143 |
+
}
|
| 144 |
+
node.setSourceContent(sourceFile, content);
|
| 145 |
+
}
|
| 146 |
+
});
|
| 147 |
+
|
| 148 |
+
return node;
|
| 149 |
+
|
| 150 |
+
function addMappingWithCode(mapping, code) {
|
| 151 |
+
if (mapping === null || mapping.source === undefined) {
|
| 152 |
+
node.add(code);
|
| 153 |
+
} else {
|
| 154 |
+
var source = aRelativePath
|
| 155 |
+
? util.join(aRelativePath, mapping.source)
|
| 156 |
+
: mapping.source;
|
| 157 |
+
node.add(new SourceNode(mapping.originalLine,
|
| 158 |
+
mapping.originalColumn,
|
| 159 |
+
source,
|
| 160 |
+
code,
|
| 161 |
+
mapping.name));
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
};
|
| 165 |
+
|
| 166 |
+
/**
|
| 167 |
+
* Add a chunk of generated JS to this source node.
|
| 168 |
+
*
|
| 169 |
+
* @param aChunk A string snippet of generated JS code, another instance of
|
| 170 |
+
* SourceNode, or an array where each member is one of those things.
|
| 171 |
+
*/
|
| 172 |
+
SourceNode.prototype.add = function SourceNode_add(aChunk) {
|
| 173 |
+
if (Array.isArray(aChunk)) {
|
| 174 |
+
aChunk.forEach(function (chunk) {
|
| 175 |
+
this.add(chunk);
|
| 176 |
+
}, this);
|
| 177 |
+
}
|
| 178 |
+
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
| 179 |
+
if (aChunk) {
|
| 180 |
+
this.children.push(aChunk);
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
else {
|
| 184 |
+
throw new TypeError(
|
| 185 |
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
| 186 |
+
);
|
| 187 |
+
}
|
| 188 |
+
return this;
|
| 189 |
+
};
|
| 190 |
+
|
| 191 |
+
/**
|
| 192 |
+
* Add a chunk of generated JS to the beginning of this source node.
|
| 193 |
+
*
|
| 194 |
+
* @param aChunk A string snippet of generated JS code, another instance of
|
| 195 |
+
* SourceNode, or an array where each member is one of those things.
|
| 196 |
+
*/
|
| 197 |
+
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
|
| 198 |
+
if (Array.isArray(aChunk)) {
|
| 199 |
+
for (var i = aChunk.length-1; i >= 0; i--) {
|
| 200 |
+
this.prepend(aChunk[i]);
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
| 204 |
+
this.children.unshift(aChunk);
|
| 205 |
+
}
|
| 206 |
+
else {
|
| 207 |
+
throw new TypeError(
|
| 208 |
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
| 209 |
+
);
|
| 210 |
+
}
|
| 211 |
+
return this;
|
| 212 |
+
};
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* Walk over the tree of JS snippets in this node and its children. The
|
| 216 |
+
* walking function is called once for each snippet of JS and is passed that
|
| 217 |
+
* snippet and the its original associated source's line/column location.
|
| 218 |
+
*
|
| 219 |
+
* @param aFn The traversal function.
|
| 220 |
+
*/
|
| 221 |
+
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
|
| 222 |
+
var chunk;
|
| 223 |
+
for (var i = 0, len = this.children.length; i < len; i++) {
|
| 224 |
+
chunk = this.children[i];
|
| 225 |
+
if (chunk[isSourceNode]) {
|
| 226 |
+
chunk.walk(aFn);
|
| 227 |
+
}
|
| 228 |
+
else {
|
| 229 |
+
if (chunk !== '') {
|
| 230 |
+
aFn(chunk, { source: this.source,
|
| 231 |
+
line: this.line,
|
| 232 |
+
column: this.column,
|
| 233 |
+
name: this.name });
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
}
|
| 237 |
+
};
|
| 238 |
+
|
| 239 |
+
/**
|
| 240 |
+
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
|
| 241 |
+
* each of `this.children`.
|
| 242 |
+
*
|
| 243 |
+
* @param aSep The separator.
|
| 244 |
+
*/
|
| 245 |
+
SourceNode.prototype.join = function SourceNode_join(aSep) {
|
| 246 |
+
var newChildren;
|
| 247 |
+
var i;
|
| 248 |
+
var len = this.children.length;
|
| 249 |
+
if (len > 0) {
|
| 250 |
+
newChildren = [];
|
| 251 |
+
for (i = 0; i < len-1; i++) {
|
| 252 |
+
newChildren.push(this.children[i]);
|
| 253 |
+
newChildren.push(aSep);
|
| 254 |
+
}
|
| 255 |
+
newChildren.push(this.children[i]);
|
| 256 |
+
this.children = newChildren;
|
| 257 |
+
}
|
| 258 |
+
return this;
|
| 259 |
+
};
|
| 260 |
+
|
| 261 |
+
/**
|
| 262 |
+
* Call String.prototype.replace on the very right-most source snippet. Useful
|
| 263 |
+
* for trimming whitespace from the end of a source node, etc.
|
| 264 |
+
*
|
| 265 |
+
* @param aPattern The pattern to replace.
|
| 266 |
+
* @param aReplacement The thing to replace the pattern with.
|
| 267 |
+
*/
|
| 268 |
+
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
|
| 269 |
+
var lastChild = this.children[this.children.length - 1];
|
| 270 |
+
if (lastChild[isSourceNode]) {
|
| 271 |
+
lastChild.replaceRight(aPattern, aReplacement);
|
| 272 |
+
}
|
| 273 |
+
else if (typeof lastChild === 'string') {
|
| 274 |
+
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
|
| 275 |
+
}
|
| 276 |
+
else {
|
| 277 |
+
this.children.push(''.replace(aPattern, aReplacement));
|
| 278 |
+
}
|
| 279 |
+
return this;
|
| 280 |
+
};
|
| 281 |
+
|
| 282 |
+
/**
|
| 283 |
+
* Set the source content for a source file. This will be added to the SourceMapGenerator
|
| 284 |
+
* in the sourcesContent field.
|
| 285 |
+
*
|
| 286 |
+
* @param aSourceFile The filename of the source file
|
| 287 |
+
* @param aSourceContent The content of the source file
|
| 288 |
+
*/
|
| 289 |
+
SourceNode.prototype.setSourceContent =
|
| 290 |
+
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
|
| 291 |
+
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
|
| 292 |
+
};
|
| 293 |
+
|
| 294 |
+
/**
|
| 295 |
+
* Walk over the tree of SourceNodes. The walking function is called for each
|
| 296 |
+
* source file content and is passed the filename and source content.
|
| 297 |
+
*
|
| 298 |
+
* @param aFn The traversal function.
|
| 299 |
+
*/
|
| 300 |
+
SourceNode.prototype.walkSourceContents =
|
| 301 |
+
function SourceNode_walkSourceContents(aFn) {
|
| 302 |
+
for (var i = 0, len = this.children.length; i < len; i++) {
|
| 303 |
+
if (this.children[i][isSourceNode]) {
|
| 304 |
+
this.children[i].walkSourceContents(aFn);
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
var sources = Object.keys(this.sourceContents);
|
| 309 |
+
for (var i = 0, len = sources.length; i < len; i++) {
|
| 310 |
+
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
|
| 311 |
+
}
|
| 312 |
+
};
|
| 313 |
+
|
| 314 |
+
/**
|
| 315 |
+
* Return the string representation of this source node. Walks over the tree
|
| 316 |
+
* and concatenates all the various snippets together to one string.
|
| 317 |
+
*/
|
| 318 |
+
SourceNode.prototype.toString = function SourceNode_toString() {
|
| 319 |
+
var str = "";
|
| 320 |
+
this.walk(function (chunk) {
|
| 321 |
+
str += chunk;
|
| 322 |
+
});
|
| 323 |
+
return str;
|
| 324 |
+
};
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
* Returns the string representation of this source node along with a source
|
| 328 |
+
* map.
|
| 329 |
+
*/
|
| 330 |
+
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
|
| 331 |
+
var generated = {
|
| 332 |
+
code: "",
|
| 333 |
+
line: 1,
|
| 334 |
+
column: 0
|
| 335 |
+
};
|
| 336 |
+
var map = new SourceMapGenerator(aArgs);
|
| 337 |
+
var sourceMappingActive = false;
|
| 338 |
+
var lastOriginalSource = null;
|
| 339 |
+
var lastOriginalLine = null;
|
| 340 |
+
var lastOriginalColumn = null;
|
| 341 |
+
var lastOriginalName = null;
|
| 342 |
+
this.walk(function (chunk, original) {
|
| 343 |
+
generated.code += chunk;
|
| 344 |
+
if (original.source !== null
|
| 345 |
+
&& original.line !== null
|
| 346 |
+
&& original.column !== null) {
|
| 347 |
+
if(lastOriginalSource !== original.source
|
| 348 |
+
|| lastOriginalLine !== original.line
|
| 349 |
+
|| lastOriginalColumn !== original.column
|
| 350 |
+
|| lastOriginalName !== original.name) {
|
| 351 |
+
map.addMapping({
|
| 352 |
+
source: original.source,
|
| 353 |
+
original: {
|
| 354 |
+
line: original.line,
|
| 355 |
+
column: original.column
|
| 356 |
+
},
|
| 357 |
+
generated: {
|
| 358 |
+
line: generated.line,
|
| 359 |
+
column: generated.column
|
| 360 |
+
},
|
| 361 |
+
name: original.name
|
| 362 |
+
});
|
| 363 |
+
}
|
| 364 |
+
lastOriginalSource = original.source;
|
| 365 |
+
lastOriginalLine = original.line;
|
| 366 |
+
lastOriginalColumn = original.column;
|
| 367 |
+
lastOriginalName = original.name;
|
| 368 |
+
sourceMappingActive = true;
|
| 369 |
+
} else if (sourceMappingActive) {
|
| 370 |
+
map.addMapping({
|
| 371 |
+
generated: {
|
| 372 |
+
line: generated.line,
|
| 373 |
+
column: generated.column
|
| 374 |
+
}
|
| 375 |
+
});
|
| 376 |
+
lastOriginalSource = null;
|
| 377 |
+
sourceMappingActive = false;
|
| 378 |
+
}
|
| 379 |
+
for (var idx = 0, length = chunk.length; idx < length; idx++) {
|
| 380 |
+
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
|
| 381 |
+
generated.line++;
|
| 382 |
+
generated.column = 0;
|
| 383 |
+
// Mappings end at eol
|
| 384 |
+
if (idx + 1 === length) {
|
| 385 |
+
lastOriginalSource = null;
|
| 386 |
+
sourceMappingActive = false;
|
| 387 |
+
} else if (sourceMappingActive) {
|
| 388 |
+
map.addMapping({
|
| 389 |
+
source: original.source,
|
| 390 |
+
original: {
|
| 391 |
+
line: original.line,
|
| 392 |
+
column: original.column
|
| 393 |
+
},
|
| 394 |
+
generated: {
|
| 395 |
+
line: generated.line,
|
| 396 |
+
column: generated.column
|
| 397 |
+
},
|
| 398 |
+
name: original.name
|
| 399 |
+
});
|
| 400 |
+
}
|
| 401 |
+
} else {
|
| 402 |
+
generated.column++;
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
});
|
| 406 |
+
this.walkSourceContents(function (sourceFile, sourceContent) {
|
| 407 |
+
map.setSourceContent(sourceFile, sourceContent);
|
| 408 |
+
});
|
| 409 |
+
|
| 410 |
+
return { code: generated.code, map: map };
|
| 411 |
+
};
|
| 412 |
+
|
| 413 |
+
exports.SourceNode = SourceNode;
|
loan-advisor-chatgpt-app/node_modules/source-map-js/lib/util.js
ADDED
|
@@ -0,0 +1,594 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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Licensed under the New BSD license. See LICENSE or:
|
| 5 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* This is a helper function for getting values from parameter/options
|
| 10 |
+
* objects.
|
| 11 |
+
*
|
| 12 |
+
* @param args The object we are extracting values from
|
| 13 |
+
* @param name The name of the property we are getting.
|
| 14 |
+
* @param defaultValue An optional value to return if the property is missing
|
| 15 |
+
* from the object. If this is not specified and the property is missing, an
|
| 16 |
+
* error will be thrown.
|
| 17 |
+
*/
|
| 18 |
+
function getArg(aArgs, aName, aDefaultValue) {
|
| 19 |
+
if (aName in aArgs) {
|
| 20 |
+
return aArgs[aName];
|
| 21 |
+
} else if (arguments.length === 3) {
|
| 22 |
+
return aDefaultValue;
|
| 23 |
+
} else {
|
| 24 |
+
throw new Error('"' + aName + '" is a required argument.');
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
exports.getArg = getArg;
|
| 28 |
+
|
| 29 |
+
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
| 30 |
+
var dataUrlRegexp = /^data:.+\,.+$/;
|
| 31 |
+
|
| 32 |
+
function urlParse(aUrl) {
|
| 33 |
+
var match = aUrl.match(urlRegexp);
|
| 34 |
+
if (!match) {
|
| 35 |
+
return null;
|
| 36 |
+
}
|
| 37 |
+
return {
|
| 38 |
+
scheme: match[1],
|
| 39 |
+
auth: match[2],
|
| 40 |
+
host: match[3],
|
| 41 |
+
port: match[4],
|
| 42 |
+
path: match[5]
|
| 43 |
+
};
|
| 44 |
+
}
|
| 45 |
+
exports.urlParse = urlParse;
|
| 46 |
+
|
| 47 |
+
function urlGenerate(aParsedUrl) {
|
| 48 |
+
var url = '';
|
| 49 |
+
if (aParsedUrl.scheme) {
|
| 50 |
+
url += aParsedUrl.scheme + ':';
|
| 51 |
+
}
|
| 52 |
+
url += '//';
|
| 53 |
+
if (aParsedUrl.auth) {
|
| 54 |
+
url += aParsedUrl.auth + '@';
|
| 55 |
+
}
|
| 56 |
+
if (aParsedUrl.host) {
|
| 57 |
+
url += aParsedUrl.host;
|
| 58 |
+
}
|
| 59 |
+
if (aParsedUrl.port) {
|
| 60 |
+
url += ":" + aParsedUrl.port
|
| 61 |
+
}
|
| 62 |
+
if (aParsedUrl.path) {
|
| 63 |
+
url += aParsedUrl.path;
|
| 64 |
+
}
|
| 65 |
+
return url;
|
| 66 |
+
}
|
| 67 |
+
exports.urlGenerate = urlGenerate;
|
| 68 |
+
|
| 69 |
+
var MAX_CACHED_INPUTS = 32;
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Takes some function `f(input) -> result` and returns a memoized version of
|
| 73 |
+
* `f`.
|
| 74 |
+
*
|
| 75 |
+
* We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
|
| 76 |
+
* memoization is a dumb-simple, linear least-recently-used cache.
|
| 77 |
+
*/
|
| 78 |
+
function lruMemoize(f) {
|
| 79 |
+
var cache = [];
|
| 80 |
+
|
| 81 |
+
return function(input) {
|
| 82 |
+
for (var i = 0; i < cache.length; i++) {
|
| 83 |
+
if (cache[i].input === input) {
|
| 84 |
+
var temp = cache[0];
|
| 85 |
+
cache[0] = cache[i];
|
| 86 |
+
cache[i] = temp;
|
| 87 |
+
return cache[0].result;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
var result = f(input);
|
| 92 |
+
|
| 93 |
+
cache.unshift({
|
| 94 |
+
input,
|
| 95 |
+
result,
|
| 96 |
+
});
|
| 97 |
+
|
| 98 |
+
if (cache.length > MAX_CACHED_INPUTS) {
|
| 99 |
+
cache.pop();
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
return result;
|
| 103 |
+
};
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Normalizes a path, or the path portion of a URL:
|
| 108 |
+
*
|
| 109 |
+
* - Replaces consecutive slashes with one slash.
|
| 110 |
+
* - Removes unnecessary '.' parts.
|
| 111 |
+
* - Removes unnecessary '<dir>/..' parts.
|
| 112 |
+
*
|
| 113 |
+
* Based on code in the Node.js 'path' core module.
|
| 114 |
+
*
|
| 115 |
+
* @param aPath The path or url to normalize.
|
| 116 |
+
*/
|
| 117 |
+
var normalize = lruMemoize(function normalize(aPath) {
|
| 118 |
+
var path = aPath;
|
| 119 |
+
var url = urlParse(aPath);
|
| 120 |
+
if (url) {
|
| 121 |
+
if (!url.path) {
|
| 122 |
+
return aPath;
|
| 123 |
+
}
|
| 124 |
+
path = url.path;
|
| 125 |
+
}
|
| 126 |
+
var isAbsolute = exports.isAbsolute(path);
|
| 127 |
+
// Split the path into parts between `/` characters. This is much faster than
|
| 128 |
+
// using `.split(/\/+/g)`.
|
| 129 |
+
var parts = [];
|
| 130 |
+
var start = 0;
|
| 131 |
+
var i = 0;
|
| 132 |
+
while (true) {
|
| 133 |
+
start = i;
|
| 134 |
+
i = path.indexOf("/", start);
|
| 135 |
+
if (i === -1) {
|
| 136 |
+
parts.push(path.slice(start));
|
| 137 |
+
break;
|
| 138 |
+
} else {
|
| 139 |
+
parts.push(path.slice(start, i));
|
| 140 |
+
while (i < path.length && path[i] === "/") {
|
| 141 |
+
i++;
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
| 147 |
+
part = parts[i];
|
| 148 |
+
if (part === '.') {
|
| 149 |
+
parts.splice(i, 1);
|
| 150 |
+
} else if (part === '..') {
|
| 151 |
+
up++;
|
| 152 |
+
} else if (up > 0) {
|
| 153 |
+
if (part === '') {
|
| 154 |
+
// The first part is blank if the path is absolute. Trying to go
|
| 155 |
+
// above the root is a no-op. Therefore we can remove all '..' parts
|
| 156 |
+
// directly after the root.
|
| 157 |
+
parts.splice(i + 1, up);
|
| 158 |
+
up = 0;
|
| 159 |
+
} else {
|
| 160 |
+
parts.splice(i, 2);
|
| 161 |
+
up--;
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
path = parts.join('/');
|
| 166 |
+
|
| 167 |
+
if (path === '') {
|
| 168 |
+
path = isAbsolute ? '/' : '.';
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
if (url) {
|
| 172 |
+
url.path = path;
|
| 173 |
+
return urlGenerate(url);
|
| 174 |
+
}
|
| 175 |
+
return path;
|
| 176 |
+
});
|
| 177 |
+
exports.normalize = normalize;
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* Joins two paths/URLs.
|
| 181 |
+
*
|
| 182 |
+
* @param aRoot The root path or URL.
|
| 183 |
+
* @param aPath The path or URL to be joined with the root.
|
| 184 |
+
*
|
| 185 |
+
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
|
| 186 |
+
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
|
| 187 |
+
* first.
|
| 188 |
+
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
|
| 189 |
+
* is updated with the result and aRoot is returned. Otherwise the result
|
| 190 |
+
* is returned.
|
| 191 |
+
* - If aPath is absolute, the result is aPath.
|
| 192 |
+
* - Otherwise the two paths are joined with a slash.
|
| 193 |
+
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
| 194 |
+
*/
|
| 195 |
+
function join(aRoot, aPath) {
|
| 196 |
+
if (aRoot === "") {
|
| 197 |
+
aRoot = ".";
|
| 198 |
+
}
|
| 199 |
+
if (aPath === "") {
|
| 200 |
+
aPath = ".";
|
| 201 |
+
}
|
| 202 |
+
var aPathUrl = urlParse(aPath);
|
| 203 |
+
var aRootUrl = urlParse(aRoot);
|
| 204 |
+
if (aRootUrl) {
|
| 205 |
+
aRoot = aRootUrl.path || '/';
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// `join(foo, '//www.example.org')`
|
| 209 |
+
if (aPathUrl && !aPathUrl.scheme) {
|
| 210 |
+
if (aRootUrl) {
|
| 211 |
+
aPathUrl.scheme = aRootUrl.scheme;
|
| 212 |
+
}
|
| 213 |
+
return urlGenerate(aPathUrl);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
| 217 |
+
return aPath;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
// `join('http://', 'www.example.com')`
|
| 221 |
+
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
| 222 |
+
aRootUrl.host = aPath;
|
| 223 |
+
return urlGenerate(aRootUrl);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
var joined = aPath.charAt(0) === '/'
|
| 227 |
+
? aPath
|
| 228 |
+
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
| 229 |
+
|
| 230 |
+
if (aRootUrl) {
|
| 231 |
+
aRootUrl.path = joined;
|
| 232 |
+
return urlGenerate(aRootUrl);
|
| 233 |
+
}
|
| 234 |
+
return joined;
|
| 235 |
+
}
|
| 236 |
+
exports.join = join;
|
| 237 |
+
|
| 238 |
+
exports.isAbsolute = function (aPath) {
|
| 239 |
+
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
|
| 240 |
+
};
|
| 241 |
+
|
| 242 |
+
/**
|
| 243 |
+
* Make a path relative to a URL or another path.
|
| 244 |
+
*
|
| 245 |
+
* @param aRoot The root path or URL.
|
| 246 |
+
* @param aPath The path or URL to be made relative to aRoot.
|
| 247 |
+
*/
|
| 248 |
+
function relative(aRoot, aPath) {
|
| 249 |
+
if (aRoot === "") {
|
| 250 |
+
aRoot = ".";
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
aRoot = aRoot.replace(/\/$/, '');
|
| 254 |
+
|
| 255 |
+
// It is possible for the path to be above the root. In this case, simply
|
| 256 |
+
// checking whether the root is a prefix of the path won't work. Instead, we
|
| 257 |
+
// need to remove components from the root one by one, until either we find
|
| 258 |
+
// a prefix that fits, or we run out of components to remove.
|
| 259 |
+
var level = 0;
|
| 260 |
+
while (aPath.indexOf(aRoot + '/') !== 0) {
|
| 261 |
+
var index = aRoot.lastIndexOf("/");
|
| 262 |
+
if (index < 0) {
|
| 263 |
+
return aPath;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
// If the only part of the root that is left is the scheme (i.e. http://,
|
| 267 |
+
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
|
| 268 |
+
// have exhausted all components, so the path is not relative to the root.
|
| 269 |
+
aRoot = aRoot.slice(0, index);
|
| 270 |
+
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
| 271 |
+
return aPath;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
++level;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
// Make sure we add a "../" for each component we removed from the root.
|
| 278 |
+
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
| 279 |
+
}
|
| 280 |
+
exports.relative = relative;
|
| 281 |
+
|
| 282 |
+
var supportsNullProto = (function () {
|
| 283 |
+
var obj = Object.create(null);
|
| 284 |
+
return !('__proto__' in obj);
|
| 285 |
+
}());
|
| 286 |
+
|
| 287 |
+
function identity (s) {
|
| 288 |
+
return s;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/**
|
| 292 |
+
* Because behavior goes wacky when you set `__proto__` on objects, we
|
| 293 |
+
* have to prefix all the strings in our set with an arbitrary character.
|
| 294 |
+
*
|
| 295 |
+
* See https://github.com/mozilla/source-map/pull/31 and
|
| 296 |
+
* https://github.com/mozilla/source-map/issues/30
|
| 297 |
+
*
|
| 298 |
+
* @param String aStr
|
| 299 |
+
*/
|
| 300 |
+
function toSetString(aStr) {
|
| 301 |
+
if (isProtoString(aStr)) {
|
| 302 |
+
return '$' + aStr;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
return aStr;
|
| 306 |
+
}
|
| 307 |
+
exports.toSetString = supportsNullProto ? identity : toSetString;
|
| 308 |
+
|
| 309 |
+
function fromSetString(aStr) {
|
| 310 |
+
if (isProtoString(aStr)) {
|
| 311 |
+
return aStr.slice(1);
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
return aStr;
|
| 315 |
+
}
|
| 316 |
+
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
| 317 |
+
|
| 318 |
+
function isProtoString(s) {
|
| 319 |
+
if (!s) {
|
| 320 |
+
return false;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
var length = s.length;
|
| 324 |
+
|
| 325 |
+
if (length < 9 /* "__proto__".length */) {
|
| 326 |
+
return false;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
| 330 |
+
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
| 331 |
+
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
| 332 |
+
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
| 333 |
+
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
| 334 |
+
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
| 335 |
+
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
| 336 |
+
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
| 337 |
+
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
| 338 |
+
return false;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
for (var i = length - 10; i >= 0; i--) {
|
| 342 |
+
if (s.charCodeAt(i) !== 36 /* '$' */) {
|
| 343 |
+
return false;
|
| 344 |
+
}
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
return true;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
/**
|
| 351 |
+
* Comparator between two mappings where the original positions are compared.
|
| 352 |
+
*
|
| 353 |
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
| 354 |
+
* mappings with the same original source/line/column, but different generated
|
| 355 |
+
* line and column the same. Useful when searching for a mapping with a
|
| 356 |
+
* stubbed out mapping.
|
| 357 |
+
*/
|
| 358 |
+
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
| 359 |
+
var cmp = strcmp(mappingA.source, mappingB.source);
|
| 360 |
+
if (cmp !== 0) {
|
| 361 |
+
return cmp;
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
| 365 |
+
if (cmp !== 0) {
|
| 366 |
+
return cmp;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
| 370 |
+
if (cmp !== 0 || onlyCompareOriginal) {
|
| 371 |
+
return cmp;
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
| 375 |
+
if (cmp !== 0) {
|
| 376 |
+
return cmp;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
| 380 |
+
if (cmp !== 0) {
|
| 381 |
+
return cmp;
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
return strcmp(mappingA.name, mappingB.name);
|
| 385 |
+
}
|
| 386 |
+
exports.compareByOriginalPositions = compareByOriginalPositions;
|
| 387 |
+
|
| 388 |
+
function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
|
| 389 |
+
var cmp
|
| 390 |
+
|
| 391 |
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
| 392 |
+
if (cmp !== 0) {
|
| 393 |
+
return cmp;
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
| 397 |
+
if (cmp !== 0 || onlyCompareOriginal) {
|
| 398 |
+
return cmp;
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
| 402 |
+
if (cmp !== 0) {
|
| 403 |
+
return cmp;
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
| 407 |
+
if (cmp !== 0) {
|
| 408 |
+
return cmp;
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
return strcmp(mappingA.name, mappingB.name);
|
| 412 |
+
}
|
| 413 |
+
exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
|
| 414 |
+
|
| 415 |
+
/**
|
| 416 |
+
* Comparator between two mappings with deflated source and name indices where
|
| 417 |
+
* the generated positions are compared.
|
| 418 |
+
*
|
| 419 |
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
| 420 |
+
* mappings with the same generated line and column, but different
|
| 421 |
+
* source/name/original line and column the same. Useful when searching for a
|
| 422 |
+
* mapping with a stubbed out mapping.
|
| 423 |
+
*/
|
| 424 |
+
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
| 425 |
+
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
| 426 |
+
if (cmp !== 0) {
|
| 427 |
+
return cmp;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
| 431 |
+
if (cmp !== 0 || onlyCompareGenerated) {
|
| 432 |
+
return cmp;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
cmp = strcmp(mappingA.source, mappingB.source);
|
| 436 |
+
if (cmp !== 0) {
|
| 437 |
+
return cmp;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
| 441 |
+
if (cmp !== 0) {
|
| 442 |
+
return cmp;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
| 446 |
+
if (cmp !== 0) {
|
| 447 |
+
return cmp;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
return strcmp(mappingA.name, mappingB.name);
|
| 451 |
+
}
|
| 452 |
+
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
| 453 |
+
|
| 454 |
+
function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
|
| 455 |
+
var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
| 456 |
+
if (cmp !== 0 || onlyCompareGenerated) {
|
| 457 |
+
return cmp;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
cmp = strcmp(mappingA.source, mappingB.source);
|
| 461 |
+
if (cmp !== 0) {
|
| 462 |
+
return cmp;
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
| 466 |
+
if (cmp !== 0) {
|
| 467 |
+
return cmp;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
| 471 |
+
if (cmp !== 0) {
|
| 472 |
+
return cmp;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
return strcmp(mappingA.name, mappingB.name);
|
| 476 |
+
}
|
| 477 |
+
exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
|
| 478 |
+
|
| 479 |
+
function strcmp(aStr1, aStr2) {
|
| 480 |
+
if (aStr1 === aStr2) {
|
| 481 |
+
return 0;
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
if (aStr1 === null) {
|
| 485 |
+
return 1; // aStr2 !== null
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
if (aStr2 === null) {
|
| 489 |
+
return -1; // aStr1 !== null
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
if (aStr1 > aStr2) {
|
| 493 |
+
return 1;
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
return -1;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
/**
|
| 500 |
+
* Comparator between two mappings with inflated source and name strings where
|
| 501 |
+
* the generated positions are compared.
|
| 502 |
+
*/
|
| 503 |
+
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
| 504 |
+
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
| 505 |
+
if (cmp !== 0) {
|
| 506 |
+
return cmp;
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
| 510 |
+
if (cmp !== 0) {
|
| 511 |
+
return cmp;
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
cmp = strcmp(mappingA.source, mappingB.source);
|
| 515 |
+
if (cmp !== 0) {
|
| 516 |
+
return cmp;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
| 520 |
+
if (cmp !== 0) {
|
| 521 |
+
return cmp;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
| 525 |
+
if (cmp !== 0) {
|
| 526 |
+
return cmp;
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
return strcmp(mappingA.name, mappingB.name);
|
| 530 |
+
}
|
| 531 |
+
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
| 532 |
+
|
| 533 |
+
/**
|
| 534 |
+
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
| 535 |
+
* in the source maps specification), and then parse the string as
|
| 536 |
+
* JSON.
|
| 537 |
+
*/
|
| 538 |
+
function parseSourceMapInput(str) {
|
| 539 |
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
|
| 540 |
+
}
|
| 541 |
+
exports.parseSourceMapInput = parseSourceMapInput;
|
| 542 |
+
|
| 543 |
+
/**
|
| 544 |
+
* Compute the URL of a source given the the source root, the source's
|
| 545 |
+
* URL, and the source map's URL.
|
| 546 |
+
*/
|
| 547 |
+
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
| 548 |
+
sourceURL = sourceURL || '';
|
| 549 |
+
|
| 550 |
+
if (sourceRoot) {
|
| 551 |
+
// This follows what Chrome does.
|
| 552 |
+
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
|
| 553 |
+
sourceRoot += '/';
|
| 554 |
+
}
|
| 555 |
+
// The spec says:
|
| 556 |
+
// Line 4: An optional source root, useful for relocating source
|
| 557 |
+
// files on a server or removing repeated values in the
|
| 558 |
+
// “sources” entry. This value is prepended to the individual
|
| 559 |
+
// entries in the “source” field.
|
| 560 |
+
sourceURL = sourceRoot + sourceURL;
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
// Historically, SourceMapConsumer did not take the sourceMapURL as
|
| 564 |
+
// a parameter. This mode is still somewhat supported, which is why
|
| 565 |
+
// this code block is conditional. However, it's preferable to pass
|
| 566 |
+
// the source map URL to SourceMapConsumer, so that this function
|
| 567 |
+
// can implement the source URL resolution algorithm as outlined in
|
| 568 |
+
// the spec. This block is basically the equivalent of:
|
| 569 |
+
// new URL(sourceURL, sourceMapURL).toString()
|
| 570 |
+
// ... except it avoids using URL, which wasn't available in the
|
| 571 |
+
// older releases of node still supported by this library.
|
| 572 |
+
//
|
| 573 |
+
// The spec says:
|
| 574 |
+
// If the sources are not absolute URLs after prepending of the
|
| 575 |
+
// “sourceRoot”, the sources are resolved relative to the
|
| 576 |
+
// SourceMap (like resolving script src in a html document).
|
| 577 |
+
if (sourceMapURL) {
|
| 578 |
+
var parsed = urlParse(sourceMapURL);
|
| 579 |
+
if (!parsed) {
|
| 580 |
+
throw new Error("sourceMapURL could not be parsed");
|
| 581 |
+
}
|
| 582 |
+
if (parsed.path) {
|
| 583 |
+
// Strip the last path component, but keep the "/".
|
| 584 |
+
var index = parsed.path.lastIndexOf('/');
|
| 585 |
+
if (index >= 0) {
|
| 586 |
+
parsed.path = parsed.path.substring(0, index + 1);
|
| 587 |
+
}
|
| 588 |
+
}
|
| 589 |
+
sourceURL = join(urlGenerate(parsed), sourceURL);
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
return normalize(sourceURL);
|
| 593 |
+
}
|
| 594 |
+
exports.computeSourceURL = computeSourceURL;
|
loan-advisor-chatgpt-app/node_modules/source-map-js/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "source-map-js",
|
| 3 |
+
"description": "Generates and consumes source maps",
|
| 4 |
+
"version": "1.2.1",
|
| 5 |
+
"homepage": "https://github.com/7rulnik/source-map-js",
|
| 6 |
+
"author": "Valentin 7rulnik Semirulnik <v7rulnik@gmail.com>",
|
| 7 |
+
"contributors": [
|
| 8 |
+
"Nick Fitzgerald <nfitzgerald@mozilla.com>",
|
| 9 |
+
"Tobias Koppers <tobias.koppers@googlemail.com>",
|
| 10 |
+
"Duncan Beevers <duncan@dweebd.com>",
|
| 11 |
+
"Stephen Crane <scrane@mozilla.com>",
|
| 12 |
+
"Ryan Seddon <seddon.ryan@gmail.com>",
|
| 13 |
+
"Miles Elam <miles.elam@deem.com>",
|
| 14 |
+
"Mihai Bazon <mihai.bazon@gmail.com>",
|
| 15 |
+
"Michael Ficarra <github.public.email@michael.ficarra.me>",
|
| 16 |
+
"Todd Wolfson <todd@twolfson.com>",
|
| 17 |
+
"Alexander Solovyov <alexander@solovyov.net>",
|
| 18 |
+
"Felix Gnass <fgnass@gmail.com>",
|
| 19 |
+
"Conrad Irwin <conrad.irwin@gmail.com>",
|
| 20 |
+
"usrbincc <usrbincc@yahoo.com>",
|
| 21 |
+
"David Glasser <glasser@davidglasser.net>",
|
| 22 |
+
"Chase Douglas <chase@newrelic.com>",
|
| 23 |
+
"Evan Wallace <evan.exe@gmail.com>",
|
| 24 |
+
"Heather Arthur <fayearthur@gmail.com>",
|
| 25 |
+
"Hugh Kennedy <hughskennedy@gmail.com>",
|
| 26 |
+
"David Glasser <glasser@davidglasser.net>",
|
| 27 |
+
"Simon Lydell <simon.lydell@gmail.com>",
|
| 28 |
+
"Jmeas Smith <jellyes2@gmail.com>",
|
| 29 |
+
"Michael Z Goddard <mzgoddard@gmail.com>",
|
| 30 |
+
"azu <azu@users.noreply.github.com>",
|
| 31 |
+
"John Gozde <john@gozde.ca>",
|
| 32 |
+
"Adam Kirkton <akirkton@truefitinnovation.com>",
|
| 33 |
+
"Chris Montgomery <christopher.montgomery@dowjones.com>",
|
| 34 |
+
"J. Ryan Stinnett <jryans@gmail.com>",
|
| 35 |
+
"Jack Herrington <jherrington@walmartlabs.com>",
|
| 36 |
+
"Chris Truter <jeffpalentine@gmail.com>",
|
| 37 |
+
"Daniel Espeset <daniel@danielespeset.com>",
|
| 38 |
+
"Jamie Wong <jamie.lf.wong@gmail.com>",
|
| 39 |
+
"Eddy Bruël <ejpbruel@mozilla.com>",
|
| 40 |
+
"Hawken Rives <hawkrives@gmail.com>",
|
| 41 |
+
"Gilad Peleg <giladp007@gmail.com>",
|
| 42 |
+
"djchie <djchie.dev@gmail.com>",
|
| 43 |
+
"Gary Ye <garysye@gmail.com>",
|
| 44 |
+
"Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
|
| 45 |
+
],
|
| 46 |
+
"repository": "7rulnik/source-map-js",
|
| 47 |
+
"main": "./source-map.js",
|
| 48 |
+
"files": [
|
| 49 |
+
"source-map.js",
|
| 50 |
+
"source-map.d.ts",
|
| 51 |
+
"lib/"
|
| 52 |
+
],
|
| 53 |
+
"engines": {
|
| 54 |
+
"node": ">=0.10.0"
|
| 55 |
+
},
|
| 56 |
+
"license": "BSD-3-Clause",
|
| 57 |
+
"scripts": {
|
| 58 |
+
"test": "npm run build && node test/run-tests.js",
|
| 59 |
+
"build": "webpack --color",
|
| 60 |
+
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
|
| 61 |
+
},
|
| 62 |
+
"devDependencies": {
|
| 63 |
+
"clean-publish": "^3.1.0",
|
| 64 |
+
"doctoc": "^0.15.0",
|
| 65 |
+
"webpack": "^1.12.0"
|
| 66 |
+
},
|
| 67 |
+
"clean-publish": {
|
| 68 |
+
"cleanDocs": true
|
| 69 |
+
},
|
| 70 |
+
"typings": "source-map.d.ts"
|
| 71 |
+
}
|
loan-advisor-chatgpt-app/node_modules/source-map-js/source-map.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface StartOfSourceMap {
|
| 2 |
+
file?: string;
|
| 3 |
+
sourceRoot?: string;
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
export interface RawSourceMap extends StartOfSourceMap {
|
| 7 |
+
version: string;
|
| 8 |
+
sources: string[];
|
| 9 |
+
names: string[];
|
| 10 |
+
sourcesContent?: string[];
|
| 11 |
+
mappings: string;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export interface Position {
|
| 15 |
+
line: number;
|
| 16 |
+
column: number;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
export interface LineRange extends Position {
|
| 20 |
+
lastColumn: number;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
export interface FindPosition extends Position {
|
| 24 |
+
// SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
|
| 25 |
+
bias?: number;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
export interface SourceFindPosition extends FindPosition {
|
| 29 |
+
source: string;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
export interface MappedPosition extends Position {
|
| 33 |
+
source: string;
|
| 34 |
+
name?: string;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
export interface MappingItem {
|
| 38 |
+
source: string | null;
|
| 39 |
+
generatedLine: number;
|
| 40 |
+
generatedColumn: number;
|
| 41 |
+
originalLine: number | null;
|
| 42 |
+
originalColumn: number | null;
|
| 43 |
+
name: string | null;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
export class SourceMapConsumer {
|
| 47 |
+
static GENERATED_ORDER: number;
|
| 48 |
+
static ORIGINAL_ORDER: number;
|
| 49 |
+
|
| 50 |
+
static GREATEST_LOWER_BOUND: number;
|
| 51 |
+
static LEAST_UPPER_BOUND: number;
|
| 52 |
+
|
| 53 |
+
constructor(rawSourceMap: RawSourceMap);
|
| 54 |
+
readonly file: string | undefined | null;
|
| 55 |
+
readonly sourceRoot: string | undefined | null;
|
| 56 |
+
readonly sourcesContent: readonly string[] | null | undefined;
|
| 57 |
+
readonly sources: readonly string[]
|
| 58 |
+
|
| 59 |
+
computeColumnSpans(): void;
|
| 60 |
+
originalPositionFor(generatedPosition: FindPosition): MappedPosition;
|
| 61 |
+
generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
|
| 62 |
+
allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
|
| 63 |
+
hasContentsOfAllSources(): boolean;
|
| 64 |
+
sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null;
|
| 65 |
+
eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
export interface Mapping {
|
| 69 |
+
generated: Position;
|
| 70 |
+
original?: Position | null;
|
| 71 |
+
source?: string | null;
|
| 72 |
+
name?: string | null;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
export class SourceMapGenerator {
|
| 76 |
+
constructor(startOfSourceMap?: StartOfSourceMap);
|
| 77 |
+
static fromSourceMap(sourceMapConsumer: SourceMapConsumer, startOfSourceMap?: StartOfSourceMap): SourceMapGenerator;
|
| 78 |
+
addMapping(mapping: Mapping): void;
|
| 79 |
+
setSourceContent(sourceFile: string, sourceContent: string | null | undefined): void;
|
| 80 |
+
applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
|
| 81 |
+
toString(): string;
|
| 82 |
+
toJSON(): RawSourceMap;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
export interface CodeWithSourceMap {
|
| 86 |
+
code: string;
|
| 87 |
+
map: SourceMapGenerator;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
export class SourceNode {
|
| 91 |
+
constructor();
|
| 92 |
+
constructor(line: number, column: number, source: string);
|
| 93 |
+
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
| 94 |
+
static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
| 95 |
+
add(chunk: string): void;
|
| 96 |
+
prepend(chunk: string): void;
|
| 97 |
+
setSourceContent(sourceFile: string, sourceContent: string): void;
|
| 98 |
+
walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
| 99 |
+
walkSourceContents(fn: (file: string, content: string) => void): void;
|
| 100 |
+
join(sep: string): SourceNode;
|
| 101 |
+
replaceRight(pattern: string, replacement: string): SourceNode;
|
| 102 |
+
toString(): string;
|
| 103 |
+
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
|
| 104 |
+
}
|
loan-advisor-chatgpt-app/node_modules/source-map-js/source-map.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2009-2011 Mozilla Foundation and contributors
|
| 3 |
+
* Licensed under the New BSD license. See LICENSE.txt or:
|
| 4 |
+
* http://opensource.org/licenses/BSD-3-Clause
|
| 5 |
+
*/
|
| 6 |
+
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
|
| 7 |
+
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
|
| 8 |
+
exports.SourceNode = require('./lib/source-node').SourceNode;
|
loan-advisor-chatgpt-app/node_modules/space-separated-tokens/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse space-separated tokens to an array of strings.
|
| 3 |
+
*
|
| 4 |
+
* @param {string} value
|
| 5 |
+
* Space-separated tokens.
|
| 6 |
+
* @returns {Array<string>}
|
| 7 |
+
* List of tokens.
|
| 8 |
+
*/
|
| 9 |
+
export function parse(value: string): Array<string>
|
| 10 |
+
/**
|
| 11 |
+
* Serialize an array of strings as space separated-tokens.
|
| 12 |
+
*
|
| 13 |
+
* @param {Array<string|number>} values
|
| 14 |
+
* List of tokens.
|
| 15 |
+
* @returns {string}
|
| 16 |
+
* Space-separated tokens.
|
| 17 |
+
*/
|
| 18 |
+
export function stringify(values: Array<string | number>): string
|
loan-advisor-chatgpt-app/node_modules/space-separated-tokens/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Parse space-separated tokens to an array of strings.
|
| 3 |
+
*
|
| 4 |
+
* @param {string} value
|
| 5 |
+
* Space-separated tokens.
|
| 6 |
+
* @returns {Array<string>}
|
| 7 |
+
* List of tokens.
|
| 8 |
+
*/
|
| 9 |
+
export function parse(value) {
|
| 10 |
+
const input = String(value || '').trim()
|
| 11 |
+
return input ? input.split(/[ \t\n\r\f]+/g) : []
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Serialize an array of strings as space separated-tokens.
|
| 16 |
+
*
|
| 17 |
+
* @param {Array<string|number>} values
|
| 18 |
+
* List of tokens.
|
| 19 |
+
* @returns {string}
|
| 20 |
+
* Space-separated tokens.
|
| 21 |
+
*/
|
| 22 |
+
export function stringify(values) {
|
| 23 |
+
return values.join(' ').trim()
|
| 24 |
+
}
|
loan-advisor-chatgpt-app/node_modules/space-separated-tokens/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
loan-advisor-chatgpt-app/node_modules/space-separated-tokens/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "space-separated-tokens",
|
| 3 |
+
"version": "2.0.2",
|
| 4 |
+
"description": "Parse and stringify space separated tokens",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"dom",
|
| 8 |
+
"html",
|
| 9 |
+
"space",
|
| 10 |
+
"separated",
|
| 11 |
+
"tokens",
|
| 12 |
+
"parse",
|
| 13 |
+
"stringify"
|
| 14 |
+
],
|
| 15 |
+
"repository": "wooorm/space-separated-tokens",
|
| 16 |
+
"bugs": "https://github.com/wooorm/space-separated-tokens/issues",
|
| 17 |
+
"funding": {
|
| 18 |
+
"type": "github",
|
| 19 |
+
"url": "https://github.com/sponsors/wooorm"
|
| 20 |
+
},
|
| 21 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 22 |
+
"contributors": [
|
| 23 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 24 |
+
],
|
| 25 |
+
"sideEffects": false,
|
| 26 |
+
"type": "module",
|
| 27 |
+
"main": "index.js",
|
| 28 |
+
"types": "index.d.ts",
|
| 29 |
+
"files": [
|
| 30 |
+
"index.d.ts",
|
| 31 |
+
"index.js"
|
| 32 |
+
],
|
| 33 |
+
"devDependencies": {
|
| 34 |
+
"@types/node": "^18.0.0",
|
| 35 |
+
"c8": "^7.0.0",
|
| 36 |
+
"prettier": "^2.0.0",
|
| 37 |
+
"remark-cli": "^11.0.0",
|
| 38 |
+
"remark-preset-wooorm": "^9.0.0",
|
| 39 |
+
"type-coverage": "^2.0.0",
|
| 40 |
+
"typescript": "^4.0.0",
|
| 41 |
+
"xo": "^0.52.0"
|
| 42 |
+
},
|
| 43 |
+
"scripts": {
|
| 44 |
+
"prepack": "npm run build && npm run format",
|
| 45 |
+
"build": "tsc --build --clean && tsc --build && type-coverage",
|
| 46 |
+
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
| 47 |
+
"test-api": "node --conditions development test.js",
|
| 48 |
+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
|
| 49 |
+
"test": "npm run build && npm run format && npm run test-coverage"
|
| 50 |
+
},
|
| 51 |
+
"prettier": {
|
| 52 |
+
"tabWidth": 2,
|
| 53 |
+
"useTabs": false,
|
| 54 |
+
"singleQuote": true,
|
| 55 |
+
"bracketSpacing": false,
|
| 56 |
+
"semi": false,
|
| 57 |
+
"trailingComma": "none"
|
| 58 |
+
},
|
| 59 |
+
"xo": {
|
| 60 |
+
"prettier": true
|
| 61 |
+
},
|
| 62 |
+
"remarkConfig": {
|
| 63 |
+
"plugins": [
|
| 64 |
+
"preset-wooorm"
|
| 65 |
+
]
|
| 66 |
+
}
|
| 67 |
+
}
|
loan-advisor-chatgpt-app/node_modules/space-separated-tokens/readme.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# space-separated-tokens
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
|
| 8 |
+
Parse and stringify space-separated tokens.
|
| 9 |
+
|
| 10 |
+
## Contents
|
| 11 |
+
|
| 12 |
+
* [What is this?](#what-is-this)
|
| 13 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 14 |
+
* [Install](#install)
|
| 15 |
+
* [Use](#use)
|
| 16 |
+
* [API](#api)
|
| 17 |
+
* [`parse(value)`](#parsevalue)
|
| 18 |
+
* [`stringify(values)`](#stringifyvalues)
|
| 19 |
+
* [Types](#types)
|
| 20 |
+
* [Compatibility](#compatibility)
|
| 21 |
+
* [Related](#related)
|
| 22 |
+
* [Contribute](#contribute)
|
| 23 |
+
* [Security](#security)
|
| 24 |
+
* [License](#license)
|
| 25 |
+
|
| 26 |
+
## What is this?
|
| 27 |
+
|
| 28 |
+
This is a tiny package that can parse and stringify space-separated tokens, as
|
| 29 |
+
used for example in the HTML `class` attribute, according to the
|
| 30 |
+
[WHATWG spec][spec].
|
| 31 |
+
|
| 32 |
+
## When should I use this?
|
| 33 |
+
|
| 34 |
+
This package is rather niche, it’s low-level and particularly useful when
|
| 35 |
+
working with [hast][].
|
| 36 |
+
|
| 37 |
+
## Install
|
| 38 |
+
|
| 39 |
+
This package is [ESM only][esm].
|
| 40 |
+
In Node.js (version 14.14+, 16.0+), install with [npm][]:
|
| 41 |
+
|
| 42 |
+
```sh
|
| 43 |
+
npm install space-separated-tokens
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 47 |
+
|
| 48 |
+
```js
|
| 49 |
+
import {parse, stringify} from 'https://esm.sh/space-separated-tokens@2'
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 53 |
+
|
| 54 |
+
```html
|
| 55 |
+
<script type="module">
|
| 56 |
+
import {parse, stringify} from 'https://esm.sh/space-separated-tokens@2?bundle'
|
| 57 |
+
</script>
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Use
|
| 61 |
+
|
| 62 |
+
```js
|
| 63 |
+
import {parse, stringify} from 'space-separated-tokens'
|
| 64 |
+
|
| 65 |
+
parse(' foo\tbar\nbaz ')
|
| 66 |
+
//=> ['foo', 'bar', 'baz']
|
| 67 |
+
|
| 68 |
+
stringify(['foo', 'bar', 'baz'])
|
| 69 |
+
//=> 'foo bar baz'
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## API
|
| 73 |
+
|
| 74 |
+
This package exports the identifiers `parse` and `stringify`.
|
| 75 |
+
There is no default export.
|
| 76 |
+
|
| 77 |
+
### `parse(value)`
|
| 78 |
+
|
| 79 |
+
Parse space-separated tokens (`string`) to an array of strings
|
| 80 |
+
(`Array<string>`), according to the [WHATWG spec][spec].
|
| 81 |
+
|
| 82 |
+
### `stringify(values)`
|
| 83 |
+
|
| 84 |
+
Serialize an array of strings or numbers (`Array<string|number>`) to
|
| 85 |
+
space-separated tokens (`string`).
|
| 86 |
+
|
| 87 |
+
> 👉 **Note**: it’s not possible to specify empty or whitespace only values.
|
| 88 |
+
|
| 89 |
+
## Types
|
| 90 |
+
|
| 91 |
+
This package is fully typed with [TypeScript][].
|
| 92 |
+
It exports no additional types.
|
| 93 |
+
|
| 94 |
+
## Compatibility
|
| 95 |
+
|
| 96 |
+
This package is at least compatible with all maintained versions of Node.js.
|
| 97 |
+
As of now, that is Node.js 14.14+ and 16.0+.
|
| 98 |
+
It also works in Deno and modern browsers.
|
| 99 |
+
|
| 100 |
+
## Related
|
| 101 |
+
|
| 102 |
+
* [`comma-separated-tokens`](https://github.com/wooorm/comma-separated-tokens)
|
| 103 |
+
— parse/stringify comma-separated tokens
|
| 104 |
+
* [`collapse-white-space`](https://github.com/wooorm/collapse-white-space)
|
| 105 |
+
— replace multiple white-space characters with a single space
|
| 106 |
+
* [`property-information`](https://github.com/wooorm/property-information)
|
| 107 |
+
— info on HTML properties
|
| 108 |
+
|
| 109 |
+
## Contribute
|
| 110 |
+
|
| 111 |
+
Yes please!
|
| 112 |
+
See [How to Contribute to Open Source][contribute].
|
| 113 |
+
|
| 114 |
+
## Security
|
| 115 |
+
|
| 116 |
+
This package is safe.
|
| 117 |
+
|
| 118 |
+
## License
|
| 119 |
+
|
| 120 |
+
[MIT][license] © [Titus Wormer][author]
|
| 121 |
+
|
| 122 |
+
<!-- Definition -->
|
| 123 |
+
|
| 124 |
+
[build-badge]: https://github.com/wooorm/space-separated-tokens/workflows/main/badge.svg
|
| 125 |
+
|
| 126 |
+
[build]: https://github.com/wooorm/space-separated-tokens/actions
|
| 127 |
+
|
| 128 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/space-separated-tokens.svg
|
| 129 |
+
|
| 130 |
+
[coverage]: https://codecov.io/github/wooorm/space-separated-tokens
|
| 131 |
+
|
| 132 |
+
[downloads-badge]: https://img.shields.io/npm/dm/space-separated-tokens.svg
|
| 133 |
+
|
| 134 |
+
[downloads]: https://www.npmjs.com/package/space-separated-tokens
|
| 135 |
+
|
| 136 |
+
[size-badge]: https://img.shields.io/bundlephobia/minzip/space-separated-tokens.svg
|
| 137 |
+
|
| 138 |
+
[size]: https://bundlephobia.com/result?p=space-separated-tokens
|
| 139 |
+
|
| 140 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 141 |
+
|
| 142 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 143 |
+
|
| 144 |
+
[esmsh]: https://esm.sh
|
| 145 |
+
|
| 146 |
+
[typescript]: https://www.typescriptlang.org
|
| 147 |
+
|
| 148 |
+
[contribute]: https://opensource.guide/how-to-contribute/
|
| 149 |
+
|
| 150 |
+
[license]: license
|
| 151 |
+
|
| 152 |
+
[author]: https://wooorm.com
|
| 153 |
+
|
| 154 |
+
[spec]: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#space-separated-tokens
|
| 155 |
+
|
| 156 |
+
[hast]: https://github.com/syntax-tree/hast
|
loan-advisor-chatgpt-app/node_modules/statuses/HISTORY.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2.0.2 / 2025-06-06
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* Migrate to `String.prototype.slice()`
|
| 5 |
+
|
| 6 |
+
2.0.1 / 2021-01-03
|
| 7 |
+
==================
|
| 8 |
+
|
| 9 |
+
* Fix returning values from `Object.prototype`
|
| 10 |
+
|
| 11 |
+
2.0.0 / 2020-04-19
|
| 12 |
+
==================
|
| 13 |
+
|
| 14 |
+
* Drop support for Node.js 0.6
|
| 15 |
+
* Fix messaging casing of `418 I'm a Teapot`
|
| 16 |
+
* Remove code 306
|
| 17 |
+
* Remove `status[code]` exports; use `status.message[code]`
|
| 18 |
+
* Remove `status[msg]` exports; use `status.code[msg]`
|
| 19 |
+
* Rename `425 Unordered Collection` to standard `425 Too Early`
|
| 20 |
+
* Rename `STATUS_CODES` export to `message`
|
| 21 |
+
* Return status message for `statuses(code)` when given code
|
| 22 |
+
|
| 23 |
+
1.5.0 / 2018-03-27
|
| 24 |
+
==================
|
| 25 |
+
|
| 26 |
+
* Add `103 Early Hints`
|
| 27 |
+
|
| 28 |
+
1.4.0 / 2017-10-20
|
| 29 |
+
==================
|
| 30 |
+
|
| 31 |
+
* Add `STATUS_CODES` export
|
| 32 |
+
|
| 33 |
+
1.3.1 / 2016-11-11
|
| 34 |
+
==================
|
| 35 |
+
|
| 36 |
+
* Fix return type in JSDoc
|
| 37 |
+
|
| 38 |
+
1.3.0 / 2016-05-17
|
| 39 |
+
==================
|
| 40 |
+
|
| 41 |
+
* Add `421 Misdirected Request`
|
| 42 |
+
* perf: enable strict mode
|
| 43 |
+
|
| 44 |
+
1.2.1 / 2015-02-01
|
| 45 |
+
==================
|
| 46 |
+
|
| 47 |
+
* Fix message for status 451
|
| 48 |
+
- `451 Unavailable For Legal Reasons`
|
| 49 |
+
|
| 50 |
+
1.2.0 / 2014-09-28
|
| 51 |
+
==================
|
| 52 |
+
|
| 53 |
+
* Add `208 Already Repored`
|
| 54 |
+
* Add `226 IM Used`
|
| 55 |
+
* Add `306 (Unused)`
|
| 56 |
+
* Add `415 Unable For Legal Reasons`
|
| 57 |
+
* Add `508 Loop Detected`
|
| 58 |
+
|
| 59 |
+
1.1.1 / 2014-09-24
|
| 60 |
+
==================
|
| 61 |
+
|
| 62 |
+
* Add missing 308 to `codes.json`
|
| 63 |
+
|
| 64 |
+
1.1.0 / 2014-09-21
|
| 65 |
+
==================
|
| 66 |
+
|
| 67 |
+
* Add `codes.json` for universal support
|
| 68 |
+
|
| 69 |
+
1.0.4 / 2014-08-20
|
| 70 |
+
==================
|
| 71 |
+
|
| 72 |
+
* Package cleanup
|
| 73 |
+
|
| 74 |
+
1.0.3 / 2014-06-08
|
| 75 |
+
==================
|
| 76 |
+
|
| 77 |
+
* Add 308 to `.redirect` category
|
| 78 |
+
|
| 79 |
+
1.0.2 / 2014-03-13
|
| 80 |
+
==================
|
| 81 |
+
|
| 82 |
+
* Add `.retry` category
|
| 83 |
+
|
| 84 |
+
1.0.1 / 2014-03-12
|
| 85 |
+
==================
|
| 86 |
+
|
| 87 |
+
* Initial release
|
loan-advisor-chatgpt-app/node_modules/statuses/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
The MIT License (MIT)
|
| 3 |
+
|
| 4 |
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
| 5 |
+
Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com>
|
| 6 |
+
|
| 7 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 8 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 9 |
+
in the Software without restriction, including without limitation the rights
|
| 10 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 11 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 12 |
+
furnished to do so, subject to the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be included in
|
| 15 |
+
all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 18 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 19 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 20 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 21 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 22 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 23 |
+
THE SOFTWARE.
|
loan-advisor-chatgpt-app/node_modules/statuses/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# statuses
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-version-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
| 5 |
+
[![Node.js Version][node-version-image]][node-version-url]
|
| 6 |
+
[![Build Status][ci-image]][ci-url]
|
| 7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 8 |
+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
| 9 |
+
|
| 10 |
+
HTTP status utility for node.
|
| 11 |
+
|
| 12 |
+
This module provides a list of status codes and messages sourced from
|
| 13 |
+
a few different projects:
|
| 14 |
+
|
| 15 |
+
* The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
|
| 16 |
+
* The [Node.js project](https://nodejs.org/)
|
| 17 |
+
* The [NGINX project](https://www.nginx.com/)
|
| 18 |
+
* The [Apache HTTP Server project](https://httpd.apache.org/)
|
| 19 |
+
|
| 20 |
+
## Installation
|
| 21 |
+
|
| 22 |
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
| 23 |
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
| 24 |
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
| 25 |
+
|
| 26 |
+
```sh
|
| 27 |
+
$ npm install statuses
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## API
|
| 31 |
+
|
| 32 |
+
<!-- eslint-disable no-unused-vars -->
|
| 33 |
+
|
| 34 |
+
```js
|
| 35 |
+
var status = require('statuses')
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
### status(code)
|
| 39 |
+
|
| 40 |
+
Returns the status message string for a known HTTP status code. The code
|
| 41 |
+
may be a number or a string. An error is thrown for an unknown status code.
|
| 42 |
+
|
| 43 |
+
<!-- eslint-disable no-undef -->
|
| 44 |
+
|
| 45 |
+
```js
|
| 46 |
+
status(403) // => 'Forbidden'
|
| 47 |
+
status('403') // => 'Forbidden'
|
| 48 |
+
status(306) // throws
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
### status(msg)
|
| 52 |
+
|
| 53 |
+
Returns the numeric status code for a known HTTP status message. The message
|
| 54 |
+
is case-insensitive. An error is thrown for an unknown status message.
|
| 55 |
+
|
| 56 |
+
<!-- eslint-disable no-undef -->
|
| 57 |
+
|
| 58 |
+
```js
|
| 59 |
+
status('forbidden') // => 403
|
| 60 |
+
status('Forbidden') // => 403
|
| 61 |
+
status('foo') // throws
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### status.codes
|
| 65 |
+
|
| 66 |
+
Returns an array of all the status codes as `Integer`s.
|
| 67 |
+
|
| 68 |
+
### status.code[msg]
|
| 69 |
+
|
| 70 |
+
Returns the numeric status code for a known status message (in lower-case),
|
| 71 |
+
otherwise `undefined`.
|
| 72 |
+
|
| 73 |
+
<!-- eslint-disable no-undef, no-unused-expressions -->
|
| 74 |
+
|
| 75 |
+
```js
|
| 76 |
+
status['not found'] // => 404
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
### status.empty[code]
|
| 80 |
+
|
| 81 |
+
Returns `true` if a status code expects an empty body.
|
| 82 |
+
|
| 83 |
+
<!-- eslint-disable no-undef, no-unused-expressions -->
|
| 84 |
+
|
| 85 |
+
```js
|
| 86 |
+
status.empty[200] // => undefined
|
| 87 |
+
status.empty[204] // => true
|
| 88 |
+
status.empty[304] // => true
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### status.message[code]
|
| 92 |
+
|
| 93 |
+
Returns the string message for a known numeric status code, otherwise
|
| 94 |
+
`undefined`. This object is the same format as the
|
| 95 |
+
[Node.js http module `http.STATUS_CODES`](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
|
| 96 |
+
|
| 97 |
+
<!-- eslint-disable no-undef, no-unused-expressions -->
|
| 98 |
+
|
| 99 |
+
```js
|
| 100 |
+
status.message[404] // => 'Not Found'
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### status.redirect[code]
|
| 104 |
+
|
| 105 |
+
Returns `true` if a status code is a valid redirect status.
|
| 106 |
+
|
| 107 |
+
<!-- eslint-disable no-undef, no-unused-expressions -->
|
| 108 |
+
|
| 109 |
+
```js
|
| 110 |
+
status.redirect[200] // => undefined
|
| 111 |
+
status.redirect[301] // => true
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
### status.retry[code]
|
| 115 |
+
|
| 116 |
+
Returns `true` if you should retry the rest.
|
| 117 |
+
|
| 118 |
+
<!-- eslint-disable no-undef, no-unused-expressions -->
|
| 119 |
+
|
| 120 |
+
```js
|
| 121 |
+
status.retry[501] // => undefined
|
| 122 |
+
status.retry[503] // => true
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
## License
|
| 126 |
+
|
| 127 |
+
[MIT](LICENSE)
|
| 128 |
+
|
| 129 |
+
[ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci
|
| 130 |
+
[ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci
|
| 131 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master
|
| 132 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
|
| 133 |
+
[node-version-image]: https://badgen.net/npm/node/statuses
|
| 134 |
+
[node-version-url]: https://nodejs.org/en/download
|
| 135 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/statuses
|
| 136 |
+
[npm-url]: https://npmjs.org/package/statuses
|
| 137 |
+
[npm-version-image]: https://badgen.net/npm/v/statuses
|
| 138 |
+
[ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/jshttp/statuses/badge
|
| 139 |
+
[ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/jshttp/statuses
|
loan-advisor-chatgpt-app/node_modules/statuses/codes.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"100": "Continue",
|
| 3 |
+
"101": "Switching Protocols",
|
| 4 |
+
"102": "Processing",
|
| 5 |
+
"103": "Early Hints",
|
| 6 |
+
"200": "OK",
|
| 7 |
+
"201": "Created",
|
| 8 |
+
"202": "Accepted",
|
| 9 |
+
"203": "Non-Authoritative Information",
|
| 10 |
+
"204": "No Content",
|
| 11 |
+
"205": "Reset Content",
|
| 12 |
+
"206": "Partial Content",
|
| 13 |
+
"207": "Multi-Status",
|
| 14 |
+
"208": "Already Reported",
|
| 15 |
+
"226": "IM Used",
|
| 16 |
+
"300": "Multiple Choices",
|
| 17 |
+
"301": "Moved Permanently",
|
| 18 |
+
"302": "Found",
|
| 19 |
+
"303": "See Other",
|
| 20 |
+
"304": "Not Modified",
|
| 21 |
+
"305": "Use Proxy",
|
| 22 |
+
"307": "Temporary Redirect",
|
| 23 |
+
"308": "Permanent Redirect",
|
| 24 |
+
"400": "Bad Request",
|
| 25 |
+
"401": "Unauthorized",
|
| 26 |
+
"402": "Payment Required",
|
| 27 |
+
"403": "Forbidden",
|
| 28 |
+
"404": "Not Found",
|
| 29 |
+
"405": "Method Not Allowed",
|
| 30 |
+
"406": "Not Acceptable",
|
| 31 |
+
"407": "Proxy Authentication Required",
|
| 32 |
+
"408": "Request Timeout",
|
| 33 |
+
"409": "Conflict",
|
| 34 |
+
"410": "Gone",
|
| 35 |
+
"411": "Length Required",
|
| 36 |
+
"412": "Precondition Failed",
|
| 37 |
+
"413": "Payload Too Large",
|
| 38 |
+
"414": "URI Too Long",
|
| 39 |
+
"415": "Unsupported Media Type",
|
| 40 |
+
"416": "Range Not Satisfiable",
|
| 41 |
+
"417": "Expectation Failed",
|
| 42 |
+
"418": "I'm a Teapot",
|
| 43 |
+
"421": "Misdirected Request",
|
| 44 |
+
"422": "Unprocessable Entity",
|
| 45 |
+
"423": "Locked",
|
| 46 |
+
"424": "Failed Dependency",
|
| 47 |
+
"425": "Too Early",
|
| 48 |
+
"426": "Upgrade Required",
|
| 49 |
+
"428": "Precondition Required",
|
| 50 |
+
"429": "Too Many Requests",
|
| 51 |
+
"431": "Request Header Fields Too Large",
|
| 52 |
+
"451": "Unavailable For Legal Reasons",
|
| 53 |
+
"500": "Internal Server Error",
|
| 54 |
+
"501": "Not Implemented",
|
| 55 |
+
"502": "Bad Gateway",
|
| 56 |
+
"503": "Service Unavailable",
|
| 57 |
+
"504": "Gateway Timeout",
|
| 58 |
+
"505": "HTTP Version Not Supported",
|
| 59 |
+
"506": "Variant Also Negotiates",
|
| 60 |
+
"507": "Insufficient Storage",
|
| 61 |
+
"508": "Loop Detected",
|
| 62 |
+
"509": "Bandwidth Limit Exceeded",
|
| 63 |
+
"510": "Not Extended",
|
| 64 |
+
"511": "Network Authentication Required"
|
| 65 |
+
}
|
loan-advisor-chatgpt-app/node_modules/statuses/index.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* statuses
|
| 3 |
+
* Copyright(c) 2014 Jonathan Ong
|
| 4 |
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
| 5 |
+
* MIT Licensed
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
'use strict'
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Module dependencies.
|
| 12 |
+
* @private
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
var codes = require('./codes.json')
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Module exports.
|
| 19 |
+
* @public
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
module.exports = status
|
| 23 |
+
|
| 24 |
+
// status code to message map
|
| 25 |
+
status.message = codes
|
| 26 |
+
|
| 27 |
+
// status message (lower-case) to code map
|
| 28 |
+
status.code = createMessageToStatusCodeMap(codes)
|
| 29 |
+
|
| 30 |
+
// array of status codes
|
| 31 |
+
status.codes = createStatusCodeList(codes)
|
| 32 |
+
|
| 33 |
+
// status codes for redirects
|
| 34 |
+
status.redirect = {
|
| 35 |
+
300: true,
|
| 36 |
+
301: true,
|
| 37 |
+
302: true,
|
| 38 |
+
303: true,
|
| 39 |
+
305: true,
|
| 40 |
+
307: true,
|
| 41 |
+
308: true
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// status codes for empty bodies
|
| 45 |
+
status.empty = {
|
| 46 |
+
204: true,
|
| 47 |
+
205: true,
|
| 48 |
+
304: true
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// status codes for when you should retry the request
|
| 52 |
+
status.retry = {
|
| 53 |
+
502: true,
|
| 54 |
+
503: true,
|
| 55 |
+
504: true
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Create a map of message to status code.
|
| 60 |
+
* @private
|
| 61 |
+
*/
|
| 62 |
+
|
| 63 |
+
function createMessageToStatusCodeMap (codes) {
|
| 64 |
+
var map = {}
|
| 65 |
+
|
| 66 |
+
Object.keys(codes).forEach(function forEachCode (code) {
|
| 67 |
+
var message = codes[code]
|
| 68 |
+
var status = Number(code)
|
| 69 |
+
|
| 70 |
+
// populate map
|
| 71 |
+
map[message.toLowerCase()] = status
|
| 72 |
+
})
|
| 73 |
+
|
| 74 |
+
return map
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Create a list of all status codes.
|
| 79 |
+
* @private
|
| 80 |
+
*/
|
| 81 |
+
|
| 82 |
+
function createStatusCodeList (codes) {
|
| 83 |
+
return Object.keys(codes).map(function mapCode (code) {
|
| 84 |
+
return Number(code)
|
| 85 |
+
})
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Get the status code for given message.
|
| 90 |
+
* @private
|
| 91 |
+
*/
|
| 92 |
+
|
| 93 |
+
function getStatusCode (message) {
|
| 94 |
+
var msg = message.toLowerCase()
|
| 95 |
+
|
| 96 |
+
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
| 97 |
+
throw new Error('invalid status message: "' + message + '"')
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
return status.code[msg]
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* Get the status message for given code.
|
| 105 |
+
* @private
|
| 106 |
+
*/
|
| 107 |
+
|
| 108 |
+
function getStatusMessage (code) {
|
| 109 |
+
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
| 110 |
+
throw new Error('invalid status code: ' + code)
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
return status.message[code]
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* Get the status code.
|
| 118 |
+
*
|
| 119 |
+
* Given a number, this will throw if it is not a known status
|
| 120 |
+
* code, otherwise the code will be returned. Given a string,
|
| 121 |
+
* the string will be parsed for a number and return the code
|
| 122 |
+
* if valid, otherwise will lookup the code assuming this is
|
| 123 |
+
* the status message.
|
| 124 |
+
*
|
| 125 |
+
* @param {string|number} code
|
| 126 |
+
* @returns {number}
|
| 127 |
+
* @public
|
| 128 |
+
*/
|
| 129 |
+
|
| 130 |
+
function status (code) {
|
| 131 |
+
if (typeof code === 'number') {
|
| 132 |
+
return getStatusMessage(code)
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
if (typeof code !== 'string') {
|
| 136 |
+
throw new TypeError('code must be a number or string')
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
// '403'
|
| 140 |
+
var n = parseInt(code, 10)
|
| 141 |
+
if (!isNaN(n)) {
|
| 142 |
+
return getStatusMessage(n)
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
return getStatusCode(code)
|
| 146 |
+
}
|
loan-advisor-chatgpt-app/node_modules/statuses/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "statuses",
|
| 3 |
+
"description": "HTTP status utility",
|
| 4 |
+
"version": "2.0.2",
|
| 5 |
+
"contributors": [
|
| 6 |
+
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
| 7 |
+
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
| 8 |
+
],
|
| 9 |
+
"repository": "jshttp/statuses",
|
| 10 |
+
"license": "MIT",
|
| 11 |
+
"keywords": [
|
| 12 |
+
"http",
|
| 13 |
+
"status",
|
| 14 |
+
"code"
|
| 15 |
+
],
|
| 16 |
+
"files": [
|
| 17 |
+
"HISTORY.md",
|
| 18 |
+
"index.js",
|
| 19 |
+
"codes.json",
|
| 20 |
+
"LICENSE"
|
| 21 |
+
],
|
| 22 |
+
"devDependencies": {
|
| 23 |
+
"csv-parse": "4.16.3",
|
| 24 |
+
"eslint": "7.19.0",
|
| 25 |
+
"eslint-config-standard": "14.1.1",
|
| 26 |
+
"eslint-plugin-import": "2.31.0",
|
| 27 |
+
"eslint-plugin-markdown": "1.0.2",
|
| 28 |
+
"eslint-plugin-node": "11.1.0",
|
| 29 |
+
"eslint-plugin-promise": "4.3.1",
|
| 30 |
+
"eslint-plugin-standard": "4.1.0",
|
| 31 |
+
"mocha": "8.4.0",
|
| 32 |
+
"nyc": "15.1.0",
|
| 33 |
+
"raw-body": "2.5.2",
|
| 34 |
+
"stream-to-array": "2.3.0"
|
| 35 |
+
},
|
| 36 |
+
"engines": {
|
| 37 |
+
"node": ">= 0.8"
|
| 38 |
+
},
|
| 39 |
+
"scripts": {
|
| 40 |
+
"build": "node scripts/build.js",
|
| 41 |
+
"fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
|
| 42 |
+
"lint": "eslint --plugin markdown --ext js,md .",
|
| 43 |
+
"test": "mocha --reporter spec --check-leaks --bail test/",
|
| 44 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
| 45 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
| 46 |
+
"update": "npm run fetch && npm run build",
|
| 47 |
+
"version": "node scripts/version-history.js && git add HISTORY.md"
|
| 48 |
+
}
|
| 49 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export * from "./lib/index.js";
|
| 2 |
+
export type LightOptions = import('./lib/index.js').LightOptions;
|
| 3 |
+
export type Options = import('./lib/index.js').Options;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('./lib/index.js').LightOptions} LightOptions
|
| 3 |
+
* @typedef {import('./lib/index.js').Options} Options
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
export * from './lib/index.js'
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/constant/dangerous.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* List of legacy (that don’t need a trailing `;`) named references which could,
|
| 3 |
+
* depending on what follows them, turn into a different meaning
|
| 4 |
+
*
|
| 5 |
+
* @type {Array<string>}
|
| 6 |
+
*/
|
| 7 |
+
export const dangerous: Array<string>;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/constant/dangerous.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* List of legacy (that don’t need a trailing `;`) named references which could,
|
| 3 |
+
* depending on what follows them, turn into a different meaning
|
| 4 |
+
*
|
| 5 |
+
* @type {Array<string>}
|
| 6 |
+
*/
|
| 7 |
+
export const dangerous = [
|
| 8 |
+
'cent',
|
| 9 |
+
'copy',
|
| 10 |
+
'divide',
|
| 11 |
+
'gt',
|
| 12 |
+
'lt',
|
| 13 |
+
'not',
|
| 14 |
+
'para',
|
| 15 |
+
'times'
|
| 16 |
+
]
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/core.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Encode certain characters in `value`.
|
| 3 |
+
*
|
| 4 |
+
* @param {string} value
|
| 5 |
+
* @param {CoreWithFormatOptions} options
|
| 6 |
+
* @returns {string}
|
| 7 |
+
*/
|
| 8 |
+
export function core(value: string, options: CoreWithFormatOptions): string;
|
| 9 |
+
export type CoreOptions = {
|
| 10 |
+
/**
|
| 11 |
+
* Whether to only escape the given subset of characters.
|
| 12 |
+
*/
|
| 13 |
+
subset?: ReadonlyArray<string>;
|
| 14 |
+
/**
|
| 15 |
+
* Whether to only escape possibly dangerous characters.
|
| 16 |
+
* Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
|
| 17 |
+
*/
|
| 18 |
+
escapeOnly?: boolean;
|
| 19 |
+
};
|
| 20 |
+
export type FormatOptions = {
|
| 21 |
+
/**
|
| 22 |
+
* Format strategy.
|
| 23 |
+
*/
|
| 24 |
+
format: (code: number, next: number, options: CoreWithFormatOptions) => string;
|
| 25 |
+
};
|
| 26 |
+
export type CoreWithFormatOptions = CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/core.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef CoreOptions
|
| 3 |
+
* @property {ReadonlyArray<string>} [subset=[]]
|
| 4 |
+
* Whether to only escape the given subset of characters.
|
| 5 |
+
* @property {boolean} [escapeOnly=false]
|
| 6 |
+
* Whether to only escape possibly dangerous characters.
|
| 7 |
+
* Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
|
| 8 |
+
*
|
| 9 |
+
* @typedef FormatOptions
|
| 10 |
+
* @property {(code: number, next: number, options: CoreWithFormatOptions) => string} format
|
| 11 |
+
* Format strategy.
|
| 12 |
+
*
|
| 13 |
+
* @typedef {CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions} CoreWithFormatOptions
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
const defaultSubsetRegex = /["&'<>`]/g
|
| 17 |
+
const surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g
|
| 18 |
+
const controlCharactersRegex =
|
| 19 |
+
// eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
|
| 20 |
+
/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g
|
| 21 |
+
const regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g
|
| 22 |
+
|
| 23 |
+
/** @type {WeakMap<ReadonlyArray<string>, RegExp>} */
|
| 24 |
+
const subsetToRegexCache = new WeakMap()
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Encode certain characters in `value`.
|
| 28 |
+
*
|
| 29 |
+
* @param {string} value
|
| 30 |
+
* @param {CoreWithFormatOptions} options
|
| 31 |
+
* @returns {string}
|
| 32 |
+
*/
|
| 33 |
+
export function core(value, options) {
|
| 34 |
+
value = value.replace(
|
| 35 |
+
options.subset
|
| 36 |
+
? charactersToExpressionCached(options.subset)
|
| 37 |
+
: defaultSubsetRegex,
|
| 38 |
+
basic
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
if (options.subset || options.escapeOnly) {
|
| 42 |
+
return value
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return (
|
| 46 |
+
value
|
| 47 |
+
// Surrogate pairs.
|
| 48 |
+
.replace(surrogatePairsRegex, surrogate)
|
| 49 |
+
// BMP control characters (C0 except for LF, CR, SP; DEL; and some more
|
| 50 |
+
// non-ASCII ones).
|
| 51 |
+
.replace(controlCharactersRegex, basic)
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* @param {string} pair
|
| 56 |
+
* @param {number} index
|
| 57 |
+
* @param {string} all
|
| 58 |
+
*/
|
| 59 |
+
function surrogate(pair, index, all) {
|
| 60 |
+
return options.format(
|
| 61 |
+
(pair.charCodeAt(0) - 0xd800) * 0x400 +
|
| 62 |
+
pair.charCodeAt(1) -
|
| 63 |
+
0xdc00 +
|
| 64 |
+
0x10000,
|
| 65 |
+
all.charCodeAt(index + 2),
|
| 66 |
+
options
|
| 67 |
+
)
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* @param {string} character
|
| 72 |
+
* @param {number} index
|
| 73 |
+
* @param {string} all
|
| 74 |
+
*/
|
| 75 |
+
function basic(character, index, all) {
|
| 76 |
+
return options.format(
|
| 77 |
+
character.charCodeAt(0),
|
| 78 |
+
all.charCodeAt(index + 1),
|
| 79 |
+
options
|
| 80 |
+
)
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* A wrapper function that caches the result of `charactersToExpression` with a WeakMap.
|
| 86 |
+
* This can improve performance when tooling calls `charactersToExpression` repeatedly
|
| 87 |
+
* with the same subset.
|
| 88 |
+
*
|
| 89 |
+
* @param {ReadonlyArray<string>} subset
|
| 90 |
+
* @returns {RegExp}
|
| 91 |
+
*/
|
| 92 |
+
function charactersToExpressionCached(subset) {
|
| 93 |
+
let cached = subsetToRegexCache.get(subset)
|
| 94 |
+
|
| 95 |
+
if (!cached) {
|
| 96 |
+
cached = charactersToExpression(subset)
|
| 97 |
+
subsetToRegexCache.set(subset, cached)
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
return cached
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* @param {ReadonlyArray<string>} subset
|
| 105 |
+
* @returns {RegExp}
|
| 106 |
+
*/
|
| 107 |
+
function charactersToExpression(subset) {
|
| 108 |
+
/** @type {Array<string>} */
|
| 109 |
+
const groups = []
|
| 110 |
+
let index = -1
|
| 111 |
+
|
| 112 |
+
while (++index < subset.length) {
|
| 113 |
+
groups.push(subset[index].replace(regexEscapeRegex, '\\$&'))
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
return new RegExp('(?:' + groups.join('|') + ')', 'g')
|
| 117 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Encode special characters in `value`.
|
| 3 |
+
*
|
| 4 |
+
* @param {string} value
|
| 5 |
+
* Value to encode.
|
| 6 |
+
* @param {Options} [options]
|
| 7 |
+
* Configuration.
|
| 8 |
+
* @returns {string}
|
| 9 |
+
* Encoded value.
|
| 10 |
+
*/
|
| 11 |
+
export function stringifyEntities(value: string, options?: Options | undefined): string;
|
| 12 |
+
/**
|
| 13 |
+
* Encode special characters in `value` as hexadecimals.
|
| 14 |
+
*
|
| 15 |
+
* @param {string} value
|
| 16 |
+
* Value to encode.
|
| 17 |
+
* @param {LightOptions} [options]
|
| 18 |
+
* Configuration.
|
| 19 |
+
* @returns {string}
|
| 20 |
+
* Encoded value.
|
| 21 |
+
*/
|
| 22 |
+
export function stringifyEntitiesLight(value: string, options?: import("./core.js").CoreOptions | undefined): string;
|
| 23 |
+
export type Options = import('./core.js').CoreOptions & import('./util/format-smart.js').FormatSmartOptions;
|
| 24 |
+
export type LightOptions = import('./core.js').CoreOptions;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('./core.js').CoreOptions & import('./util/format-smart.js').FormatSmartOptions} Options
|
| 3 |
+
* @typedef {import('./core.js').CoreOptions} LightOptions
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
import {core} from './core.js'
|
| 7 |
+
import {formatSmart} from './util/format-smart.js'
|
| 8 |
+
import {formatBasic} from './util/format-basic.js'
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Encode special characters in `value`.
|
| 12 |
+
*
|
| 13 |
+
* @param {string} value
|
| 14 |
+
* Value to encode.
|
| 15 |
+
* @param {Options} [options]
|
| 16 |
+
* Configuration.
|
| 17 |
+
* @returns {string}
|
| 18 |
+
* Encoded value.
|
| 19 |
+
*/
|
| 20 |
+
export function stringifyEntities(value, options) {
|
| 21 |
+
return core(value, Object.assign({format: formatSmart}, options))
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Encode special characters in `value` as hexadecimals.
|
| 26 |
+
*
|
| 27 |
+
* @param {string} value
|
| 28 |
+
* Value to encode.
|
| 29 |
+
* @param {LightOptions} [options]
|
| 30 |
+
* Configuration.
|
| 31 |
+
* @returns {string}
|
| 32 |
+
* Encoded value.
|
| 33 |
+
*/
|
| 34 |
+
export function stringifyEntitiesLight(value, options) {
|
| 35 |
+
return core(value, Object.assign({format: formatBasic}, options))
|
| 36 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-basic.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* The smallest way to encode a character.
|
| 3 |
+
*
|
| 4 |
+
* @param {number} code
|
| 5 |
+
* @returns {string}
|
| 6 |
+
*/
|
| 7 |
+
export function formatBasic(code: number): string;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-basic.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* The smallest way to encode a character.
|
| 3 |
+
*
|
| 4 |
+
* @param {number} code
|
| 5 |
+
* @returns {string}
|
| 6 |
+
*/
|
| 7 |
+
export function formatBasic(code) {
|
| 8 |
+
return '&#x' + code.toString(16).toUpperCase() + ';'
|
| 9 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-smart.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Configurable ways to encode a character yielding pretty or small results.
|
| 3 |
+
*
|
| 4 |
+
* @param {number} code
|
| 5 |
+
* @param {number} next
|
| 6 |
+
* @param {FormatSmartOptions} options
|
| 7 |
+
* @returns {string}
|
| 8 |
+
*/
|
| 9 |
+
export function formatSmart(code: number, next: number, options: FormatSmartOptions): string;
|
| 10 |
+
export type FormatSmartOptions = {
|
| 11 |
+
/**
|
| 12 |
+
* Prefer named character references (`&`) where possible.
|
| 13 |
+
*/
|
| 14 |
+
useNamedReferences?: boolean;
|
| 15 |
+
/**
|
| 16 |
+
* Prefer the shortest possible reference, if that results in less bytes.
|
| 17 |
+
* **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.
|
| 18 |
+
*/
|
| 19 |
+
useShortestReferences?: boolean;
|
| 20 |
+
/**
|
| 21 |
+
* Whether to omit semicolons when possible.
|
| 22 |
+
* **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.
|
| 23 |
+
* Omitting semicolons is possible for certain named and numeric references in some cases.
|
| 24 |
+
*/
|
| 25 |
+
omitOptionalSemicolons?: boolean;
|
| 26 |
+
/**
|
| 27 |
+
* Create character references which don’t fail in attributes.
|
| 28 |
+
* **Note**: `attribute` only applies when operating dangerously with
|
| 29 |
+
* `omitOptionalSemicolons: true`.
|
| 30 |
+
*/
|
| 31 |
+
attribute?: boolean;
|
| 32 |
+
};
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/format-smart.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef FormatSmartOptions
|
| 3 |
+
* @property {boolean} [useNamedReferences=false]
|
| 4 |
+
* Prefer named character references (`&`) where possible.
|
| 5 |
+
* @property {boolean} [useShortestReferences=false]
|
| 6 |
+
* Prefer the shortest possible reference, if that results in less bytes.
|
| 7 |
+
* **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.
|
| 8 |
+
* @property {boolean} [omitOptionalSemicolons=false]
|
| 9 |
+
* Whether to omit semicolons when possible.
|
| 10 |
+
* **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.
|
| 11 |
+
* Omitting semicolons is possible for certain named and numeric references in some cases.
|
| 12 |
+
* @property {boolean} [attribute=false]
|
| 13 |
+
* Create character references which don’t fail in attributes.
|
| 14 |
+
* **Note**: `attribute` only applies when operating dangerously with
|
| 15 |
+
* `omitOptionalSemicolons: true`.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
import {toHexadecimal} from './to-hexadecimal.js'
|
| 19 |
+
import {toDecimal} from './to-decimal.js'
|
| 20 |
+
import {toNamed} from './to-named.js'
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Configurable ways to encode a character yielding pretty or small results.
|
| 24 |
+
*
|
| 25 |
+
* @param {number} code
|
| 26 |
+
* @param {number} next
|
| 27 |
+
* @param {FormatSmartOptions} options
|
| 28 |
+
* @returns {string}
|
| 29 |
+
*/
|
| 30 |
+
export function formatSmart(code, next, options) {
|
| 31 |
+
let numeric = toHexadecimal(code, next, options.omitOptionalSemicolons)
|
| 32 |
+
/** @type {string|undefined} */
|
| 33 |
+
let named
|
| 34 |
+
|
| 35 |
+
if (options.useNamedReferences || options.useShortestReferences) {
|
| 36 |
+
named = toNamed(
|
| 37 |
+
code,
|
| 38 |
+
next,
|
| 39 |
+
options.omitOptionalSemicolons,
|
| 40 |
+
options.attribute
|
| 41 |
+
)
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// Use the shortest numeric reference when requested.
|
| 45 |
+
// A simple algorithm would use decimal for all code points under 100, as
|
| 46 |
+
// those are shorter than hexadecimal:
|
| 47 |
+
//
|
| 48 |
+
// * `c` vs `c` (decimal shorter)
|
| 49 |
+
// * `d` vs `d` (equal)
|
| 50 |
+
//
|
| 51 |
+
// However, because we take `next` into consideration when `omit` is used,
|
| 52 |
+
// And it would be possible that decimals are shorter on bigger values as
|
| 53 |
+
// well if `next` is hexadecimal but not decimal, we instead compare both.
|
| 54 |
+
if (
|
| 55 |
+
(options.useShortestReferences || !named) &&
|
| 56 |
+
options.useShortestReferences
|
| 57 |
+
) {
|
| 58 |
+
const decimal = toDecimal(code, next, options.omitOptionalSemicolons)
|
| 59 |
+
|
| 60 |
+
if (decimal.length < numeric.length) {
|
| 61 |
+
numeric = decimal
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
return named &&
|
| 66 |
+
(!options.useShortestReferences || named.length < numeric.length)
|
| 67 |
+
? named
|
| 68 |
+
: numeric
|
| 69 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-decimal.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Configurable ways to encode characters as decimal references.
|
| 3 |
+
*
|
| 4 |
+
* @param {number} code
|
| 5 |
+
* @param {number} next
|
| 6 |
+
* @param {boolean|undefined} omit
|
| 7 |
+
* @returns {string}
|
| 8 |
+
*/
|
| 9 |
+
export function toDecimal(code: number, next: number, omit: boolean | undefined): string;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-decimal.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const decimalRegex = /\d/
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Configurable ways to encode characters as decimal references.
|
| 5 |
+
*
|
| 6 |
+
* @param {number} code
|
| 7 |
+
* @param {number} next
|
| 8 |
+
* @param {boolean|undefined} omit
|
| 9 |
+
* @returns {string}
|
| 10 |
+
*/
|
| 11 |
+
export function toDecimal(code, next, omit) {
|
| 12 |
+
const value = '&#' + String(code)
|
| 13 |
+
return omit && next && !decimalRegex.test(String.fromCharCode(next))
|
| 14 |
+
? value
|
| 15 |
+
: value + ';'
|
| 16 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-hexadecimal.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Configurable ways to encode characters as hexadecimal references.
|
| 3 |
+
*
|
| 4 |
+
* @param {number} code
|
| 5 |
+
* @param {number} next
|
| 6 |
+
* @param {boolean|undefined} omit
|
| 7 |
+
* @returns {string}
|
| 8 |
+
*/
|
| 9 |
+
export function toHexadecimal(code: number, next: number, omit: boolean | undefined): string;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-hexadecimal.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const hexadecimalRegex = /[\dA-Fa-f]/
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Configurable ways to encode characters as hexadecimal references.
|
| 5 |
+
*
|
| 6 |
+
* @param {number} code
|
| 7 |
+
* @param {number} next
|
| 8 |
+
* @param {boolean|undefined} omit
|
| 9 |
+
* @returns {string}
|
| 10 |
+
*/
|
| 11 |
+
export function toHexadecimal(code, next, omit) {
|
| 12 |
+
const value = '&#x' + code.toString(16).toUpperCase()
|
| 13 |
+
return omit && next && !hexadecimalRegex.test(String.fromCharCode(next))
|
| 14 |
+
? value
|
| 15 |
+
: value + ';'
|
| 16 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-named.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Configurable ways to encode characters as named references.
|
| 3 |
+
*
|
| 4 |
+
* @param {number} code
|
| 5 |
+
* @param {number} next
|
| 6 |
+
* @param {boolean|undefined} omit
|
| 7 |
+
* @param {boolean|undefined} attribute
|
| 8 |
+
* @returns {string}
|
| 9 |
+
*/
|
| 10 |
+
export function toNamed(code: number, next: number, omit: boolean | undefined, attribute: boolean | undefined): string;
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/lib/util/to-named.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {characterEntitiesLegacy} from 'character-entities-legacy'
|
| 2 |
+
import {characterEntitiesHtml4} from 'character-entities-html4'
|
| 3 |
+
import {dangerous} from '../constant/dangerous.js'
|
| 4 |
+
|
| 5 |
+
const own = {}.hasOwnProperty
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* `characterEntitiesHtml4` but inverted.
|
| 9 |
+
*
|
| 10 |
+
* @type {Record<string, string>}
|
| 11 |
+
*/
|
| 12 |
+
const characters = {}
|
| 13 |
+
|
| 14 |
+
/** @type {string} */
|
| 15 |
+
let key
|
| 16 |
+
|
| 17 |
+
for (key in characterEntitiesHtml4) {
|
| 18 |
+
if (own.call(characterEntitiesHtml4, key)) {
|
| 19 |
+
characters[characterEntitiesHtml4[key]] = key
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
const notAlphanumericRegex = /[^\dA-Za-z]/
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Configurable ways to encode characters as named references.
|
| 27 |
+
*
|
| 28 |
+
* @param {number} code
|
| 29 |
+
* @param {number} next
|
| 30 |
+
* @param {boolean|undefined} omit
|
| 31 |
+
* @param {boolean|undefined} attribute
|
| 32 |
+
* @returns {string}
|
| 33 |
+
*/
|
| 34 |
+
export function toNamed(code, next, omit, attribute) {
|
| 35 |
+
const character = String.fromCharCode(code)
|
| 36 |
+
|
| 37 |
+
if (own.call(characters, character)) {
|
| 38 |
+
const name = characters[character]
|
| 39 |
+
const value = '&' + name
|
| 40 |
+
|
| 41 |
+
if (
|
| 42 |
+
omit &&
|
| 43 |
+
characterEntitiesLegacy.includes(name) &&
|
| 44 |
+
!dangerous.includes(name) &&
|
| 45 |
+
(!attribute ||
|
| 46 |
+
(next &&
|
| 47 |
+
next !== 61 /* `=` */ &&
|
| 48 |
+
notAlphanumericRegex.test(String.fromCharCode(next))))
|
| 49 |
+
) {
|
| 50 |
+
return value
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
return value + ';'
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return ''
|
| 57 |
+
}
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015 Titus Wormer <mailto:tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
loan-advisor-chatgpt-app/node_modules/stringify-entities/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "stringify-entities",
|
| 3 |
+
"version": "4.0.4",
|
| 4 |
+
"description": "Serialize (encode) HTML character references",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"stringify",
|
| 8 |
+
"encode",
|
| 9 |
+
"escape",
|
| 10 |
+
"html",
|
| 11 |
+
"character",
|
| 12 |
+
"reference",
|
| 13 |
+
"entity",
|
| 14 |
+
"entities"
|
| 15 |
+
],
|
| 16 |
+
"repository": "wooorm/stringify-entities",
|
| 17 |
+
"bugs": "https://github.com/wooorm/stringify-entities/issues",
|
| 18 |
+
"funding": {
|
| 19 |
+
"type": "github",
|
| 20 |
+
"url": "https://github.com/sponsors/wooorm"
|
| 21 |
+
},
|
| 22 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 23 |
+
"contributors": [
|
| 24 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 25 |
+
],
|
| 26 |
+
"sideEffects": false,
|
| 27 |
+
"type": "module",
|
| 28 |
+
"main": "index.js",
|
| 29 |
+
"types": "index.d.ts",
|
| 30 |
+
"files": [
|
| 31 |
+
"lib/",
|
| 32 |
+
"index.d.ts",
|
| 33 |
+
"index.js"
|
| 34 |
+
],
|
| 35 |
+
"dependencies": {
|
| 36 |
+
"character-entities-html4": "^2.0.0",
|
| 37 |
+
"character-entities-legacy": "^3.0.0"
|
| 38 |
+
},
|
| 39 |
+
"devDependencies": {
|
| 40 |
+
"@types/node": "^20.0.0",
|
| 41 |
+
"c8": "^9.0.0",
|
| 42 |
+
"character-entities": "^2.0.0",
|
| 43 |
+
"prettier": "^3.0.0",
|
| 44 |
+
"remark-cli": "^11.0.0",
|
| 45 |
+
"remark-preset-wooorm": "^9.0.0",
|
| 46 |
+
"type-coverage": "^2.0.0",
|
| 47 |
+
"typescript": "^5.0.0",
|
| 48 |
+
"xo": "^0.58.0"
|
| 49 |
+
},
|
| 50 |
+
"scripts": {
|
| 51 |
+
"prepack": "npm run build && npm run format",
|
| 52 |
+
"generate": "node --conditions development build.js",
|
| 53 |
+
"build": "tsc --build --clean && tsc --build && type-coverage",
|
| 54 |
+
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
|
| 55 |
+
"test-api": "node --conditions development test.js",
|
| 56 |
+
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
|
| 57 |
+
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
|
| 58 |
+
},
|
| 59 |
+
"prettier": {
|
| 60 |
+
"tabWidth": 2,
|
| 61 |
+
"useTabs": false,
|
| 62 |
+
"singleQuote": true,
|
| 63 |
+
"bracketSpacing": false,
|
| 64 |
+
"semi": false,
|
| 65 |
+
"trailingComma": "none"
|
| 66 |
+
},
|
| 67 |
+
"xo": {
|
| 68 |
+
"prettier": true,
|
| 69 |
+
"rules": {
|
| 70 |
+
"unicorn/prefer-code-point": "off",
|
| 71 |
+
"unicorn/prefer-string-replace-all": "off",
|
| 72 |
+
"unicorn/numeric-separators-style": "off"
|
| 73 |
+
}
|
| 74 |
+
},
|
| 75 |
+
"remarkConfig": {
|
| 76 |
+
"plugins": [
|
| 77 |
+
"preset-wooorm"
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
"typeCoverage": {
|
| 81 |
+
"atLeast": 100,
|
| 82 |
+
"detail": true,
|
| 83 |
+
"strict": true,
|
| 84 |
+
"ignoreCatch": true
|
| 85 |
+
}
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# stringify-entities
|
| 2 |
+
|
| 3 |
+
[![Build Status][build-badge]][build]
|
| 4 |
+
[![Coverage Status][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
|
| 8 |
+
Serialize (encode) HTML character references.
|
| 9 |
+
|
| 10 |
+
## Contents
|
| 11 |
+
|
| 12 |
+
* [What is this?](#what-is-this)
|
| 13 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 14 |
+
* [Install](#install)
|
| 15 |
+
* [Use](#use)
|
| 16 |
+
* [API](#api)
|
| 17 |
+
* [`stringifyEntities(value[, options])`](#stringifyentitiesvalue-options)
|
| 18 |
+
* [Algorithm](#algorithm)
|
| 19 |
+
* [Types](#types)
|
| 20 |
+
* [Compatibility](#compatibility)
|
| 21 |
+
* [Security](#security)
|
| 22 |
+
* [Related](#related)
|
| 23 |
+
* [Contribute](#contribute)
|
| 24 |
+
* [License](#license)
|
| 25 |
+
|
| 26 |
+
## What is this?
|
| 27 |
+
|
| 28 |
+
This is a small and powerful encoder of HTML character references (often called
|
| 29 |
+
entities).
|
| 30 |
+
This one has either all the options you need for a minifier/formatter, or a
|
| 31 |
+
tiny size when using `stringifyEntitiesLight`.
|
| 32 |
+
|
| 33 |
+
## When should I use this?
|
| 34 |
+
|
| 35 |
+
You can use this for spec-compliant encoding of character references.
|
| 36 |
+
It’s small and fast enough to do that well.
|
| 37 |
+
You can also use this when making an HTML formatter or minifier, because there
|
| 38 |
+
are different ways to produce pretty or tiny output.
|
| 39 |
+
This package is reliable: ``'`'`` characters are encoded to ensure no scripts
|
| 40 |
+
run in Internet Explorer 6 to 8.
|
| 41 |
+
Additionally, only named references recognized by HTML 4 are encoded, meaning
|
| 42 |
+
the infamous `'` (which people think is a [virus][]) won’t show up.
|
| 43 |
+
|
| 44 |
+
## Install
|
| 45 |
+
|
| 46 |
+
This package is [ESM only][esm].
|
| 47 |
+
In Node.js (version 14.14+, 16.0+), install with [npm][]:
|
| 48 |
+
|
| 49 |
+
```sh
|
| 50 |
+
npm install stringify-entities
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 54 |
+
|
| 55 |
+
```js
|
| 56 |
+
import {stringifyEntities} from 'https://esm.sh/stringify-entities@4'
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 60 |
+
|
| 61 |
+
```html
|
| 62 |
+
<script type="module">
|
| 63 |
+
import {stringifyEntities} from 'https://esm.sh/stringify-entities@4?bundle'
|
| 64 |
+
</script>
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Use
|
| 68 |
+
|
| 69 |
+
```js
|
| 70 |
+
import {stringifyEntities} from 'stringify-entities'
|
| 71 |
+
|
| 72 |
+
stringifyEntities('alpha © bravo ≠ charlie 𝌆 delta')
|
| 73 |
+
// => 'alpha © bravo ≠ charlie 𝌆 delta'
|
| 74 |
+
|
| 75 |
+
stringifyEntities('alpha © bravo ≠ charlie 𝌆 delta', {useNamedReferences: true})
|
| 76 |
+
// => 'alpha © bravo ≠ charlie 𝌆 delta'
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## API
|
| 80 |
+
|
| 81 |
+
This package exports the identifiers `stringifyEntities` and
|
| 82 |
+
`stringifyEntitiesLight`.
|
| 83 |
+
There is no default export.
|
| 84 |
+
|
| 85 |
+
### `stringifyEntities(value[, options])`
|
| 86 |
+
|
| 87 |
+
Encode special characters in `value`.
|
| 88 |
+
|
| 89 |
+
##### Core options
|
| 90 |
+
|
| 91 |
+
###### `options.escapeOnly`
|
| 92 |
+
|
| 93 |
+
Whether to only escape possibly dangerous characters (`boolean`, default:
|
| 94 |
+
`false`).
|
| 95 |
+
Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
|
| 96 |
+
|
| 97 |
+
###### `options.subset`
|
| 98 |
+
|
| 99 |
+
Whether to only escape the given subset of characters (`Array<string>`).
|
| 100 |
+
Note that only BMP characters are supported here (so no emoji).
|
| 101 |
+
|
| 102 |
+
##### Formatting options
|
| 103 |
+
|
| 104 |
+
If you do not care about the following options, use `stringifyEntitiesLight`,
|
| 105 |
+
which always outputs hexadecimal character references.
|
| 106 |
+
|
| 107 |
+
###### `options.useNamedReferences`
|
| 108 |
+
|
| 109 |
+
Prefer named character references (`&`) where possible (`boolean?`, default:
|
| 110 |
+
`false`).
|
| 111 |
+
|
| 112 |
+
###### `options.useShortestReferences`
|
| 113 |
+
|
| 114 |
+
Prefer the shortest possible reference, if that results in less bytes
|
| 115 |
+
(`boolean?`, default: `false`).
|
| 116 |
+
|
| 117 |
+
> ⚠️ **Note**: `useNamedReferences` can be omitted when using
|
| 118 |
+
> `useShortestReferences`.
|
| 119 |
+
|
| 120 |
+
###### `options.omitOptionalSemicolons`
|
| 121 |
+
|
| 122 |
+
Whether to omit semicolons when possible (`boolean?`, default: `false`).
|
| 123 |
+
|
| 124 |
+
> ⚠️ **Note**: This creates what HTML calls “parse errors” but is otherwise
|
| 125 |
+
> still valid HTML — don’t use this except when building a minifier.
|
| 126 |
+
> Omitting semicolons is possible for certain named and numeric references in
|
| 127 |
+
> some cases.
|
| 128 |
+
|
| 129 |
+
###### `options.attribute`
|
| 130 |
+
|
| 131 |
+
Create character references which don’t fail in attributes (`boolean?`, default:
|
| 132 |
+
`false`).
|
| 133 |
+
|
| 134 |
+
> ⚠️ **Note**: `attribute` only applies when operating dangerously with
|
| 135 |
+
> `omitOptionalSemicolons: true`.
|
| 136 |
+
|
| 137 |
+
#### Returns
|
| 138 |
+
|
| 139 |
+
Encoded value (`string`).
|
| 140 |
+
|
| 141 |
+
## Algorithm
|
| 142 |
+
|
| 143 |
+
By default, all dangerous, non-ASCII, and non-printable ASCII characters are
|
| 144 |
+
encoded.
|
| 145 |
+
A [subset][] of characters can be given to encode just those characters.
|
| 146 |
+
Alternatively, pass [`escapeOnly`][escapeonly] to escape just the dangerous
|
| 147 |
+
characters (`"`, `'`, `<`, `>`, `&`, `` ` ``).
|
| 148 |
+
By default, hexadecimal character references are used.
|
| 149 |
+
Pass [`useNamedReferences`][named] to use named character references when
|
| 150 |
+
possible, or [`useShortestReferences`][short] to use whichever is shortest:
|
| 151 |
+
decimal, hexadecimal, or named.
|
| 152 |
+
There is also a `stringifyEntitiesLight` export, which works just like
|
| 153 |
+
`stringifyEntities` but without the formatting options: it’s much smaller but
|
| 154 |
+
always outputs hexadecimal character references.
|
| 155 |
+
|
| 156 |
+
## Types
|
| 157 |
+
|
| 158 |
+
This package is fully typed with [TypeScript][].
|
| 159 |
+
It exports the additional types `Options` and `LightOptions` types.
|
| 160 |
+
|
| 161 |
+
## Compatibility
|
| 162 |
+
|
| 163 |
+
This package is at least compatible with all maintained versions of Node.js.
|
| 164 |
+
As of now, that is Node.js 14.14+ and 16.0+.
|
| 165 |
+
It also works in Deno and modern browsers.
|
| 166 |
+
|
| 167 |
+
## Security
|
| 168 |
+
|
| 169 |
+
This package is safe.
|
| 170 |
+
|
| 171 |
+
## Related
|
| 172 |
+
|
| 173 |
+
* [`parse-entities`](https://github.com/wooorm/parse-entities)
|
| 174 |
+
— parse (decode) HTML character references
|
| 175 |
+
* [`wooorm/character-entities`](https://github.com/wooorm/character-entities)
|
| 176 |
+
— info on character references
|
| 177 |
+
* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4)
|
| 178 |
+
— info on HTML 4 character references
|
| 179 |
+
* [`wooorm/character-entities-legacy`](https://github.com/wooorm/character-entities-legacy)
|
| 180 |
+
— info on legacy character references
|
| 181 |
+
* [`wooorm/character-reference-invalid`](https://github.com/wooorm/character-reference-invalid)
|
| 182 |
+
— info on invalid numeric character references
|
| 183 |
+
|
| 184 |
+
## Contribute
|
| 185 |
+
|
| 186 |
+
Yes please!
|
| 187 |
+
See [How to Contribute to Open Source][contribute].
|
| 188 |
+
|
| 189 |
+
## License
|
| 190 |
+
|
| 191 |
+
[MIT][license] © [Titus Wormer][author]
|
| 192 |
+
|
| 193 |
+
<!-- Definitions -->
|
| 194 |
+
|
| 195 |
+
[build-badge]: https://github.com/wooorm/stringify-entities/workflows/main/badge.svg
|
| 196 |
+
|
| 197 |
+
[build]: https://github.com/wooorm/stringify-entities/actions
|
| 198 |
+
|
| 199 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/stringify-entities.svg
|
| 200 |
+
|
| 201 |
+
[coverage]: https://codecov.io/github/wooorm/stringify-entities
|
| 202 |
+
|
| 203 |
+
[downloads-badge]: https://img.shields.io/npm/dm/stringify-entities.svg
|
| 204 |
+
|
| 205 |
+
[downloads]: https://www.npmjs.com/package/stringify-entities
|
| 206 |
+
|
| 207 |
+
[size-badge]: https://img.shields.io/bundlephobia/minzip/stringify-entities.svg
|
| 208 |
+
|
| 209 |
+
[size]: https://bundlephobia.com/result?p=stringify-entities
|
| 210 |
+
|
| 211 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 212 |
+
|
| 213 |
+
[esmsh]: https://esm.sh
|
| 214 |
+
|
| 215 |
+
[license]: license
|
| 216 |
+
|
| 217 |
+
[author]: https://wooorm.com
|
| 218 |
+
|
| 219 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 220 |
+
|
| 221 |
+
[typescript]: https://www.typescriptlang.org
|
| 222 |
+
|
| 223 |
+
[contribute]: https://opensource.guide/how-to-contribute/
|
| 224 |
+
|
| 225 |
+
[virus]: https://www.telegraph.co.uk/technology/advice/10516839/Why-do-some-apostrophes-get-replaced-with-andapos.html
|
| 226 |
+
|
| 227 |
+
[subset]: #optionssubset
|
| 228 |
+
|
| 229 |
+
[escapeonly]: #optionsescapeonly
|
| 230 |
+
|
| 231 |
+
[named]: #optionsusenamedreferences
|
| 232 |
+
|
| 233 |
+
[short]: #optionsuseshortestreferences
|
loan-advisor-chatgpt-app/node_modules/style-to-js/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2020 Menglin "Mark" Xu <mark@remarkablemark.org>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 19 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 20 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 21 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 22 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
loan-advisor-chatgpt-app/node_modules/style-to-js/README.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
|
| 5 |
+
[](https://www.npmjs.com/package/style-to-js)
|
| 6 |
+
[](https://bundlephobia.com/package/style-to-js)
|
| 7 |
+
[](https://github.com/remarkablemark/style-to-js/actions/workflows/build.yml)
|
| 8 |
+
[](https://codecov.io/gh/remarkablemark/style-to-js)
|
| 9 |
+
[](https://www.npmjs.com/package/style-to-js)
|
| 10 |
+
|
| 11 |
+
Parses CSS inline style to JavaScript object (camelCased):
|
| 12 |
+
|
| 13 |
+
```
|
| 14 |
+
StyleToJS(string)
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Example
|
| 18 |
+
|
| 19 |
+
```js
|
| 20 |
+
import parse from 'style-to-js';
|
| 21 |
+
|
| 22 |
+
parse('background-color: #BADA55;');
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Output:
|
| 26 |
+
|
| 27 |
+
```json
|
| 28 |
+
{ "backgroundColor": "#BADA55" }
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
[JSFiddle](https://jsfiddle.net/remarkablemark/04nob1y7/) | [Examples](https://github.com/remarkablemark/style-to-js/tree/master/examples)
|
| 32 |
+
|
| 33 |
+
## Install
|
| 34 |
+
|
| 35 |
+
[NPM](https://www.npmjs.com/package/style-to-js):
|
| 36 |
+
|
| 37 |
+
```sh
|
| 38 |
+
npm install style-to-js --save
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
[Yarn](https://yarnpkg.com/package/style-to-js):
|
| 42 |
+
|
| 43 |
+
```sh
|
| 44 |
+
yarn add style-to-js
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
[CDN](https://unpkg.com/style-to-js/):
|
| 48 |
+
|
| 49 |
+
```html
|
| 50 |
+
<script src="https://unpkg.com/style-to-js@latest/umd/style-to-js.min.js"></script>
|
| 51 |
+
<script>
|
| 52 |
+
window.StyleToJS(/* string */);
|
| 53 |
+
</script>
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
### Import
|
| 59 |
+
|
| 60 |
+
Import with ES Modules:
|
| 61 |
+
|
| 62 |
+
```js
|
| 63 |
+
import parse from 'style-to-js';
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
Require with CommonJS:
|
| 67 |
+
|
| 68 |
+
```js
|
| 69 |
+
const parse = require('style-to-js');
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
### Parse style
|
| 73 |
+
|
| 74 |
+
Parse single declaration:
|
| 75 |
+
|
| 76 |
+
```js
|
| 77 |
+
parse('line-height: 42');
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Output:
|
| 81 |
+
|
| 82 |
+
```json
|
| 83 |
+
{ "lineHeight": "42" }
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
> [!NOTE]
|
| 87 |
+
> Notice that the CSS property is camelCased.
|
| 88 |
+
|
| 89 |
+
Parse multiple declarations:
|
| 90 |
+
|
| 91 |
+
```js
|
| 92 |
+
parse(`
|
| 93 |
+
border-color: #ACE;
|
| 94 |
+
z-index: 1337;
|
| 95 |
+
`);
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Output:
|
| 99 |
+
|
| 100 |
+
```json
|
| 101 |
+
{
|
| 102 |
+
"borderColor": "#ACE",
|
| 103 |
+
"zIndex": "1337"
|
| 104 |
+
}
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
### Vendor prefix
|
| 108 |
+
|
| 109 |
+
Parse [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix):
|
| 110 |
+
|
| 111 |
+
```js
|
| 112 |
+
parse(`
|
| 113 |
+
-webkit-transition: all 4s ease;
|
| 114 |
+
-moz-transition: all 4s ease;
|
| 115 |
+
-ms-transition: all 4s ease;
|
| 116 |
+
-o-transition: all 4s ease;
|
| 117 |
+
-khtml-transition: all 4s ease;
|
| 118 |
+
`);
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Output:
|
| 122 |
+
|
| 123 |
+
```json
|
| 124 |
+
{
|
| 125 |
+
"webkitTransition": "all 4s ease",
|
| 126 |
+
"mozTransition": "all 4s ease",
|
| 127 |
+
"msTransition": "all 4s ease",
|
| 128 |
+
"oTransition": "all 4s ease",
|
| 129 |
+
"khtmlTransition": "all 4s ease"
|
| 130 |
+
}
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
### Custom property
|
| 134 |
+
|
| 135 |
+
Parse [custom property](https://developer.mozilla.org/en-US/docs/Web/CSS/--*):
|
| 136 |
+
|
| 137 |
+
```js
|
| 138 |
+
parse('--custom-property: #f00');
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
Output:
|
| 142 |
+
|
| 143 |
+
```json
|
| 144 |
+
{ "--custom-property": "#f00" }
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
### Unknown declaration
|
| 148 |
+
|
| 149 |
+
This library does not validate declarations, so unknown declarations can be parsed:
|
| 150 |
+
|
| 151 |
+
```js
|
| 152 |
+
parse('the-answer: 42;');
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
Output:
|
| 156 |
+
|
| 157 |
+
```json
|
| 158 |
+
{ "theAnswer": "42" }
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
### Invalid declaration
|
| 162 |
+
|
| 163 |
+
Declarations with missing value are removed:
|
| 164 |
+
|
| 165 |
+
```js
|
| 166 |
+
parse(`
|
| 167 |
+
margin-top: ;
|
| 168 |
+
margin-right: 1em;
|
| 169 |
+
`);
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
Output:
|
| 173 |
+
|
| 174 |
+
```json
|
| 175 |
+
{ "marginRight": "1em" }
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
Other invalid declarations or arguments:
|
| 179 |
+
|
| 180 |
+
```js
|
| 181 |
+
parse(); // {}
|
| 182 |
+
parse(null); // {}
|
| 183 |
+
parse(1); // {}
|
| 184 |
+
parse(true); // {}
|
| 185 |
+
parse('top:'); // {}
|
| 186 |
+
parse(':12px'); // {}
|
| 187 |
+
parse(':'); // {}
|
| 188 |
+
parse(';'); // {}
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
The following values will throw an error:
|
| 192 |
+
|
| 193 |
+
```js
|
| 194 |
+
parse('top'); // Uncaught Error: property missing ':'
|
| 195 |
+
parse('/*'); // Uncaught Error: End of comment missing
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
### Options
|
| 199 |
+
|
| 200 |
+
#### reactCompat
|
| 201 |
+
|
| 202 |
+
When option `reactCompat` is true, the [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) will be capitalized:
|
| 203 |
+
|
| 204 |
+
```js
|
| 205 |
+
parse(
|
| 206 |
+
`
|
| 207 |
+
-webkit-transition: all 4s ease;
|
| 208 |
+
-moz-transition: all 4s ease;
|
| 209 |
+
-ms-transition: all 4s ease;
|
| 210 |
+
-o-transition: all 4s ease;
|
| 211 |
+
-khtml-transition: all 4s ease;
|
| 212 |
+
`,
|
| 213 |
+
{ reactCompat: true },
|
| 214 |
+
);
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
+
Output:
|
| 218 |
+
|
| 219 |
+
```json
|
| 220 |
+
{
|
| 221 |
+
"WebkitTransition": "all 4s ease",
|
| 222 |
+
"MozTransition": "all 4s ease",
|
| 223 |
+
"msTransition": "all 4s ease",
|
| 224 |
+
"OTransition": "all 4s ease",
|
| 225 |
+
"KhtmlTransition": "all 4s ease"
|
| 226 |
+
}
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
This removes the React warning:
|
| 230 |
+
|
| 231 |
+
```
|
| 232 |
+
Warning: Unsupported vendor-prefixed style property %s. Did you mean %s?%s", "oTransition", "OTransition"
|
| 233 |
+
```
|
| 234 |
+
|
| 235 |
+
## Testing
|
| 236 |
+
|
| 237 |
+
Run tests with coverage:
|
| 238 |
+
|
| 239 |
+
```sh
|
| 240 |
+
npm test
|
| 241 |
+
```
|
| 242 |
+
|
| 243 |
+
Run tests in watch mode:
|
| 244 |
+
|
| 245 |
+
```sh
|
| 246 |
+
npm run test:watch
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
Lint files:
|
| 250 |
+
|
| 251 |
+
```sh
|
| 252 |
+
npm run lint
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
Fix lint errors:
|
| 256 |
+
|
| 257 |
+
```sh
|
| 258 |
+
npm run lint:fix
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
## Release
|
| 262 |
+
|
| 263 |
+
Release and publish are automated by [Release Please](https://github.com/googleapis/release-please).
|
| 264 |
+
|
| 265 |
+
## Special Thanks
|
| 266 |
+
|
| 267 |
+
- [style-to-object](https://github.com/remarkablemark/style-to-object)
|
| 268 |
+
|
| 269 |
+
## License
|
| 270 |
+
|
| 271 |
+
[MIT](https://github.com/remarkablemark/style-to-js/blob/master/LICENSE)
|
loan-advisor-chatgpt-app/node_modules/style-to-js/cjs/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { CamelCaseOptions } from './utilities';
|
| 2 |
+
type StyleObject = Record<string, string>;
|
| 3 |
+
interface StyleToJSOptions extends CamelCaseOptions {
|
| 4 |
+
}
|
| 5 |
+
/**
|
| 6 |
+
* Parses CSS inline style to JavaScript object (camelCased).
|
| 7 |
+
*/
|
| 8 |
+
declare function StyleToJS(style: string, options?: StyleToJSOptions): StyleObject;
|
| 9 |
+
declare namespace StyleToJS {
|
| 10 |
+
var _a: typeof StyleToJS;
|
| 11 |
+
export { _a as default };
|
| 12 |
+
}
|
| 13 |
+
export = StyleToJS;
|
| 14 |
+
//# sourceMappingURL=index.d.ts.map
|