├── .github
├── FUNDING.yml
├── renovate.json
└── workflows
│ ├── ci.yml
│ └── publish.yml
├── .gitignore
├── .prettierignore
├── LICENSE
├── README.md
├── action.yml
├── dist
├── index.js
├── index.js.map
├── licenses.txt
└── sourcemap-register.js
├── package.json
├── src
└── main.ts
├── tests
└── enviroment.ts
├── tsconfig.json
└── yarn.lock
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [pocket-studios]
4 |
--------------------------------------------------------------------------------
/.github/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["config:base"],
3 | "schedule": ["every month"]
4 | }
5 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on: push
3 |
4 | jobs:
5 | ci:
6 | runs-on: ${{ matrix.os }}
7 | strategy:
8 | matrix:
9 | os: [ubuntu-latest, macos-latest, windows-latest]
10 | node: [with-node, without-node]
11 | exclude:
12 | - os: windows-latest
13 | node: without-node
14 | steps:
15 | - name: Checkout
16 | uses: actions/checkout@v2
17 | - name: Setup Node
18 | uses: actions/setup-node@v1
19 | if: ${{ matrix.node == 'with-node' }}
20 | - name: Install Dependencies
21 | run: yarn install
22 | - name: Run Linters
23 | run: yarn lint
24 | - name: Format Check
25 | run: yarn format
26 | - name: Build Package
27 | run: yarn build
28 | - name: Run Action
29 | uses: ./
30 | with:
31 | firebase-token: 'banana'
32 | - name: Run Tests
33 | run: yarn test
34 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish
2 | on:
3 | release:
4 | types: [published]
5 |
6 | jobs:
7 | publish:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout
11 | uses: actions/checkout@v2
12 | - name: Setup Node
13 | uses: actions/setup-node@v1
14 | - name: Install Dependencies
15 | run: yarn install
16 | - name: Build Package
17 | run: yarn build
18 | - name: Run Action
19 | uses: ./
20 | with:
21 | firebase-token: 'banana'
22 | - name: Run Tests
23 | run: yarn test
24 | - name: Update Version
25 | uses: pocket-studios/action-update-version@v1
26 | with:
27 | version-regexp: '\d'
28 | repo-token: ${{ secrets.GITHUB_TOKEN }}
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependency directory
2 | node_modules
3 |
4 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5 | # Logs
6 | logs
7 | *.log
8 | npm-debug.log*
9 | yarn-debug.log*
10 | yarn-error.log*
11 | lerna-debug.log*
12 |
13 | # Diagnostic reports (https://nodejs.org/api/report.html)
14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15 |
16 | # Runtime data
17 | pids
18 | *.pid
19 | *.seed
20 | *.pid.lock
21 |
22 | # Directory for instrumented libs generated by jscoverage/JSCover
23 | lib-cov
24 |
25 | # Coverage directory used by tools like istanbul
26 | coverage
27 | *.lcov
28 |
29 | # nyc test coverage
30 | .nyc_output
31 |
32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33 | .grunt
34 |
35 | # Bower dependency directory (https://bower.io/)
36 | bower_components
37 |
38 | # node-waf configuration
39 | .lock-wscript
40 |
41 | # Compiled binary addons (https://nodejs.org/api/addons.html)
42 | build/Release
43 |
44 | # Dependency directories
45 | jspm_packages/
46 |
47 | # TypeScript v1 declaration files
48 | typings/
49 |
50 | # TypeScript cache
51 | *.tsbuildinfo
52 |
53 | # Optional npm cache directory
54 | .npm
55 |
56 | # Optional eslint cache
57 | .eslintcache
58 |
59 | # Optional REPL history
60 | .node_repl_history
61 |
62 | # Output of 'npm pack'
63 | *.tgz
64 |
65 | # Yarn Integrity file
66 | .yarn-integrity
67 |
68 | # dotenv environment variables file
69 | .env
70 | .env.test
71 |
72 | # parcel-bundler cache (https://parceljs.org/)
73 | .cache
74 |
75 | # next.js build output
76 | .next
77 |
78 | # nuxt.js build output
79 | .nuxt
80 |
81 | # vuepress build output
82 | .vuepress/dist
83 |
84 | # Serverless directories
85 | .serverless/
86 |
87 | # FuseBox cache
88 | .fusebox/
89 |
90 | # DynamoDB Local files
91 | .dynamodb/
92 |
93 | # OS metadata
94 | .DS_Store
95 | Thumbs.db
96 |
97 | # Ignore built ts files
98 | tests/runner/*
99 | lib/**/*
100 |
101 | # Editors
102 | .vscode
103 | .idea
104 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist/
2 | lib/
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020 Pocket Studios, Inc. and contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
🔥 setup-firebase
3 |
Setup firebase-tools CLI for multiple steps
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | ## 🧠 Why
12 |
13 | There is an excellent action already: [firebase-action](https://github.com/w9jds/firebase-action), but it forces you to
14 | run a command in order to work.
15 |
16 | With this one, after running the action you can use the firebase-tools CLI from anywhere: npm script, shell...
17 |
18 | ## 🚀 Usage
19 |
20 | Simply add the action to get access to the firebase CLI.
21 |
22 | ```yaml
23 | jobs:
24 | setup-firebase:
25 | runs-on: ubuntu-latest
26 | steps:
27 | - uses: actions/checkout@v2
28 | - uses: actions/setup-node@v1 # This is optional on linux and macOS
29 | - uses: pocket-apps/action-setup-firebase@v2
30 | with:
31 | firebase-token: YOUR_TOKEN
32 | ```
33 |
34 | By default, it will try to download the package from npm, if it fails because npm is not installed, or it doesn't have
35 | sufficient permissions, the action will fallback to download it using `curl`.
36 |
37 | If you are running it on Windows you will need to use actions/setup-node before in order to work.
38 |
39 | ## ⚙ Inputs
40 |
41 | | **Name** | **Description** | **Required** |
42 | | -------------- | --------------------------------------------------------- | ------------ |
43 | | firebase-token | Firebase token you can get by running `firebase login:ci` | ✔ |
44 |
45 | ## 👋 Support
46 |
47 | If you find our work useful, you can [support our work](https://github.com/sponsors/pocket-studios) and win a burrito 🌯
48 |
--------------------------------------------------------------------------------
/action.yml:
--------------------------------------------------------------------------------
1 | name: Setup Firebase CLI
2 | description: Setup firebase-tools CLI
3 | author: Pocket Studios
4 | branding:
5 | color: red
6 | icon: terminal
7 | runs:
8 | using: 'node12'
9 | main: 'dist/index.js'
10 | inputs:
11 | firebase-token:
12 | required: true
13 | description: Firebase token you can get by running `firebase login:ci`
14 |
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | require('./sourcemap-register.js');module.exports =
2 | /******/ (() => { // webpackBootstrap
3 | /******/ var __webpack_modules__ = ({
4 |
5 | /***/ 109:
6 | /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
7 |
8 | "use strict";
9 |
10 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11 | if (k2 === undefined) k2 = k;
12 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
13 | }) : (function(o, m, k, k2) {
14 | if (k2 === undefined) k2 = k;
15 | o[k2] = m[k];
16 | }));
17 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18 | Object.defineProperty(o, "default", { enumerable: true, value: v });
19 | }) : function(o, v) {
20 | o["default"] = v;
21 | });
22 | var __importStar = (this && this.__importStar) || function (mod) {
23 | if (mod && mod.__esModule) return mod;
24 | var result = {};
25 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26 | __setModuleDefault(result, mod);
27 | return result;
28 | };
29 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
30 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
31 | return new (P || (P = Promise))(function (resolve, reject) {
32 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
34 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
35 | step((generator = generator.apply(thisArg, _arguments || [])).next());
36 | });
37 | };
38 | var __importDefault = (this && this.__importDefault) || function (mod) {
39 | return (mod && mod.__esModule) ? mod : { "default": mod };
40 | };
41 | Object.defineProperty(exports, "__esModule", ({ value: true }));
42 | const child_process_1 = __webpack_require__(129);
43 | const core = __importStar(__webpack_require__(186));
44 | const command_exists_1 = __importDefault(__webpack_require__(569));
45 | const installNpm = () => child_process_1.execSync('npm install -g firebase-tools');
46 | const installBash = () => child_process_1.execSync('curl -sL https://firebase.tools | bash');
47 | const run = () => __awaiter(void 0, void 0, void 0, function* () {
48 | const token = core.getInput('firebase-token');
49 | const os = process.env.RUNNER_OS;
50 | if (!token) {
51 | throw new Error('Missing mandatory input: firebase-token');
52 | }
53 | core.exportVariable('FIREBASE_TOKEN', token);
54 | core.info('Exported environment variable FIREBASE_TOKEN');
55 | if (yield command_exists_1.default('npm')) {
56 | core.info('Detected NPM installation');
57 | try {
58 | core.info('Trying to install firebase-tools using NPM');
59 | installNpm();
60 | }
61 | catch (e) {
62 | core.info('Installation failed through NPM (maybe you forgot actions/setup-node before this action)');
63 | core.info('Trying BASH instead');
64 | installBash();
65 | }
66 | }
67 | else if (os === 'Linux' || os === 'macOS') {
68 | core.info('Trying to install firebase-tools using BASH');
69 | installBash();
70 | }
71 | else if (os === 'Windows') {
72 | throw new Error('On windows you must setup node before running this action');
73 | }
74 | });
75 | run()
76 | .then(() => core.info('Successfully installed firebase-tools CLI'))
77 | .catch(error => core.setFailed(error.message));
78 |
79 |
80 | /***/ }),
81 |
82 | /***/ 351:
83 | /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
84 |
85 | "use strict";
86 |
87 | var __importStar = (this && this.__importStar) || function (mod) {
88 | if (mod && mod.__esModule) return mod;
89 | var result = {};
90 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
91 | result["default"] = mod;
92 | return result;
93 | };
94 | Object.defineProperty(exports, "__esModule", ({ value: true }));
95 | const os = __importStar(__webpack_require__(87));
96 | const utils_1 = __webpack_require__(278);
97 | /**
98 | * Commands
99 | *
100 | * Command Format:
101 | * ::name key=value,key=value::message
102 | *
103 | * Examples:
104 | * ::warning::This is the message
105 | * ::set-env name=MY_VAR::some value
106 | */
107 | function issueCommand(command, properties, message) {
108 | const cmd = new Command(command, properties, message);
109 | process.stdout.write(cmd.toString() + os.EOL);
110 | }
111 | exports.issueCommand = issueCommand;
112 | function issue(name, message = '') {
113 | issueCommand(name, {}, message);
114 | }
115 | exports.issue = issue;
116 | const CMD_STRING = '::';
117 | class Command {
118 | constructor(command, properties, message) {
119 | if (!command) {
120 | command = 'missing.command';
121 | }
122 | this.command = command;
123 | this.properties = properties;
124 | this.message = message;
125 | }
126 | toString() {
127 | let cmdStr = CMD_STRING + this.command;
128 | if (this.properties && Object.keys(this.properties).length > 0) {
129 | cmdStr += ' ';
130 | let first = true;
131 | for (const key in this.properties) {
132 | if (this.properties.hasOwnProperty(key)) {
133 | const val = this.properties[key];
134 | if (val) {
135 | if (first) {
136 | first = false;
137 | }
138 | else {
139 | cmdStr += ',';
140 | }
141 | cmdStr += `${key}=${escapeProperty(val)}`;
142 | }
143 | }
144 | }
145 | }
146 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
147 | return cmdStr;
148 | }
149 | }
150 | function escapeData(s) {
151 | return utils_1.toCommandValue(s)
152 | .replace(/%/g, '%25')
153 | .replace(/\r/g, '%0D')
154 | .replace(/\n/g, '%0A');
155 | }
156 | function escapeProperty(s) {
157 | return utils_1.toCommandValue(s)
158 | .replace(/%/g, '%25')
159 | .replace(/\r/g, '%0D')
160 | .replace(/\n/g, '%0A')
161 | .replace(/:/g, '%3A')
162 | .replace(/,/g, '%2C');
163 | }
164 | //# sourceMappingURL=command.js.map
165 |
166 | /***/ }),
167 |
168 | /***/ 186:
169 | /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
170 |
171 | "use strict";
172 |
173 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
174 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
175 | return new (P || (P = Promise))(function (resolve, reject) {
176 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
177 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
178 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
179 | step((generator = generator.apply(thisArg, _arguments || [])).next());
180 | });
181 | };
182 | var __importStar = (this && this.__importStar) || function (mod) {
183 | if (mod && mod.__esModule) return mod;
184 | var result = {};
185 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
186 | result["default"] = mod;
187 | return result;
188 | };
189 | Object.defineProperty(exports, "__esModule", ({ value: true }));
190 | const command_1 = __webpack_require__(351);
191 | const file_command_1 = __webpack_require__(717);
192 | const utils_1 = __webpack_require__(278);
193 | const os = __importStar(__webpack_require__(87));
194 | const path = __importStar(__webpack_require__(622));
195 | /**
196 | * The code to exit an action
197 | */
198 | var ExitCode;
199 | (function (ExitCode) {
200 | /**
201 | * A code indicating that the action was successful
202 | */
203 | ExitCode[ExitCode["Success"] = 0] = "Success";
204 | /**
205 | * A code indicating that the action was a failure
206 | */
207 | ExitCode[ExitCode["Failure"] = 1] = "Failure";
208 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
209 | //-----------------------------------------------------------------------
210 | // Variables
211 | //-----------------------------------------------------------------------
212 | /**
213 | * Sets env variable for this action and future actions in the job
214 | * @param name the name of the variable to set
215 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
216 | */
217 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
218 | function exportVariable(name, val) {
219 | const convertedVal = utils_1.toCommandValue(val);
220 | process.env[name] = convertedVal;
221 | const filePath = process.env['GITHUB_ENV'] || '';
222 | if (filePath) {
223 | const delimiter = '_GitHubActionsFileCommandDelimeter_';
224 | const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
225 | file_command_1.issueCommand('ENV', commandValue);
226 | }
227 | else {
228 | command_1.issueCommand('set-env', { name }, convertedVal);
229 | }
230 | }
231 | exports.exportVariable = exportVariable;
232 | /**
233 | * Registers a secret which will get masked from logs
234 | * @param secret value of the secret
235 | */
236 | function setSecret(secret) {
237 | command_1.issueCommand('add-mask', {}, secret);
238 | }
239 | exports.setSecret = setSecret;
240 | /**
241 | * Prepends inputPath to the PATH (for this action and future actions)
242 | * @param inputPath
243 | */
244 | function addPath(inputPath) {
245 | const filePath = process.env['GITHUB_PATH'] || '';
246 | if (filePath) {
247 | file_command_1.issueCommand('PATH', inputPath);
248 | }
249 | else {
250 | command_1.issueCommand('add-path', {}, inputPath);
251 | }
252 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
253 | }
254 | exports.addPath = addPath;
255 | /**
256 | * Gets the value of an input. The value is also trimmed.
257 | *
258 | * @param name name of the input to get
259 | * @param options optional. See InputOptions.
260 | * @returns string
261 | */
262 | function getInput(name, options) {
263 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
264 | if (options && options.required && !val) {
265 | throw new Error(`Input required and not supplied: ${name}`);
266 | }
267 | return val.trim();
268 | }
269 | exports.getInput = getInput;
270 | /**
271 | * Sets the value of an output.
272 | *
273 | * @param name name of the output to set
274 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify
275 | */
276 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
277 | function setOutput(name, value) {
278 | command_1.issueCommand('set-output', { name }, value);
279 | }
280 | exports.setOutput = setOutput;
281 | /**
282 | * Enables or disables the echoing of commands into stdout for the rest of the step.
283 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
284 | *
285 | */
286 | function setCommandEcho(enabled) {
287 | command_1.issue('echo', enabled ? 'on' : 'off');
288 | }
289 | exports.setCommandEcho = setCommandEcho;
290 | //-----------------------------------------------------------------------
291 | // Results
292 | //-----------------------------------------------------------------------
293 | /**
294 | * Sets the action status to failed.
295 | * When the action exits it will be with an exit code of 1
296 | * @param message add error issue message
297 | */
298 | function setFailed(message) {
299 | process.exitCode = ExitCode.Failure;
300 | error(message);
301 | }
302 | exports.setFailed = setFailed;
303 | //-----------------------------------------------------------------------
304 | // Logging Commands
305 | //-----------------------------------------------------------------------
306 | /**
307 | * Gets whether Actions Step Debug is on or not
308 | */
309 | function isDebug() {
310 | return process.env['RUNNER_DEBUG'] === '1';
311 | }
312 | exports.isDebug = isDebug;
313 | /**
314 | * Writes debug message to user log
315 | * @param message debug message
316 | */
317 | function debug(message) {
318 | command_1.issueCommand('debug', {}, message);
319 | }
320 | exports.debug = debug;
321 | /**
322 | * Adds an error issue
323 | * @param message error issue message. Errors will be converted to string via toString()
324 | */
325 | function error(message) {
326 | command_1.issue('error', message instanceof Error ? message.toString() : message);
327 | }
328 | exports.error = error;
329 | /**
330 | * Adds an warning issue
331 | * @param message warning issue message. Errors will be converted to string via toString()
332 | */
333 | function warning(message) {
334 | command_1.issue('warning', message instanceof Error ? message.toString() : message);
335 | }
336 | exports.warning = warning;
337 | /**
338 | * Writes info to log with console.log.
339 | * @param message info message
340 | */
341 | function info(message) {
342 | process.stdout.write(message + os.EOL);
343 | }
344 | exports.info = info;
345 | /**
346 | * Begin an output group.
347 | *
348 | * Output until the next `groupEnd` will be foldable in this group
349 | *
350 | * @param name The name of the output group
351 | */
352 | function startGroup(name) {
353 | command_1.issue('group', name);
354 | }
355 | exports.startGroup = startGroup;
356 | /**
357 | * End an output group.
358 | */
359 | function endGroup() {
360 | command_1.issue('endgroup');
361 | }
362 | exports.endGroup = endGroup;
363 | /**
364 | * Wrap an asynchronous function call in a group.
365 | *
366 | * Returns the same type as the function itself.
367 | *
368 | * @param name The name of the group
369 | * @param fn The function to wrap in the group
370 | */
371 | function group(name, fn) {
372 | return __awaiter(this, void 0, void 0, function* () {
373 | startGroup(name);
374 | let result;
375 | try {
376 | result = yield fn();
377 | }
378 | finally {
379 | endGroup();
380 | }
381 | return result;
382 | });
383 | }
384 | exports.group = group;
385 | //-----------------------------------------------------------------------
386 | // Wrapper action state
387 | //-----------------------------------------------------------------------
388 | /**
389 | * Saves state for current action, the state can only be retrieved by this action's post job execution.
390 | *
391 | * @param name name of the state to store
392 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify
393 | */
394 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
395 | function saveState(name, value) {
396 | command_1.issueCommand('save-state', { name }, value);
397 | }
398 | exports.saveState = saveState;
399 | /**
400 | * Gets the value of an state set by this action's main execution.
401 | *
402 | * @param name name of the state to get
403 | * @returns string
404 | */
405 | function getState(name) {
406 | return process.env[`STATE_${name}`] || '';
407 | }
408 | exports.getState = getState;
409 | //# sourceMappingURL=core.js.map
410 |
411 | /***/ }),
412 |
413 | /***/ 717:
414 | /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
415 |
416 | "use strict";
417 |
418 | // For internal use, subject to change.
419 | var __importStar = (this && this.__importStar) || function (mod) {
420 | if (mod && mod.__esModule) return mod;
421 | var result = {};
422 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
423 | result["default"] = mod;
424 | return result;
425 | };
426 | Object.defineProperty(exports, "__esModule", ({ value: true }));
427 | // We use any as a valid input type
428 | /* eslint-disable @typescript-eslint/no-explicit-any */
429 | const fs = __importStar(__webpack_require__(747));
430 | const os = __importStar(__webpack_require__(87));
431 | const utils_1 = __webpack_require__(278);
432 | function issueCommand(command, message) {
433 | const filePath = process.env[`GITHUB_${command}`];
434 | if (!filePath) {
435 | throw new Error(`Unable to find environment variable for file command ${command}`);
436 | }
437 | if (!fs.existsSync(filePath)) {
438 | throw new Error(`Missing file at path: ${filePath}`);
439 | }
440 | fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
441 | encoding: 'utf8'
442 | });
443 | }
444 | exports.issueCommand = issueCommand;
445 | //# sourceMappingURL=file-command.js.map
446 |
447 | /***/ }),
448 |
449 | /***/ 278:
450 | /***/ ((__unused_webpack_module, exports) => {
451 |
452 | "use strict";
453 |
454 | // We use any as a valid input type
455 | /* eslint-disable @typescript-eslint/no-explicit-any */
456 | Object.defineProperty(exports, "__esModule", ({ value: true }));
457 | /**
458 | * Sanitizes an input into a string so it can be passed into issueCommand safely
459 | * @param input input to sanitize into a string
460 | */
461 | function toCommandValue(input) {
462 | if (input === null || input === undefined) {
463 | return '';
464 | }
465 | else if (typeof input === 'string' || input instanceof String) {
466 | return input;
467 | }
468 | return JSON.stringify(input);
469 | }
470 | exports.toCommandValue = toCommandValue;
471 | //# sourceMappingURL=utils.js.map
472 |
473 | /***/ }),
474 |
475 | /***/ 569:
476 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
477 |
478 | module.exports = __webpack_require__(325);
479 |
480 |
481 | /***/ }),
482 |
483 | /***/ 325:
484 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
485 |
486 | "use strict";
487 |
488 |
489 | var exec = __webpack_require__(129).exec;
490 | var execSync = __webpack_require__(129).execSync;
491 | var fs = __webpack_require__(747);
492 | var path = __webpack_require__(622);
493 | var access = fs.access;
494 | var accessSync = fs.accessSync;
495 | var constants = fs.constants || fs;
496 |
497 | var isUsingWindows = process.platform == 'win32'
498 |
499 | var fileNotExists = function(commandName, callback){
500 | access(commandName, constants.F_OK,
501 | function(err){
502 | callback(!err);
503 | });
504 | };
505 |
506 | var fileNotExistsSync = function(commandName){
507 | try{
508 | accessSync(commandName, constants.F_OK);
509 | return false;
510 | }catch(e){
511 | return true;
512 | }
513 | };
514 |
515 | var localExecutable = function(commandName, callback){
516 | access(commandName, constants.F_OK | constants.X_OK,
517 | function(err){
518 | callback(null, !err);
519 | });
520 | };
521 |
522 | var localExecutableSync = function(commandName){
523 | try{
524 | accessSync(commandName, constants.F_OK | constants.X_OK);
525 | return true;
526 | }catch(e){
527 | return false;
528 | }
529 | }
530 |
531 | var commandExistsUnix = function(commandName, cleanedCommandName, callback) {
532 |
533 | fileNotExists(commandName, function(isFile){
534 |
535 | if(!isFile){
536 | var child = exec('command -v ' + cleanedCommandName +
537 | ' 2>/dev/null' +
538 | ' && { echo >&1 ' + cleanedCommandName + '; exit 0; }',
539 | function (error, stdout, stderr) {
540 | callback(null, !!stdout);
541 | });
542 | return;
543 | }
544 |
545 | localExecutable(commandName, callback);
546 | });
547 |
548 | }
549 |
550 | var commandExistsWindows = function(commandName, cleanedCommandName, callback) {
551 | // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
552 | if (!(/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName))) {
553 | callback(null, false);
554 | return;
555 | }
556 | var child = exec('where ' + cleanedCommandName,
557 | function (error) {
558 | if (error !== null){
559 | callback(null, false);
560 | } else {
561 | callback(null, true);
562 | }
563 | }
564 | )
565 | }
566 |
567 | var commandExistsUnixSync = function(commandName, cleanedCommandName) {
568 | if(fileNotExistsSync(commandName)){
569 | try {
570 | var stdout = execSync('command -v ' + cleanedCommandName +
571 | ' 2>/dev/null' +
572 | ' && { echo >&1 ' + cleanedCommandName + '; exit 0; }'
573 | );
574 | return !!stdout;
575 | } catch (error) {
576 | return false;
577 | }
578 | }
579 | return localExecutableSync(commandName);
580 | }
581 |
582 | var commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) {
583 | // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
584 | if (!(/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName))) {
585 | return false;
586 | }
587 | try {
588 | var stdout = execSync('where ' + cleanedCommandName, {stdio: []});
589 | return !!stdout;
590 | } catch (error) {
591 | return false;
592 | }
593 | }
594 |
595 | var cleanInput = function(s) {
596 | if (/[^A-Za-z0-9_\/:=-]/.test(s)) {
597 | s = "'"+s.replace(/'/g,"'\\''")+"'";
598 | s = s.replace(/^(?:'')+/g, '') // unduplicate single-quote at the beginning
599 | .replace(/\\'''/g, "\\'" ); // remove non-escaped single-quote if there are enclosed between 2 escaped
600 | }
601 | return s;
602 | }
603 |
604 | if (isUsingWindows) {
605 | cleanInput = function(s) {
606 | var isPathName = /[\\]/.test(s);
607 | if (isPathName) {
608 | var dirname = '"' + path.dirname(s) + '"';
609 | var basename = '"' + path.basename(s) + '"';
610 | return dirname + ':' + basename;
611 | }
612 | return '"' + s + '"';
613 | }
614 | }
615 |
616 | module.exports = function commandExists(commandName, callback) {
617 | var cleanedCommandName = cleanInput(commandName);
618 | if (!callback && typeof Promise !== 'undefined') {
619 | return new Promise(function(resolve, reject){
620 | commandExists(commandName, function(error, output) {
621 | if (output) {
622 | resolve(commandName);
623 | } else {
624 | reject(error);
625 | }
626 | });
627 | });
628 | }
629 | if (isUsingWindows) {
630 | commandExistsWindows(commandName, cleanedCommandName, callback);
631 | } else {
632 | commandExistsUnix(commandName, cleanedCommandName, callback);
633 | }
634 | };
635 |
636 | module.exports.sync = function(commandName) {
637 | var cleanedCommandName = cleanInput(commandName);
638 | if (isUsingWindows) {
639 | return commandExistsWindowsSync(commandName, cleanedCommandName);
640 | } else {
641 | return commandExistsUnixSync(commandName, cleanedCommandName);
642 | }
643 | };
644 |
645 |
646 | /***/ }),
647 |
648 | /***/ 129:
649 | /***/ ((module) => {
650 |
651 | "use strict";
652 | module.exports = require("child_process");
653 |
654 | /***/ }),
655 |
656 | /***/ 747:
657 | /***/ ((module) => {
658 |
659 | "use strict";
660 | module.exports = require("fs");
661 |
662 | /***/ }),
663 |
664 | /***/ 87:
665 | /***/ ((module) => {
666 |
667 | "use strict";
668 | module.exports = require("os");
669 |
670 | /***/ }),
671 |
672 | /***/ 622:
673 | /***/ ((module) => {
674 |
675 | "use strict";
676 | module.exports = require("path");
677 |
678 | /***/ })
679 |
680 | /******/ });
681 | /************************************************************************/
682 | /******/ // The module cache
683 | /******/ var __webpack_module_cache__ = {};
684 | /******/
685 | /******/ // The require function
686 | /******/ function __webpack_require__(moduleId) {
687 | /******/ // Check if module is in cache
688 | /******/ if(__webpack_module_cache__[moduleId]) {
689 | /******/ return __webpack_module_cache__[moduleId].exports;
690 | /******/ }
691 | /******/ // Create a new module (and put it into the cache)
692 | /******/ var module = __webpack_module_cache__[moduleId] = {
693 | /******/ // no module.id needed
694 | /******/ // no module.loaded needed
695 | /******/ exports: {}
696 | /******/ };
697 | /******/
698 | /******/ // Execute the module function
699 | /******/ var threw = true;
700 | /******/ try {
701 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
702 | /******/ threw = false;
703 | /******/ } finally {
704 | /******/ if(threw) delete __webpack_module_cache__[moduleId];
705 | /******/ }
706 | /******/
707 | /******/ // Return the exports of the module
708 | /******/ return module.exports;
709 | /******/ }
710 | /******/
711 | /************************************************************************/
712 | /******/ /* webpack/runtime/compat */
713 | /******/
714 | /******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
715 | /******/ // module exports must be returned from runtime so entry inlining is disabled
716 | /******/ // startup
717 | /******/ // Load entry module and return exports
718 | /******/ return __webpack_require__(109);
719 | /******/ })()
720 | ;
721 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/dist/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.js","sources":["../webpack://action-setup-firebase/./lib/main.js","../webpack://action-setup-firebase/./node_modules/@actions/core/lib/command.js","../webpack://action-setup-firebase/./node_modules/@actions/core/lib/core.js","../webpack://action-setup-firebase/./node_modules/@actions/core/lib/file-command.js","../webpack://action-setup-firebase/./node_modules/@actions/core/lib/utils.js","../webpack://action-setup-firebase/./node_modules/command-exists/index.js","../webpack://action-setup-firebase/./node_modules/command-exists/lib/command-exists.js","../webpack://action-setup-firebase/external \"child_process\"","../webpack://action-setup-firebase/external \"fs\"","../webpack://action-setup-firebase/external \"os\"","../webpack://action-setup-firebase/external \"path\"","../webpack://action-setup-firebase/webpack/bootstrap","../webpack://action-setup-firebase/webpack/runtime/compat","../webpack://action-setup-firebase/webpack/startup"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst child_process_1 = require(\"child_process\");\nconst core = __importStar(require(\"@actions/core\"));\nconst command_exists_1 = __importDefault(require(\"command-exists\"));\nconst installNpm = () => child_process_1.execSync('npm install -g firebase-tools');\nconst installBash = () => child_process_1.execSync('curl -sL https://firebase.tools | bash');\nconst run = () => __awaiter(void 0, void 0, void 0, function* () {\n const token = core.getInput('firebase-token');\n const os = process.env.RUNNER_OS;\n if (!token) {\n throw new Error('Missing mandatory input: firebase-token');\n }\n core.exportVariable('FIREBASE_TOKEN', token);\n core.info('Exported environment variable FIREBASE_TOKEN');\n if (yield command_exists_1.default('npm')) {\n core.info('Detected NPM installation');\n try {\n core.info('Trying to install firebase-tools using NPM');\n installNpm();\n }\n catch (e) {\n core.info('Installation failed through NPM (maybe you forgot actions/setup-node before this action)');\n core.info('Trying BASH instead');\n installBash();\n }\n }\n else if (os === 'Linux' || os === 'macOS') {\n core.info('Trying to install firebase-tools using BASH');\n installBash();\n }\n else if (os === 'Windows') {\n throw new Error('On windows you must setup node before running this action');\n }\n});\nrun()\n .then(() => core.info('Successfully installed firebase-tools CLI'))\n .catch(error => core.setFailed(error.message));\n","\"use strict\";\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n const delimiter = '_GitHubActionsFileCommandDelimeter_';\n const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;\n file_command_1.issueCommand('ENV', commandValue);\n }\n else {\n command_1.issueCommand('set-env', { name }, convertedVal);\n }\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input. The value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n command_1.issueCommand('set-output', { name }, value);\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n */\nfunction error(message) {\n command_1.issue('error', message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds an warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n */\nfunction warning(message) {\n command_1.issue('warning', message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n command_1.issueCommand('save-state', { name }, value);\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\n//# sourceMappingURL=core.js.map","\"use strict\";\n// For internal use, subject to change.\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\nfunction issueCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueCommand = issueCommand;\n//# sourceMappingURL=file-command.js.map","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n//# sourceMappingURL=utils.js.map","module.exports = require('./lib/command-exists');\n","'use strict';\n\nvar exec = require('child_process').exec;\nvar execSync = require('child_process').execSync;\nvar fs = require('fs');\nvar path = require('path');\nvar access = fs.access;\nvar accessSync = fs.accessSync;\nvar constants = fs.constants || fs;\n\nvar isUsingWindows = process.platform == 'win32'\n\nvar fileNotExists = function(commandName, callback){\n access(commandName, constants.F_OK,\n function(err){\n callback(!err);\n });\n};\n\nvar fileNotExistsSync = function(commandName){\n try{\n accessSync(commandName, constants.F_OK);\n return false;\n }catch(e){\n return true;\n }\n};\n\nvar localExecutable = function(commandName, callback){\n access(commandName, constants.F_OK | constants.X_OK,\n function(err){\n callback(null, !err);\n });\n};\n\nvar localExecutableSync = function(commandName){\n try{\n accessSync(commandName, constants.F_OK | constants.X_OK);\n return true;\n }catch(e){\n return false;\n }\n}\n\nvar commandExistsUnix = function(commandName, cleanedCommandName, callback) {\n\n fileNotExists(commandName, function(isFile){\n\n if(!isFile){\n var child = exec('command -v ' + cleanedCommandName +\n ' 2>/dev/null' +\n ' && { echo >&1 ' + cleanedCommandName + '; exit 0; }',\n function (error, stdout, stderr) {\n callback(null, !!stdout);\n });\n return;\n }\n\n localExecutable(commandName, callback);\n });\n\n}\n\nvar commandExistsWindows = function(commandName, cleanedCommandName, callback) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!(/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:\"\\|\\?\\*\\n])+(?:\\/\\/|\\/|\\\\\\\\|\\\\)?)+$/m.test(commandName))) {\n callback(null, false);\n return;\n }\n var child = exec('where ' + cleanedCommandName,\n function (error) {\n if (error !== null){\n callback(null, false);\n } else {\n callback(null, true);\n }\n }\n )\n}\n\nvar commandExistsUnixSync = function(commandName, cleanedCommandName) {\n if(fileNotExistsSync(commandName)){\n try {\n var stdout = execSync('command -v ' + cleanedCommandName +\n ' 2>/dev/null' +\n ' && { echo >&1 ' + cleanedCommandName + '; exit 0; }'\n );\n return !!stdout;\n } catch (error) {\n return false;\n }\n }\n return localExecutableSync(commandName);\n}\n\nvar commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) {\n // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator\n if (!(/^(?!(?:.*\\s|.*\\.|\\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:\"\\|\\?\\*\\n])+(?:\\/\\/|\\/|\\\\\\\\|\\\\)?)+$/m.test(commandName))) {\n return false;\n }\n try {\n var stdout = execSync('where ' + cleanedCommandName, {stdio: []});\n return !!stdout;\n } catch (error) {\n return false;\n }\n}\n\nvar cleanInput = function(s) {\n if (/[^A-Za-z0-9_\\/:=-]/.test(s)) {\n s = \"'\"+s.replace(/'/g,\"'\\\\''\")+\"'\";\n s = s.replace(/^(?:'')+/g, '') // unduplicate single-quote at the beginning\n .replace(/\\\\'''/g, \"\\\\'\" ); // remove non-escaped single-quote if there are enclosed between 2 escaped\n }\n return s;\n}\n\nif (isUsingWindows) {\n cleanInput = function(s) {\n var isPathName = /[\\\\]/.test(s);\n if (isPathName) {\n var dirname = '\"' + path.dirname(s) + '\"';\n var basename = '\"' + path.basename(s) + '\"';\n return dirname + ':' + basename;\n }\n return '\"' + s + '\"';\n }\n}\n\nmodule.exports = function commandExists(commandName, callback) {\n var cleanedCommandName = cleanInput(commandName);\n if (!callback && typeof Promise !== 'undefined') {\n return new Promise(function(resolve, reject){\n commandExists(commandName, function(error, output) {\n if (output) {\n resolve(commandName);\n } else {\n reject(error);\n }\n });\n });\n }\n if (isUsingWindows) {\n commandExistsWindows(commandName, cleanedCommandName, callback);\n } else {\n commandExistsUnix(commandName, cleanedCommandName, callback);\n }\n};\n\nmodule.exports.sync = function(commandName) {\n var cleanedCommandName = cleanInput(commandName);\n if (isUsingWindows) {\n return commandExistsWindowsSync(commandName, cleanedCommandName);\n } else {\n return commandExistsUnixSync(commandName, cleanedCommandName);\n }\n};\n","module.exports = require(\"child_process\");","module.exports = require(\"fs\");","module.exports = require(\"os\");","module.exports = require(\"path\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\tvar threw = true;\n\ttry {\n\t\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\t\tthrew = false;\n\t} finally {\n\t\tif(threw) delete __webpack_module_cache__[moduleId];\n\t}\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\n__webpack_require__.ab = __dirname + \"/\";","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(109);\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;AC9OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;ACnBA;AACA;AACA;A;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;AC9JA;AACA;A;;;;;;ACDA;AACA;A;;;;;;ACDA;AACA;A;;;;;;ACDA;AACA;A;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC5BA;AACA;ACDA;AACA;AACA;AACA;;A","sourceRoot":""}
--------------------------------------------------------------------------------
/dist/licenses.txt:
--------------------------------------------------------------------------------
1 | @actions/core
2 | MIT
3 | The MIT License (MIT)
4 |
5 | Copyright 2019 GitHub
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 |
9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 |
13 | command-exists
14 | MIT
15 | The MIT License (MIT)
16 |
17 | Copyright (c) 2014 Matthew Conlen
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is
24 | furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in all
27 | copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 | SOFTWARE.
36 |
--------------------------------------------------------------------------------
/dist/sourcemap-register.js:
--------------------------------------------------------------------------------
1 | module.exports =
2 | /******/ (() => { // webpackBootstrap
3 | /******/ var __webpack_modules__ = ({
4 |
5 | /***/ 650:
6 | /***/ ((module) => {
7 |
8 | var toString = Object.prototype.toString
9 |
10 | var isModern = (
11 | typeof Buffer.alloc === 'function' &&
12 | typeof Buffer.allocUnsafe === 'function' &&
13 | typeof Buffer.from === 'function'
14 | )
15 |
16 | function isArrayBuffer (input) {
17 | return toString.call(input).slice(8, -1) === 'ArrayBuffer'
18 | }
19 |
20 | function fromArrayBuffer (obj, byteOffset, length) {
21 | byteOffset >>>= 0
22 |
23 | var maxLength = obj.byteLength - byteOffset
24 |
25 | if (maxLength < 0) {
26 | throw new RangeError("'offset' is out of bounds")
27 | }
28 |
29 | if (length === undefined) {
30 | length = maxLength
31 | } else {
32 | length >>>= 0
33 |
34 | if (length > maxLength) {
35 | throw new RangeError("'length' is out of bounds")
36 | }
37 | }
38 |
39 | return isModern
40 | ? Buffer.from(obj.slice(byteOffset, byteOffset + length))
41 | : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)))
42 | }
43 |
44 | function fromString (string, encoding) {
45 | if (typeof encoding !== 'string' || encoding === '') {
46 | encoding = 'utf8'
47 | }
48 |
49 | if (!Buffer.isEncoding(encoding)) {
50 | throw new TypeError('"encoding" must be a valid string encoding')
51 | }
52 |
53 | return isModern
54 | ? Buffer.from(string, encoding)
55 | : new Buffer(string, encoding)
56 | }
57 |
58 | function bufferFrom (value, encodingOrOffset, length) {
59 | if (typeof value === 'number') {
60 | throw new TypeError('"value" argument must not be a number')
61 | }
62 |
63 | if (isArrayBuffer(value)) {
64 | return fromArrayBuffer(value, encodingOrOffset, length)
65 | }
66 |
67 | if (typeof value === 'string') {
68 | return fromString(value, encodingOrOffset)
69 | }
70 |
71 | return isModern
72 | ? Buffer.from(value)
73 | : new Buffer(value)
74 | }
75 |
76 | module.exports = bufferFrom
77 |
78 |
79 | /***/ }),
80 |
81 | /***/ 645:
82 | /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
83 |
84 | __webpack_require__(284).install();
85 |
86 |
87 | /***/ }),
88 |
89 | /***/ 284:
90 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
91 |
92 | var SourceMapConsumer = __webpack_require__(596).SourceMapConsumer;
93 | var path = __webpack_require__(622);
94 |
95 | var fs;
96 | try {
97 | fs = __webpack_require__(747);
98 | if (!fs.existsSync || !fs.readFileSync) {
99 | // fs doesn't have all methods we need
100 | fs = null;
101 | }
102 | } catch (err) {
103 | /* nop */
104 | }
105 |
106 | var bufferFrom = __webpack_require__(650);
107 |
108 | // Only install once if called multiple times
109 | var errorFormatterInstalled = false;
110 | var uncaughtShimInstalled = false;
111 |
112 | // If true, the caches are reset before a stack trace formatting operation
113 | var emptyCacheBetweenOperations = false;
114 |
115 | // Supports {browser, node, auto}
116 | var environment = "auto";
117 |
118 | // Maps a file path to a string containing the file contents
119 | var fileContentsCache = {};
120 |
121 | // Maps a file path to a source map for that file
122 | var sourceMapCache = {};
123 |
124 | // Regex for detecting source maps
125 | var reSourceMap = /^data:application\/json[^,]+base64,/;
126 |
127 | // Priority list of retrieve handlers
128 | var retrieveFileHandlers = [];
129 | var retrieveMapHandlers = [];
130 |
131 | function isInBrowser() {
132 | if (environment === "browser")
133 | return true;
134 | if (environment === "node")
135 | return false;
136 | return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function') && !(window.require && window.module && window.process && window.process.type === "renderer"));
137 | }
138 |
139 | function hasGlobalProcessEventEmitter() {
140 | return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
141 | }
142 |
143 | function handlerExec(list) {
144 | return function(arg) {
145 | for (var i = 0; i < list.length; i++) {
146 | var ret = list[i](arg);
147 | if (ret) {
148 | return ret;
149 | }
150 | }
151 | return null;
152 | };
153 | }
154 |
155 | var retrieveFile = handlerExec(retrieveFileHandlers);
156 |
157 | retrieveFileHandlers.push(function(path) {
158 | // Trim the path to make sure there is no extra whitespace.
159 | path = path.trim();
160 | if (/^file:/.test(path)) {
161 | // existsSync/readFileSync can't handle file protocol, but once stripped, it works
162 | path = path.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
163 | return drive ?
164 | '' : // file:///C:/dir/file -> C:/dir/file
165 | '/'; // file:///root-dir/file -> /root-dir/file
166 | });
167 | }
168 | if (path in fileContentsCache) {
169 | return fileContentsCache[path];
170 | }
171 |
172 | var contents = '';
173 | try {
174 | if (!fs) {
175 | // Use SJAX if we are in the browser
176 | var xhr = new XMLHttpRequest();
177 | xhr.open('GET', path, /** async */ false);
178 | xhr.send(null);
179 | if (xhr.readyState === 4 && xhr.status === 200) {
180 | contents = xhr.responseText;
181 | }
182 | } else if (fs.existsSync(path)) {
183 | // Otherwise, use the filesystem
184 | contents = fs.readFileSync(path, 'utf8');
185 | }
186 | } catch (er) {
187 | /* ignore any errors */
188 | }
189 |
190 | return fileContentsCache[path] = contents;
191 | });
192 |
193 | // Support URLs relative to a directory, but be careful about a protocol prefix
194 | // in case we are in the browser (i.e. directories may start with "http://" or "file:///")
195 | function supportRelativeURL(file, url) {
196 | if (!file) return url;
197 | var dir = path.dirname(file);
198 | var match = /^\w+:\/\/[^\/]*/.exec(dir);
199 | var protocol = match ? match[0] : '';
200 | var startPath = dir.slice(protocol.length);
201 | if (protocol && /^\/\w\:/.test(startPath)) {
202 | // handle file:///C:/ paths
203 | protocol += '/';
204 | return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/');
205 | }
206 | return protocol + path.resolve(dir.slice(protocol.length), url);
207 | }
208 |
209 | function retrieveSourceMapURL(source) {
210 | var fileData;
211 |
212 | if (isInBrowser()) {
213 | try {
214 | var xhr = new XMLHttpRequest();
215 | xhr.open('GET', source, false);
216 | xhr.send(null);
217 | fileData = xhr.readyState === 4 ? xhr.responseText : null;
218 |
219 | // Support providing a sourceMappingURL via the SourceMap header
220 | var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
221 | xhr.getResponseHeader("X-SourceMap");
222 | if (sourceMapHeader) {
223 | return sourceMapHeader;
224 | }
225 | } catch (e) {
226 | }
227 | }
228 |
229 | // Get the URL of the source map
230 | fileData = retrieveFile(source);
231 | var re = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mg;
232 | // Keep executing the search to find the *last* sourceMappingURL to avoid
233 | // picking up sourceMappingURLs from comments, strings, etc.
234 | var lastMatch, match;
235 | while (match = re.exec(fileData)) lastMatch = match;
236 | if (!lastMatch) return null;
237 | return lastMatch[1];
238 | };
239 |
240 | // Can be overridden by the retrieveSourceMap option to install. Takes a
241 | // generated source filename; returns a {map, optional url} object, or null if
242 | // there is no source map. The map field may be either a string or the parsed
243 | // JSON object (ie, it must be a valid argument to the SourceMapConsumer
244 | // constructor).
245 | var retrieveSourceMap = handlerExec(retrieveMapHandlers);
246 | retrieveMapHandlers.push(function(source) {
247 | var sourceMappingURL = retrieveSourceMapURL(source);
248 | if (!sourceMappingURL) return null;
249 |
250 | // Read the contents of the source map
251 | var sourceMapData;
252 | if (reSourceMap.test(sourceMappingURL)) {
253 | // Support source map URL as a data url
254 | var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);
255 | sourceMapData = bufferFrom(rawData, "base64").toString();
256 | sourceMappingURL = source;
257 | } else {
258 | // Support source map URLs relative to the source URL
259 | sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
260 | sourceMapData = retrieveFile(sourceMappingURL);
261 | }
262 |
263 | if (!sourceMapData) {
264 | return null;
265 | }
266 |
267 | return {
268 | url: sourceMappingURL,
269 | map: sourceMapData
270 | };
271 | });
272 |
273 | function mapSourcePosition(position) {
274 | var sourceMap = sourceMapCache[position.source];
275 | if (!sourceMap) {
276 | // Call the (overrideable) retrieveSourceMap function to get the source map.
277 | var urlAndMap = retrieveSourceMap(position.source);
278 | if (urlAndMap) {
279 | sourceMap = sourceMapCache[position.source] = {
280 | url: urlAndMap.url,
281 | map: new SourceMapConsumer(urlAndMap.map)
282 | };
283 |
284 | // Load all sources stored inline with the source map into the file cache
285 | // to pretend like they are already loaded. They may not exist on disk.
286 | if (sourceMap.map.sourcesContent) {
287 | sourceMap.map.sources.forEach(function(source, i) {
288 | var contents = sourceMap.map.sourcesContent[i];
289 | if (contents) {
290 | var url = supportRelativeURL(sourceMap.url, source);
291 | fileContentsCache[url] = contents;
292 | }
293 | });
294 | }
295 | } else {
296 | sourceMap = sourceMapCache[position.source] = {
297 | url: null,
298 | map: null
299 | };
300 | }
301 | }
302 |
303 | // Resolve the source URL relative to the URL of the source map
304 | if (sourceMap && sourceMap.map) {
305 | var originalPosition = sourceMap.map.originalPositionFor(position);
306 |
307 | // Only return the original position if a matching line was found. If no
308 | // matching line is found then we return position instead, which will cause
309 | // the stack trace to print the path and line for the compiled file. It is
310 | // better to give a precise location in the compiled file than a vague
311 | // location in the original file.
312 | if (originalPosition.source !== null) {
313 | originalPosition.source = supportRelativeURL(
314 | sourceMap.url, originalPosition.source);
315 | return originalPosition;
316 | }
317 | }
318 |
319 | return position;
320 | }
321 |
322 | // Parses code generated by FormatEvalOrigin(), a function inside V8:
323 | // https://code.google.com/p/v8/source/browse/trunk/src/messages.js
324 | function mapEvalOrigin(origin) {
325 | // Most eval() calls are in this format
326 | var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
327 | if (match) {
328 | var position = mapSourcePosition({
329 | source: match[2],
330 | line: +match[3],
331 | column: match[4] - 1
332 | });
333 | return 'eval at ' + match[1] + ' (' + position.source + ':' +
334 | position.line + ':' + (position.column + 1) + ')';
335 | }
336 |
337 | // Parse nested eval() calls using recursion
338 | match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
339 | if (match) {
340 | return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')';
341 | }
342 |
343 | // Make sure we still return useful information if we didn't find anything
344 | return origin;
345 | }
346 |
347 | // This is copied almost verbatim from the V8 source code at
348 | // https://code.google.com/p/v8/source/browse/trunk/src/messages.js. The
349 | // implementation of wrapCallSite() used to just forward to the actual source
350 | // code of CallSite.prototype.toString but unfortunately a new release of V8
351 | // did something to the prototype chain and broke the shim. The only fix I
352 | // could find was copy/paste.
353 | function CallSiteToString() {
354 | var fileName;
355 | var fileLocation = "";
356 | if (this.isNative()) {
357 | fileLocation = "native";
358 | } else {
359 | fileName = this.getScriptNameOrSourceURL();
360 | if (!fileName && this.isEval()) {
361 | fileLocation = this.getEvalOrigin();
362 | fileLocation += ", "; // Expecting source position to follow.
363 | }
364 |
365 | if (fileName) {
366 | fileLocation += fileName;
367 | } else {
368 | // Source code does not originate from a file and is not native, but we
369 | // can still get the source position inside the source string, e.g. in
370 | // an eval string.
371 | fileLocation += "";
372 | }
373 | var lineNumber = this.getLineNumber();
374 | if (lineNumber != null) {
375 | fileLocation += ":" + lineNumber;
376 | var columnNumber = this.getColumnNumber();
377 | if (columnNumber) {
378 | fileLocation += ":" + columnNumber;
379 | }
380 | }
381 | }
382 |
383 | var line = "";
384 | var functionName = this.getFunctionName();
385 | var addSuffix = true;
386 | var isConstructor = this.isConstructor();
387 | var isMethodCall = !(this.isToplevel() || isConstructor);
388 | if (isMethodCall) {
389 | var typeName = this.getTypeName();
390 | // Fixes shim to be backward compatable with Node v0 to v4
391 | if (typeName === "[object Object]") {
392 | typeName = "null";
393 | }
394 | var methodName = this.getMethodName();
395 | if (functionName) {
396 | if (typeName && functionName.indexOf(typeName) != 0) {
397 | line += typeName + ".";
398 | }
399 | line += functionName;
400 | if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
401 | line += " [as " + methodName + "]";
402 | }
403 | } else {
404 | line += typeName + "." + (methodName || "");
405 | }
406 | } else if (isConstructor) {
407 | line += "new " + (functionName || "");
408 | } else if (functionName) {
409 | line += functionName;
410 | } else {
411 | line += fileLocation;
412 | addSuffix = false;
413 | }
414 | if (addSuffix) {
415 | line += " (" + fileLocation + ")";
416 | }
417 | return line;
418 | }
419 |
420 | function cloneCallSite(frame) {
421 | var object = {};
422 | Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
423 | object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name];
424 | });
425 | object.toString = CallSiteToString;
426 | return object;
427 | }
428 |
429 | function wrapCallSite(frame) {
430 | if(frame.isNative()) {
431 | return frame;
432 | }
433 |
434 | // Most call sites will return the source file from getFileName(), but code
435 | // passed to eval() ending in "//# sourceURL=..." will return the source file
436 | // from getScriptNameOrSourceURL() instead
437 | var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
438 | if (source) {
439 | var line = frame.getLineNumber();
440 | var column = frame.getColumnNumber() - 1;
441 |
442 | // Fix position in Node where some (internal) code is prepended.
443 | // See https://github.com/evanw/node-source-map-support/issues/36
444 | var headerLength = 62;
445 | if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
446 | column -= headerLength;
447 | }
448 |
449 | var position = mapSourcePosition({
450 | source: source,
451 | line: line,
452 | column: column
453 | });
454 | frame = cloneCallSite(frame);
455 | var originalFunctionName = frame.getFunctionName;
456 | frame.getFunctionName = function() { return position.name || originalFunctionName(); };
457 | frame.getFileName = function() { return position.source; };
458 | frame.getLineNumber = function() { return position.line; };
459 | frame.getColumnNumber = function() { return position.column + 1; };
460 | frame.getScriptNameOrSourceURL = function() { return position.source; };
461 | return frame;
462 | }
463 |
464 | // Code called using eval() needs special handling
465 | var origin = frame.isEval() && frame.getEvalOrigin();
466 | if (origin) {
467 | origin = mapEvalOrigin(origin);
468 | frame = cloneCallSite(frame);
469 | frame.getEvalOrigin = function() { return origin; };
470 | return frame;
471 | }
472 |
473 | // If we get here then we were unable to change the source position
474 | return frame;
475 | }
476 |
477 | // This function is part of the V8 stack trace API, for more info see:
478 | // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
479 | function prepareStackTrace(error, stack) {
480 | if (emptyCacheBetweenOperations) {
481 | fileContentsCache = {};
482 | sourceMapCache = {};
483 | }
484 |
485 | return error + stack.map(function(frame) {
486 | return '\n at ' + wrapCallSite(frame);
487 | }).join('');
488 | }
489 |
490 | // Generate position and snippet of original source with pointer
491 | function getErrorSource(error) {
492 | var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
493 | if (match) {
494 | var source = match[1];
495 | var line = +match[2];
496 | var column = +match[3];
497 |
498 | // Support the inline sourceContents inside the source map
499 | var contents = fileContentsCache[source];
500 |
501 | // Support files on disk
502 | if (!contents && fs && fs.existsSync(source)) {
503 | try {
504 | contents = fs.readFileSync(source, 'utf8');
505 | } catch (er) {
506 | contents = '';
507 | }
508 | }
509 |
510 | // Format the line from the original source code like node does
511 | if (contents) {
512 | var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
513 | if (code) {
514 | return source + ':' + line + '\n' + code + '\n' +
515 | new Array(column).join(' ') + '^';
516 | }
517 | }
518 | }
519 | return null;
520 | }
521 |
522 | function printErrorAndExit (error) {
523 | var source = getErrorSource(error);
524 |
525 | // Ensure error is printed synchronously and not truncated
526 | if (process.stderr._handle && process.stderr._handle.setBlocking) {
527 | process.stderr._handle.setBlocking(true);
528 | }
529 |
530 | if (source) {
531 | console.error();
532 | console.error(source);
533 | }
534 |
535 | console.error(error.stack);
536 | process.exit(1);
537 | }
538 |
539 | function shimEmitUncaughtException () {
540 | var origEmit = process.emit;
541 |
542 | process.emit = function (type) {
543 | if (type === 'uncaughtException') {
544 | var hasStack = (arguments[1] && arguments[1].stack);
545 | var hasListeners = (this.listeners(type).length > 0);
546 |
547 | if (hasStack && !hasListeners) {
548 | return printErrorAndExit(arguments[1]);
549 | }
550 | }
551 |
552 | return origEmit.apply(this, arguments);
553 | };
554 | }
555 |
556 | var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);
557 | var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);
558 |
559 | exports.wrapCallSite = wrapCallSite;
560 | exports.getErrorSource = getErrorSource;
561 | exports.mapSourcePosition = mapSourcePosition;
562 | exports.retrieveSourceMap = retrieveSourceMap;
563 |
564 | exports.install = function(options) {
565 | options = options || {};
566 |
567 | if (options.environment) {
568 | environment = options.environment;
569 | if (["node", "browser", "auto"].indexOf(environment) === -1) {
570 | throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}")
571 | }
572 | }
573 |
574 | // Allow sources to be found by methods other than reading the files
575 | // directly from disk.
576 | if (options.retrieveFile) {
577 | if (options.overrideRetrieveFile) {
578 | retrieveFileHandlers.length = 0;
579 | }
580 |
581 | retrieveFileHandlers.unshift(options.retrieveFile);
582 | }
583 |
584 | // Allow source maps to be found by methods other than reading the files
585 | // directly from disk.
586 | if (options.retrieveSourceMap) {
587 | if (options.overrideRetrieveSourceMap) {
588 | retrieveMapHandlers.length = 0;
589 | }
590 |
591 | retrieveMapHandlers.unshift(options.retrieveSourceMap);
592 | }
593 |
594 | // Support runtime transpilers that include inline source maps
595 | if (options.hookRequire && !isInBrowser()) {
596 | var Module;
597 | try {
598 | Module = __webpack_require__(282);
599 | } catch (err) {
600 | // NOP: Loading in catch block to convert webpack error to warning.
601 | }
602 | var $compile = Module.prototype._compile;
603 |
604 | if (!$compile.__sourceMapSupport) {
605 | Module.prototype._compile = function(content, filename) {
606 | fileContentsCache[filename] = content;
607 | sourceMapCache[filename] = undefined;
608 | return $compile.call(this, content, filename);
609 | };
610 |
611 | Module.prototype._compile.__sourceMapSupport = true;
612 | }
613 | }
614 |
615 | // Configure options
616 | if (!emptyCacheBetweenOperations) {
617 | emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ?
618 | options.emptyCacheBetweenOperations : false;
619 | }
620 |
621 | // Install the error reformatter
622 | if (!errorFormatterInstalled) {
623 | errorFormatterInstalled = true;
624 | Error.prepareStackTrace = prepareStackTrace;
625 | }
626 |
627 | if (!uncaughtShimInstalled) {
628 | var installHandler = 'handleUncaughtExceptions' in options ?
629 | options.handleUncaughtExceptions : true;
630 |
631 | // Provide the option to not install the uncaught exception handler. This is
632 | // to support other uncaught exception handlers (in test frameworks, for
633 | // example). If this handler is not installed and there are no other uncaught
634 | // exception handlers, uncaught exceptions will be caught by node's built-in
635 | // exception handler and the process will still be terminated. However, the
636 | // generated JavaScript code will be shown above the stack trace instead of
637 | // the original source code.
638 | if (installHandler && hasGlobalProcessEventEmitter()) {
639 | uncaughtShimInstalled = true;
640 | shimEmitUncaughtException();
641 | }
642 | }
643 | };
644 |
645 | exports.resetRetrieveHandlers = function() {
646 | retrieveFileHandlers.length = 0;
647 | retrieveMapHandlers.length = 0;
648 |
649 | retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
650 | retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
651 | }
652 |
653 |
654 | /***/ }),
655 |
656 | /***/ 837:
657 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
658 |
659 | /* -*- Mode: js; js-indent-level: 2; -*- */
660 | /*
661 | * Copyright 2011 Mozilla Foundation and contributors
662 | * Licensed under the New BSD license. See LICENSE or:
663 | * http://opensource.org/licenses/BSD-3-Clause
664 | */
665 |
666 | var util = __webpack_require__(983);
667 | var has = Object.prototype.hasOwnProperty;
668 | var hasNativeMap = typeof Map !== "undefined";
669 |
670 | /**
671 | * A data structure which is a combination of an array and a set. Adding a new
672 | * member is O(1), testing for membership is O(1), and finding the index of an
673 | * element is O(1). Removing elements from the set is not supported. Only
674 | * strings are supported for membership.
675 | */
676 | function ArraySet() {
677 | this._array = [];
678 | this._set = hasNativeMap ? new Map() : Object.create(null);
679 | }
680 |
681 | /**
682 | * Static method for creating ArraySet instances from an existing array.
683 | */
684 | ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
685 | var set = new ArraySet();
686 | for (var i = 0, len = aArray.length; i < len; i++) {
687 | set.add(aArray[i], aAllowDuplicates);
688 | }
689 | return set;
690 | };
691 |
692 | /**
693 | * Return how many unique items are in this ArraySet. If duplicates have been
694 | * added, than those do not count towards the size.
695 | *
696 | * @returns Number
697 | */
698 | ArraySet.prototype.size = function ArraySet_size() {
699 | return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
700 | };
701 |
702 | /**
703 | * Add the given string to this set.
704 | *
705 | * @param String aStr
706 | */
707 | ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
708 | var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
709 | var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
710 | var idx = this._array.length;
711 | if (!isDuplicate || aAllowDuplicates) {
712 | this._array.push(aStr);
713 | }
714 | if (!isDuplicate) {
715 | if (hasNativeMap) {
716 | this._set.set(aStr, idx);
717 | } else {
718 | this._set[sStr] = idx;
719 | }
720 | }
721 | };
722 |
723 | /**
724 | * Is the given string a member of this set?
725 | *
726 | * @param String aStr
727 | */
728 | ArraySet.prototype.has = function ArraySet_has(aStr) {
729 | if (hasNativeMap) {
730 | return this._set.has(aStr);
731 | } else {
732 | var sStr = util.toSetString(aStr);
733 | return has.call(this._set, sStr);
734 | }
735 | };
736 |
737 | /**
738 | * What is the index of the given string in the array?
739 | *
740 | * @param String aStr
741 | */
742 | ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
743 | if (hasNativeMap) {
744 | var idx = this._set.get(aStr);
745 | if (idx >= 0) {
746 | return idx;
747 | }
748 | } else {
749 | var sStr = util.toSetString(aStr);
750 | if (has.call(this._set, sStr)) {
751 | return this._set[sStr];
752 | }
753 | }
754 |
755 | throw new Error('"' + aStr + '" is not in the set.');
756 | };
757 |
758 | /**
759 | * What is the element at the given index?
760 | *
761 | * @param Number aIdx
762 | */
763 | ArraySet.prototype.at = function ArraySet_at(aIdx) {
764 | if (aIdx >= 0 && aIdx < this._array.length) {
765 | return this._array[aIdx];
766 | }
767 | throw new Error('No element indexed by ' + aIdx);
768 | };
769 |
770 | /**
771 | * Returns the array representation of this set (which has the proper indices
772 | * indicated by indexOf). Note that this is a copy of the internal array used
773 | * for storing the members so that no one can mess with internal state.
774 | */
775 | ArraySet.prototype.toArray = function ArraySet_toArray() {
776 | return this._array.slice();
777 | };
778 |
779 | exports.I = ArraySet;
780 |
781 |
782 | /***/ }),
783 |
784 | /***/ 215:
785 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
786 |
787 | /* -*- Mode: js; js-indent-level: 2; -*- */
788 | /*
789 | * Copyright 2011 Mozilla Foundation and contributors
790 | * Licensed under the New BSD license. See LICENSE or:
791 | * http://opensource.org/licenses/BSD-3-Clause
792 | *
793 | * Based on the Base 64 VLQ implementation in Closure Compiler:
794 | * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
795 | *
796 | * Copyright 2011 The Closure Compiler Authors. All rights reserved.
797 | * Redistribution and use in source and binary forms, with or without
798 | * modification, are permitted provided that the following conditions are
799 | * met:
800 | *
801 | * * Redistributions of source code must retain the above copyright
802 | * notice, this list of conditions and the following disclaimer.
803 | * * Redistributions in binary form must reproduce the above
804 | * copyright notice, this list of conditions and the following
805 | * disclaimer in the documentation and/or other materials provided
806 | * with the distribution.
807 | * * Neither the name of Google Inc. nor the names of its
808 | * contributors may be used to endorse or promote products derived
809 | * from this software without specific prior written permission.
810 | *
811 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
812 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
813 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
814 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
815 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
816 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
817 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
818 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
819 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
820 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
821 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
822 | */
823 |
824 | var base64 = __webpack_require__(537);
825 |
826 | // A single base 64 digit can contain 6 bits of data. For the base 64 variable
827 | // length quantities we use in the source map spec, the first bit is the sign,
828 | // the next four bits are the actual value, and the 6th bit is the
829 | // continuation bit. The continuation bit tells us whether there are more
830 | // digits in this value following this digit.
831 | //
832 | // Continuation
833 | // | Sign
834 | // | |
835 | // V V
836 | // 101011
837 |
838 | var VLQ_BASE_SHIFT = 5;
839 |
840 | // binary: 100000
841 | var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
842 |
843 | // binary: 011111
844 | var VLQ_BASE_MASK = VLQ_BASE - 1;
845 |
846 | // binary: 100000
847 | var VLQ_CONTINUATION_BIT = VLQ_BASE;
848 |
849 | /**
850 | * Converts from a two-complement value to a value where the sign bit is
851 | * placed in the least significant bit. For example, as decimals:
852 | * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
853 | * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
854 | */
855 | function toVLQSigned(aValue) {
856 | return aValue < 0
857 | ? ((-aValue) << 1) + 1
858 | : (aValue << 1) + 0;
859 | }
860 |
861 | /**
862 | * Converts to a two-complement value from a value where the sign bit is
863 | * placed in the least significant bit. For example, as decimals:
864 | * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
865 | * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
866 | */
867 | function fromVLQSigned(aValue) {
868 | var isNegative = (aValue & 1) === 1;
869 | var shifted = aValue >> 1;
870 | return isNegative
871 | ? -shifted
872 | : shifted;
873 | }
874 |
875 | /**
876 | * Returns the base 64 VLQ encoded value.
877 | */
878 | exports.encode = function base64VLQ_encode(aValue) {
879 | var encoded = "";
880 | var digit;
881 |
882 | var vlq = toVLQSigned(aValue);
883 |
884 | do {
885 | digit = vlq & VLQ_BASE_MASK;
886 | vlq >>>= VLQ_BASE_SHIFT;
887 | if (vlq > 0) {
888 | // There are still more digits in this value, so we must make sure the
889 | // continuation bit is marked.
890 | digit |= VLQ_CONTINUATION_BIT;
891 | }
892 | encoded += base64.encode(digit);
893 | } while (vlq > 0);
894 |
895 | return encoded;
896 | };
897 |
898 | /**
899 | * Decodes the next base 64 VLQ value from the given string and returns the
900 | * value and the rest of the string via the out parameter.
901 | */
902 | exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
903 | var strLen = aStr.length;
904 | var result = 0;
905 | var shift = 0;
906 | var continuation, digit;
907 |
908 | do {
909 | if (aIndex >= strLen) {
910 | throw new Error("Expected more digits in base 64 VLQ value.");
911 | }
912 |
913 | digit = base64.decode(aStr.charCodeAt(aIndex++));
914 | if (digit === -1) {
915 | throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
916 | }
917 |
918 | continuation = !!(digit & VLQ_CONTINUATION_BIT);
919 | digit &= VLQ_BASE_MASK;
920 | result = result + (digit << shift);
921 | shift += VLQ_BASE_SHIFT;
922 | } while (continuation);
923 |
924 | aOutParam.value = fromVLQSigned(result);
925 | aOutParam.rest = aIndex;
926 | };
927 |
928 |
929 | /***/ }),
930 |
931 | /***/ 537:
932 | /***/ ((__unused_webpack_module, exports) => {
933 |
934 | /* -*- Mode: js; js-indent-level: 2; -*- */
935 | /*
936 | * Copyright 2011 Mozilla Foundation and contributors
937 | * Licensed under the New BSD license. See LICENSE or:
938 | * http://opensource.org/licenses/BSD-3-Clause
939 | */
940 |
941 | var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
942 |
943 | /**
944 | * Encode an integer in the range of 0 to 63 to a single base 64 digit.
945 | */
946 | exports.encode = function (number) {
947 | if (0 <= number && number < intToCharMap.length) {
948 | return intToCharMap[number];
949 | }
950 | throw new TypeError("Must be between 0 and 63: " + number);
951 | };
952 |
953 | /**
954 | * Decode a single base 64 character code digit to an integer. Returns -1 on
955 | * failure.
956 | */
957 | exports.decode = function (charCode) {
958 | var bigA = 65; // 'A'
959 | var bigZ = 90; // 'Z'
960 |
961 | var littleA = 97; // 'a'
962 | var littleZ = 122; // 'z'
963 |
964 | var zero = 48; // '0'
965 | var nine = 57; // '9'
966 |
967 | var plus = 43; // '+'
968 | var slash = 47; // '/'
969 |
970 | var littleOffset = 26;
971 | var numberOffset = 52;
972 |
973 | // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
974 | if (bigA <= charCode && charCode <= bigZ) {
975 | return (charCode - bigA);
976 | }
977 |
978 | // 26 - 51: abcdefghijklmnopqrstuvwxyz
979 | if (littleA <= charCode && charCode <= littleZ) {
980 | return (charCode - littleA + littleOffset);
981 | }
982 |
983 | // 52 - 61: 0123456789
984 | if (zero <= charCode && charCode <= nine) {
985 | return (charCode - zero + numberOffset);
986 | }
987 |
988 | // 62: +
989 | if (charCode == plus) {
990 | return 62;
991 | }
992 |
993 | // 63: /
994 | if (charCode == slash) {
995 | return 63;
996 | }
997 |
998 | // Invalid base64 digit.
999 | return -1;
1000 | };
1001 |
1002 |
1003 | /***/ }),
1004 |
1005 | /***/ 164:
1006 | /***/ ((__unused_webpack_module, exports) => {
1007 |
1008 | /* -*- Mode: js; js-indent-level: 2; -*- */
1009 | /*
1010 | * Copyright 2011 Mozilla Foundation and contributors
1011 | * Licensed under the New BSD license. See LICENSE or:
1012 | * http://opensource.org/licenses/BSD-3-Clause
1013 | */
1014 |
1015 | exports.GREATEST_LOWER_BOUND = 1;
1016 | exports.LEAST_UPPER_BOUND = 2;
1017 |
1018 | /**
1019 | * Recursive implementation of binary search.
1020 | *
1021 | * @param aLow Indices here and lower do not contain the needle.
1022 | * @param aHigh Indices here and higher do not contain the needle.
1023 | * @param aNeedle The element being searched for.
1024 | * @param aHaystack The non-empty array being searched.
1025 | * @param aCompare Function which takes two elements and returns -1, 0, or 1.
1026 | * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
1027 | * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
1028 | * closest element that is smaller than or greater than the one we are
1029 | * searching for, respectively, if the exact element cannot be found.
1030 | */
1031 | function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
1032 | // This function terminates when one of the following is true:
1033 | //
1034 | // 1. We find the exact element we are looking for.
1035 | //
1036 | // 2. We did not find the exact element, but we can return the index of
1037 | // the next-closest element.
1038 | //
1039 | // 3. We did not find the exact element, and there is no next-closest
1040 | // element than the one we are searching for, so we return -1.
1041 | var mid = Math.floor((aHigh - aLow) / 2) + aLow;
1042 | var cmp = aCompare(aNeedle, aHaystack[mid], true);
1043 | if (cmp === 0) {
1044 | // Found the element we are looking for.
1045 | return mid;
1046 | }
1047 | else if (cmp > 0) {
1048 | // Our needle is greater than aHaystack[mid].
1049 | if (aHigh - mid > 1) {
1050 | // The element is in the upper half.
1051 | return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
1052 | }
1053 |
1054 | // The exact needle element was not found in this haystack. Determine if
1055 | // we are in termination case (3) or (2) and return the appropriate thing.
1056 | if (aBias == exports.LEAST_UPPER_BOUND) {
1057 | return aHigh < aHaystack.length ? aHigh : -1;
1058 | } else {
1059 | return mid;
1060 | }
1061 | }
1062 | else {
1063 | // Our needle is less than aHaystack[mid].
1064 | if (mid - aLow > 1) {
1065 | // The element is in the lower half.
1066 | return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
1067 | }
1068 |
1069 | // we are in termination case (3) or (2) and return the appropriate thing.
1070 | if (aBias == exports.LEAST_UPPER_BOUND) {
1071 | return mid;
1072 | } else {
1073 | return aLow < 0 ? -1 : aLow;
1074 | }
1075 | }
1076 | }
1077 |
1078 | /**
1079 | * This is an implementation of binary search which will always try and return
1080 | * the index of the closest element if there is no exact hit. This is because
1081 | * mappings between original and generated line/col pairs are single points,
1082 | * and there is an implicit region between each of them, so a miss just means
1083 | * that you aren't on the very start of a region.
1084 | *
1085 | * @param aNeedle The element you are looking for.
1086 | * @param aHaystack The array that is being searched.
1087 | * @param aCompare A function which takes the needle and an element in the
1088 | * array and returns -1, 0, or 1 depending on whether the needle is less
1089 | * than, equal to, or greater than the element, respectively.
1090 | * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
1091 | * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
1092 | * closest element that is smaller than or greater than the one we are
1093 | * searching for, respectively, if the exact element cannot be found.
1094 | * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
1095 | */
1096 | exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
1097 | if (aHaystack.length === 0) {
1098 | return -1;
1099 | }
1100 |
1101 | var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
1102 | aCompare, aBias || exports.GREATEST_LOWER_BOUND);
1103 | if (index < 0) {
1104 | return -1;
1105 | }
1106 |
1107 | // We have found either the exact element, or the next-closest element than
1108 | // the one we are searching for. However, there may be more than one such
1109 | // element. Make sure we always return the smallest of these.
1110 | while (index - 1 >= 0) {
1111 | if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
1112 | break;
1113 | }
1114 | --index;
1115 | }
1116 |
1117 | return index;
1118 | };
1119 |
1120 |
1121 | /***/ }),
1122 |
1123 | /***/ 740:
1124 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1125 |
1126 | /* -*- Mode: js; js-indent-level: 2; -*- */
1127 | /*
1128 | * Copyright 2014 Mozilla Foundation and contributors
1129 | * Licensed under the New BSD license. See LICENSE or:
1130 | * http://opensource.org/licenses/BSD-3-Clause
1131 | */
1132 |
1133 | var util = __webpack_require__(983);
1134 |
1135 | /**
1136 | * Determine whether mappingB is after mappingA with respect to generated
1137 | * position.
1138 | */
1139 | function generatedPositionAfter(mappingA, mappingB) {
1140 | // Optimized for most common case
1141 | var lineA = mappingA.generatedLine;
1142 | var lineB = mappingB.generatedLine;
1143 | var columnA = mappingA.generatedColumn;
1144 | var columnB = mappingB.generatedColumn;
1145 | return lineB > lineA || lineB == lineA && columnB >= columnA ||
1146 | util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
1147 | }
1148 |
1149 | /**
1150 | * A data structure to provide a sorted view of accumulated mappings in a
1151 | * performance conscious manner. It trades a neglibable overhead in general
1152 | * case for a large speedup in case of mappings being added in order.
1153 | */
1154 | function MappingList() {
1155 | this._array = [];
1156 | this._sorted = true;
1157 | // Serves as infimum
1158 | this._last = {generatedLine: -1, generatedColumn: 0};
1159 | }
1160 |
1161 | /**
1162 | * Iterate through internal items. This method takes the same arguments that
1163 | * `Array.prototype.forEach` takes.
1164 | *
1165 | * NOTE: The order of the mappings is NOT guaranteed.
1166 | */
1167 | MappingList.prototype.unsortedForEach =
1168 | function MappingList_forEach(aCallback, aThisArg) {
1169 | this._array.forEach(aCallback, aThisArg);
1170 | };
1171 |
1172 | /**
1173 | * Add the given source mapping.
1174 | *
1175 | * @param Object aMapping
1176 | */
1177 | MappingList.prototype.add = function MappingList_add(aMapping) {
1178 | if (generatedPositionAfter(this._last, aMapping)) {
1179 | this._last = aMapping;
1180 | this._array.push(aMapping);
1181 | } else {
1182 | this._sorted = false;
1183 | this._array.push(aMapping);
1184 | }
1185 | };
1186 |
1187 | /**
1188 | * Returns the flat, sorted array of mappings. The mappings are sorted by
1189 | * generated position.
1190 | *
1191 | * WARNING: This method returns internal data without copying, for
1192 | * performance. The return value must NOT be mutated, and should be treated as
1193 | * an immutable borrow. If you want to take ownership, you must make your own
1194 | * copy.
1195 | */
1196 | MappingList.prototype.toArray = function MappingList_toArray() {
1197 | if (!this._sorted) {
1198 | this._array.sort(util.compareByGeneratedPositionsInflated);
1199 | this._sorted = true;
1200 | }
1201 | return this._array;
1202 | };
1203 |
1204 | exports.H = MappingList;
1205 |
1206 |
1207 | /***/ }),
1208 |
1209 | /***/ 226:
1210 | /***/ ((__unused_webpack_module, exports) => {
1211 |
1212 | /* -*- Mode: js; js-indent-level: 2; -*- */
1213 | /*
1214 | * Copyright 2011 Mozilla Foundation and contributors
1215 | * Licensed under the New BSD license. See LICENSE or:
1216 | * http://opensource.org/licenses/BSD-3-Clause
1217 | */
1218 |
1219 | // It turns out that some (most?) JavaScript engines don't self-host
1220 | // `Array.prototype.sort`. This makes sense because C++ will likely remain
1221 | // faster than JS when doing raw CPU-intensive sorting. However, when using a
1222 | // custom comparator function, calling back and forth between the VM's C++ and
1223 | // JIT'd JS is rather slow *and* loses JIT type information, resulting in
1224 | // worse generated code for the comparator function than would be optimal. In
1225 | // fact, when sorting with a comparator, these costs outweigh the benefits of
1226 | // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
1227 | // a ~3500ms mean speed-up in `bench/bench.html`.
1228 |
1229 | /**
1230 | * Swap the elements indexed by `x` and `y` in the array `ary`.
1231 | *
1232 | * @param {Array} ary
1233 | * The array.
1234 | * @param {Number} x
1235 | * The index of the first item.
1236 | * @param {Number} y
1237 | * The index of the second item.
1238 | */
1239 | function swap(ary, x, y) {
1240 | var temp = ary[x];
1241 | ary[x] = ary[y];
1242 | ary[y] = temp;
1243 | }
1244 |
1245 | /**
1246 | * Returns a random integer within the range `low .. high` inclusive.
1247 | *
1248 | * @param {Number} low
1249 | * The lower bound on the range.
1250 | * @param {Number} high
1251 | * The upper bound on the range.
1252 | */
1253 | function randomIntInRange(low, high) {
1254 | return Math.round(low + (Math.random() * (high - low)));
1255 | }
1256 |
1257 | /**
1258 | * The Quick Sort algorithm.
1259 | *
1260 | * @param {Array} ary
1261 | * An array to sort.
1262 | * @param {function} comparator
1263 | * Function to use to compare two items.
1264 | * @param {Number} p
1265 | * Start index of the array
1266 | * @param {Number} r
1267 | * End index of the array
1268 | */
1269 | function doQuickSort(ary, comparator, p, r) {
1270 | // If our lower bound is less than our upper bound, we (1) partition the
1271 | // array into two pieces and (2) recurse on each half. If it is not, this is
1272 | // the empty array and our base case.
1273 |
1274 | if (p < r) {
1275 | // (1) Partitioning.
1276 | //
1277 | // The partitioning chooses a pivot between `p` and `r` and moves all
1278 | // elements that are less than or equal to the pivot to the before it, and
1279 | // all the elements that are greater than it after it. The effect is that
1280 | // once partition is done, the pivot is in the exact place it will be when
1281 | // the array is put in sorted order, and it will not need to be moved
1282 | // again. This runs in O(n) time.
1283 |
1284 | // Always choose a random pivot so that an input array which is reverse
1285 | // sorted does not cause O(n^2) running time.
1286 | var pivotIndex = randomIntInRange(p, r);
1287 | var i = p - 1;
1288 |
1289 | swap(ary, pivotIndex, r);
1290 | var pivot = ary[r];
1291 |
1292 | // Immediately after `j` is incremented in this loop, the following hold
1293 | // true:
1294 | //
1295 | // * Every element in `ary[p .. i]` is less than or equal to the pivot.
1296 | //
1297 | // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
1298 | for (var j = p; j < r; j++) {
1299 | if (comparator(ary[j], pivot) <= 0) {
1300 | i += 1;
1301 | swap(ary, i, j);
1302 | }
1303 | }
1304 |
1305 | swap(ary, i + 1, j);
1306 | var q = i + 1;
1307 |
1308 | // (2) Recurse on each half.
1309 |
1310 | doQuickSort(ary, comparator, p, q - 1);
1311 | doQuickSort(ary, comparator, q + 1, r);
1312 | }
1313 | }
1314 |
1315 | /**
1316 | * Sort the given array in-place with the given comparator function.
1317 | *
1318 | * @param {Array} ary
1319 | * An array to sort.
1320 | * @param {function} comparator
1321 | * Function to use to compare two items.
1322 | */
1323 | exports.U = function (ary, comparator) {
1324 | doQuickSort(ary, comparator, 0, ary.length - 1);
1325 | };
1326 |
1327 |
1328 | /***/ }),
1329 |
1330 | /***/ 327:
1331 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1332 |
1333 | var __webpack_unused_export__;
1334 | /* -*- Mode: js; js-indent-level: 2; -*- */
1335 | /*
1336 | * Copyright 2011 Mozilla Foundation and contributors
1337 | * Licensed under the New BSD license. See LICENSE or:
1338 | * http://opensource.org/licenses/BSD-3-Clause
1339 | */
1340 |
1341 | var util = __webpack_require__(983);
1342 | var binarySearch = __webpack_require__(164);
1343 | var ArraySet = __webpack_require__(837)/* .ArraySet */ .I;
1344 | var base64VLQ = __webpack_require__(215);
1345 | var quickSort = __webpack_require__(226)/* .quickSort */ .U;
1346 |
1347 | function SourceMapConsumer(aSourceMap, aSourceMapURL) {
1348 | var sourceMap = aSourceMap;
1349 | if (typeof aSourceMap === 'string') {
1350 | sourceMap = util.parseSourceMapInput(aSourceMap);
1351 | }
1352 |
1353 | return sourceMap.sections != null
1354 | ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
1355 | : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
1356 | }
1357 |
1358 | SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
1359 | return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
1360 | }
1361 |
1362 | /**
1363 | * The version of the source mapping spec that we are consuming.
1364 | */
1365 | SourceMapConsumer.prototype._version = 3;
1366 |
1367 | // `__generatedMappings` and `__originalMappings` are arrays that hold the
1368 | // parsed mapping coordinates from the source map's "mappings" attribute. They
1369 | // are lazily instantiated, accessed via the `_generatedMappings` and
1370 | // `_originalMappings` getters respectively, and we only parse the mappings
1371 | // and create these arrays once queried for a source location. We jump through
1372 | // these hoops because there can be many thousands of mappings, and parsing
1373 | // them is expensive, so we only want to do it if we must.
1374 | //
1375 | // Each object in the arrays is of the form:
1376 | //
1377 | // {
1378 | // generatedLine: The line number in the generated code,
1379 | // generatedColumn: The column number in the generated code,
1380 | // source: The path to the original source file that generated this
1381 | // chunk of code,
1382 | // originalLine: The line number in the original source that
1383 | // corresponds to this chunk of generated code,
1384 | // originalColumn: The column number in the original source that
1385 | // corresponds to this chunk of generated code,
1386 | // name: The name of the original symbol which generated this chunk of
1387 | // code.
1388 | // }
1389 | //
1390 | // All properties except for `generatedLine` and `generatedColumn` can be
1391 | // `null`.
1392 | //
1393 | // `_generatedMappings` is ordered by the generated positions.
1394 | //
1395 | // `_originalMappings` is ordered by the original positions.
1396 |
1397 | SourceMapConsumer.prototype.__generatedMappings = null;
1398 | Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
1399 | configurable: true,
1400 | enumerable: true,
1401 | get: function () {
1402 | if (!this.__generatedMappings) {
1403 | this._parseMappings(this._mappings, this.sourceRoot);
1404 | }
1405 |
1406 | return this.__generatedMappings;
1407 | }
1408 | });
1409 |
1410 | SourceMapConsumer.prototype.__originalMappings = null;
1411 | Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
1412 | configurable: true,
1413 | enumerable: true,
1414 | get: function () {
1415 | if (!this.__originalMappings) {
1416 | this._parseMappings(this._mappings, this.sourceRoot);
1417 | }
1418 |
1419 | return this.__originalMappings;
1420 | }
1421 | });
1422 |
1423 | SourceMapConsumer.prototype._charIsMappingSeparator =
1424 | function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
1425 | var c = aStr.charAt(index);
1426 | return c === ";" || c === ",";
1427 | };
1428 |
1429 | /**
1430 | * Parse the mappings in a string in to a data structure which we can easily
1431 | * query (the ordered arrays in the `this.__generatedMappings` and
1432 | * `this.__originalMappings` properties).
1433 | */
1434 | SourceMapConsumer.prototype._parseMappings =
1435 | function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
1436 | throw new Error("Subclasses must implement _parseMappings");
1437 | };
1438 |
1439 | SourceMapConsumer.GENERATED_ORDER = 1;
1440 | SourceMapConsumer.ORIGINAL_ORDER = 2;
1441 |
1442 | SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
1443 | SourceMapConsumer.LEAST_UPPER_BOUND = 2;
1444 |
1445 | /**
1446 | * Iterate over each mapping between an original source/line/column and a
1447 | * generated line/column in this source map.
1448 | *
1449 | * @param Function aCallback
1450 | * The function that is called with each mapping.
1451 | * @param Object aContext
1452 | * Optional. If specified, this object will be the value of `this` every
1453 | * time that `aCallback` is called.
1454 | * @param aOrder
1455 | * Either `SourceMapConsumer.GENERATED_ORDER` or
1456 | * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
1457 | * iterate over the mappings sorted by the generated file's line/column
1458 | * order or the original's source/line/column order, respectively. Defaults to
1459 | * `SourceMapConsumer.GENERATED_ORDER`.
1460 | */
1461 | SourceMapConsumer.prototype.eachMapping =
1462 | function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
1463 | var context = aContext || null;
1464 | var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
1465 |
1466 | var mappings;
1467 | switch (order) {
1468 | case SourceMapConsumer.GENERATED_ORDER:
1469 | mappings = this._generatedMappings;
1470 | break;
1471 | case SourceMapConsumer.ORIGINAL_ORDER:
1472 | mappings = this._originalMappings;
1473 | break;
1474 | default:
1475 | throw new Error("Unknown order of iteration.");
1476 | }
1477 |
1478 | var sourceRoot = this.sourceRoot;
1479 | mappings.map(function (mapping) {
1480 | var source = mapping.source === null ? null : this._sources.at(mapping.source);
1481 | source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
1482 | return {
1483 | source: source,
1484 | generatedLine: mapping.generatedLine,
1485 | generatedColumn: mapping.generatedColumn,
1486 | originalLine: mapping.originalLine,
1487 | originalColumn: mapping.originalColumn,
1488 | name: mapping.name === null ? null : this._names.at(mapping.name)
1489 | };
1490 | }, this).forEach(aCallback, context);
1491 | };
1492 |
1493 | /**
1494 | * Returns all generated line and column information for the original source,
1495 | * line, and column provided. If no column is provided, returns all mappings
1496 | * corresponding to a either the line we are searching for or the next
1497 | * closest line that has any mappings. Otherwise, returns all mappings
1498 | * corresponding to the given line and either the column we are searching for
1499 | * or the next closest column that has any offsets.
1500 | *
1501 | * The only argument is an object with the following properties:
1502 | *
1503 | * - source: The filename of the original source.
1504 | * - line: The line number in the original source. The line number is 1-based.
1505 | * - column: Optional. the column number in the original source.
1506 | * The column number is 0-based.
1507 | *
1508 | * and an array of objects is returned, each with the following properties:
1509 | *
1510 | * - line: The line number in the generated source, or null. The
1511 | * line number is 1-based.
1512 | * - column: The column number in the generated source, or null.
1513 | * The column number is 0-based.
1514 | */
1515 | SourceMapConsumer.prototype.allGeneratedPositionsFor =
1516 | function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
1517 | var line = util.getArg(aArgs, 'line');
1518 |
1519 | // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
1520 | // returns the index of the closest mapping less than the needle. By
1521 | // setting needle.originalColumn to 0, we thus find the last mapping for
1522 | // the given line, provided such a mapping exists.
1523 | var needle = {
1524 | source: util.getArg(aArgs, 'source'),
1525 | originalLine: line,
1526 | originalColumn: util.getArg(aArgs, 'column', 0)
1527 | };
1528 |
1529 | needle.source = this._findSourceIndex(needle.source);
1530 | if (needle.source < 0) {
1531 | return [];
1532 | }
1533 |
1534 | var mappings = [];
1535 |
1536 | var index = this._findMapping(needle,
1537 | this._originalMappings,
1538 | "originalLine",
1539 | "originalColumn",
1540 | util.compareByOriginalPositions,
1541 | binarySearch.LEAST_UPPER_BOUND);
1542 | if (index >= 0) {
1543 | var mapping = this._originalMappings[index];
1544 |
1545 | if (aArgs.column === undefined) {
1546 | var originalLine = mapping.originalLine;
1547 |
1548 | // Iterate until either we run out of mappings, or we run into
1549 | // a mapping for a different line than the one we found. Since
1550 | // mappings are sorted, this is guaranteed to find all mappings for
1551 | // the line we found.
1552 | while (mapping && mapping.originalLine === originalLine) {
1553 | mappings.push({
1554 | line: util.getArg(mapping, 'generatedLine', null),
1555 | column: util.getArg(mapping, 'generatedColumn', null),
1556 | lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
1557 | });
1558 |
1559 | mapping = this._originalMappings[++index];
1560 | }
1561 | } else {
1562 | var originalColumn = mapping.originalColumn;
1563 |
1564 | // Iterate until either we run out of mappings, or we run into
1565 | // a mapping for a different line than the one we were searching for.
1566 | // Since mappings are sorted, this is guaranteed to find all mappings for
1567 | // the line we are searching for.
1568 | while (mapping &&
1569 | mapping.originalLine === line &&
1570 | mapping.originalColumn == originalColumn) {
1571 | mappings.push({
1572 | line: util.getArg(mapping, 'generatedLine', null),
1573 | column: util.getArg(mapping, 'generatedColumn', null),
1574 | lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
1575 | });
1576 |
1577 | mapping = this._originalMappings[++index];
1578 | }
1579 | }
1580 | }
1581 |
1582 | return mappings;
1583 | };
1584 |
1585 | exports.SourceMapConsumer = SourceMapConsumer;
1586 |
1587 | /**
1588 | * A BasicSourceMapConsumer instance represents a parsed source map which we can
1589 | * query for information about the original file positions by giving it a file
1590 | * position in the generated source.
1591 | *
1592 | * The first parameter is the raw source map (either as a JSON string, or
1593 | * already parsed to an object). According to the spec, source maps have the
1594 | * following attributes:
1595 | *
1596 | * - version: Which version of the source map spec this map is following.
1597 | * - sources: An array of URLs to the original source files.
1598 | * - names: An array of identifiers which can be referrenced by individual mappings.
1599 | * - sourceRoot: Optional. The URL root from which all sources are relative.
1600 | * - sourcesContent: Optional. An array of contents of the original source files.
1601 | * - mappings: A string of base64 VLQs which contain the actual mappings.
1602 | * - file: Optional. The generated file this source map is associated with.
1603 | *
1604 | * Here is an example source map, taken from the source map spec[0]:
1605 | *
1606 | * {
1607 | * version : 3,
1608 | * file: "out.js",
1609 | * sourceRoot : "",
1610 | * sources: ["foo.js", "bar.js"],
1611 | * names: ["src", "maps", "are", "fun"],
1612 | * mappings: "AA,AB;;ABCDE;"
1613 | * }
1614 | *
1615 | * The second parameter, if given, is a string whose value is the URL
1616 | * at which the source map was found. This URL is used to compute the
1617 | * sources array.
1618 | *
1619 | * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
1620 | */
1621 | function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
1622 | var sourceMap = aSourceMap;
1623 | if (typeof aSourceMap === 'string') {
1624 | sourceMap = util.parseSourceMapInput(aSourceMap);
1625 | }
1626 |
1627 | var version = util.getArg(sourceMap, 'version');
1628 | var sources = util.getArg(sourceMap, 'sources');
1629 | // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
1630 | // requires the array) to play nice here.
1631 | var names = util.getArg(sourceMap, 'names', []);
1632 | var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
1633 | var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
1634 | var mappings = util.getArg(sourceMap, 'mappings');
1635 | var file = util.getArg(sourceMap, 'file', null);
1636 |
1637 | // Once again, Sass deviates from the spec and supplies the version as a
1638 | // string rather than a number, so we use loose equality checking here.
1639 | if (version != this._version) {
1640 | throw new Error('Unsupported version: ' + version);
1641 | }
1642 |
1643 | if (sourceRoot) {
1644 | sourceRoot = util.normalize(sourceRoot);
1645 | }
1646 |
1647 | sources = sources
1648 | .map(String)
1649 | // Some source maps produce relative source paths like "./foo.js" instead of
1650 | // "foo.js". Normalize these first so that future comparisons will succeed.
1651 | // See bugzil.la/1090768.
1652 | .map(util.normalize)
1653 | // Always ensure that absolute sources are internally stored relative to
1654 | // the source root, if the source root is absolute. Not doing this would
1655 | // be particularly problematic when the source root is a prefix of the
1656 | // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
1657 | .map(function (source) {
1658 | return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
1659 | ? util.relative(sourceRoot, source)
1660 | : source;
1661 | });
1662 |
1663 | // Pass `true` below to allow duplicate names and sources. While source maps
1664 | // are intended to be compressed and deduplicated, the TypeScript compiler
1665 | // sometimes generates source maps with duplicates in them. See Github issue
1666 | // #72 and bugzil.la/889492.
1667 | this._names = ArraySet.fromArray(names.map(String), true);
1668 | this._sources = ArraySet.fromArray(sources, true);
1669 |
1670 | this._absoluteSources = this._sources.toArray().map(function (s) {
1671 | return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
1672 | });
1673 |
1674 | this.sourceRoot = sourceRoot;
1675 | this.sourcesContent = sourcesContent;
1676 | this._mappings = mappings;
1677 | this._sourceMapURL = aSourceMapURL;
1678 | this.file = file;
1679 | }
1680 |
1681 | BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
1682 | BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
1683 |
1684 | /**
1685 | * Utility function to find the index of a source. Returns -1 if not
1686 | * found.
1687 | */
1688 | BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
1689 | var relativeSource = aSource;
1690 | if (this.sourceRoot != null) {
1691 | relativeSource = util.relative(this.sourceRoot, relativeSource);
1692 | }
1693 |
1694 | if (this._sources.has(relativeSource)) {
1695 | return this._sources.indexOf(relativeSource);
1696 | }
1697 |
1698 | // Maybe aSource is an absolute URL as returned by |sources|. In
1699 | // this case we can't simply undo the transform.
1700 | var i;
1701 | for (i = 0; i < this._absoluteSources.length; ++i) {
1702 | if (this._absoluteSources[i] == aSource) {
1703 | return i;
1704 | }
1705 | }
1706 |
1707 | return -1;
1708 | };
1709 |
1710 | /**
1711 | * Create a BasicSourceMapConsumer from a SourceMapGenerator.
1712 | *
1713 | * @param SourceMapGenerator aSourceMap
1714 | * The source map that will be consumed.
1715 | * @param String aSourceMapURL
1716 | * The URL at which the source map can be found (optional)
1717 | * @returns BasicSourceMapConsumer
1718 | */
1719 | BasicSourceMapConsumer.fromSourceMap =
1720 | function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
1721 | var smc = Object.create(BasicSourceMapConsumer.prototype);
1722 |
1723 | var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
1724 | var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
1725 | smc.sourceRoot = aSourceMap._sourceRoot;
1726 | smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
1727 | smc.sourceRoot);
1728 | smc.file = aSourceMap._file;
1729 | smc._sourceMapURL = aSourceMapURL;
1730 | smc._absoluteSources = smc._sources.toArray().map(function (s) {
1731 | return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
1732 | });
1733 |
1734 | // Because we are modifying the entries (by converting string sources and
1735 | // names to indices into the sources and names ArraySets), we have to make
1736 | // a copy of the entry or else bad things happen. Shared mutable state
1737 | // strikes again! See github issue #191.
1738 |
1739 | var generatedMappings = aSourceMap._mappings.toArray().slice();
1740 | var destGeneratedMappings = smc.__generatedMappings = [];
1741 | var destOriginalMappings = smc.__originalMappings = [];
1742 |
1743 | for (var i = 0, length = generatedMappings.length; i < length; i++) {
1744 | var srcMapping = generatedMappings[i];
1745 | var destMapping = new Mapping;
1746 | destMapping.generatedLine = srcMapping.generatedLine;
1747 | destMapping.generatedColumn = srcMapping.generatedColumn;
1748 |
1749 | if (srcMapping.source) {
1750 | destMapping.source = sources.indexOf(srcMapping.source);
1751 | destMapping.originalLine = srcMapping.originalLine;
1752 | destMapping.originalColumn = srcMapping.originalColumn;
1753 |
1754 | if (srcMapping.name) {
1755 | destMapping.name = names.indexOf(srcMapping.name);
1756 | }
1757 |
1758 | destOriginalMappings.push(destMapping);
1759 | }
1760 |
1761 | destGeneratedMappings.push(destMapping);
1762 | }
1763 |
1764 | quickSort(smc.__originalMappings, util.compareByOriginalPositions);
1765 |
1766 | return smc;
1767 | };
1768 |
1769 | /**
1770 | * The version of the source mapping spec that we are consuming.
1771 | */
1772 | BasicSourceMapConsumer.prototype._version = 3;
1773 |
1774 | /**
1775 | * The list of original sources.
1776 | */
1777 | Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
1778 | get: function () {
1779 | return this._absoluteSources.slice();
1780 | }
1781 | });
1782 |
1783 | /**
1784 | * Provide the JIT with a nice shape / hidden class.
1785 | */
1786 | function Mapping() {
1787 | this.generatedLine = 0;
1788 | this.generatedColumn = 0;
1789 | this.source = null;
1790 | this.originalLine = null;
1791 | this.originalColumn = null;
1792 | this.name = null;
1793 | }
1794 |
1795 | /**
1796 | * Parse the mappings in a string in to a data structure which we can easily
1797 | * query (the ordered arrays in the `this.__generatedMappings` and
1798 | * `this.__originalMappings` properties).
1799 | */
1800 | BasicSourceMapConsumer.prototype._parseMappings =
1801 | function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
1802 | var generatedLine = 1;
1803 | var previousGeneratedColumn = 0;
1804 | var previousOriginalLine = 0;
1805 | var previousOriginalColumn = 0;
1806 | var previousSource = 0;
1807 | var previousName = 0;
1808 | var length = aStr.length;
1809 | var index = 0;
1810 | var cachedSegments = {};
1811 | var temp = {};
1812 | var originalMappings = [];
1813 | var generatedMappings = [];
1814 | var mapping, str, segment, end, value;
1815 |
1816 | while (index < length) {
1817 | if (aStr.charAt(index) === ';') {
1818 | generatedLine++;
1819 | index++;
1820 | previousGeneratedColumn = 0;
1821 | }
1822 | else if (aStr.charAt(index) === ',') {
1823 | index++;
1824 | }
1825 | else {
1826 | mapping = new Mapping();
1827 | mapping.generatedLine = generatedLine;
1828 |
1829 | // Because each offset is encoded relative to the previous one,
1830 | // many segments often have the same encoding. We can exploit this
1831 | // fact by caching the parsed variable length fields of each segment,
1832 | // allowing us to avoid a second parse if we encounter the same
1833 | // segment again.
1834 | for (end = index; end < length; end++) {
1835 | if (this._charIsMappingSeparator(aStr, end)) {
1836 | break;
1837 | }
1838 | }
1839 | str = aStr.slice(index, end);
1840 |
1841 | segment = cachedSegments[str];
1842 | if (segment) {
1843 | index += str.length;
1844 | } else {
1845 | segment = [];
1846 | while (index < end) {
1847 | base64VLQ.decode(aStr, index, temp);
1848 | value = temp.value;
1849 | index = temp.rest;
1850 | segment.push(value);
1851 | }
1852 |
1853 | if (segment.length === 2) {
1854 | throw new Error('Found a source, but no line and column');
1855 | }
1856 |
1857 | if (segment.length === 3) {
1858 | throw new Error('Found a source and line, but no column');
1859 | }
1860 |
1861 | cachedSegments[str] = segment;
1862 | }
1863 |
1864 | // Generated column.
1865 | mapping.generatedColumn = previousGeneratedColumn + segment[0];
1866 | previousGeneratedColumn = mapping.generatedColumn;
1867 |
1868 | if (segment.length > 1) {
1869 | // Original source.
1870 | mapping.source = previousSource + segment[1];
1871 | previousSource += segment[1];
1872 |
1873 | // Original line.
1874 | mapping.originalLine = previousOriginalLine + segment[2];
1875 | previousOriginalLine = mapping.originalLine;
1876 | // Lines are stored 0-based
1877 | mapping.originalLine += 1;
1878 |
1879 | // Original column.
1880 | mapping.originalColumn = previousOriginalColumn + segment[3];
1881 | previousOriginalColumn = mapping.originalColumn;
1882 |
1883 | if (segment.length > 4) {
1884 | // Original name.
1885 | mapping.name = previousName + segment[4];
1886 | previousName += segment[4];
1887 | }
1888 | }
1889 |
1890 | generatedMappings.push(mapping);
1891 | if (typeof mapping.originalLine === 'number') {
1892 | originalMappings.push(mapping);
1893 | }
1894 | }
1895 | }
1896 |
1897 | quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
1898 | this.__generatedMappings = generatedMappings;
1899 |
1900 | quickSort(originalMappings, util.compareByOriginalPositions);
1901 | this.__originalMappings = originalMappings;
1902 | };
1903 |
1904 | /**
1905 | * Find the mapping that best matches the hypothetical "needle" mapping that
1906 | * we are searching for in the given "haystack" of mappings.
1907 | */
1908 | BasicSourceMapConsumer.prototype._findMapping =
1909 | function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
1910 | aColumnName, aComparator, aBias) {
1911 | // To return the position we are searching for, we must first find the
1912 | // mapping for the given position and then return the opposite position it
1913 | // points to. Because the mappings are sorted, we can use binary search to
1914 | // find the best mapping.
1915 |
1916 | if (aNeedle[aLineName] <= 0) {
1917 | throw new TypeError('Line must be greater than or equal to 1, got '
1918 | + aNeedle[aLineName]);
1919 | }
1920 | if (aNeedle[aColumnName] < 0) {
1921 | throw new TypeError('Column must be greater than or equal to 0, got '
1922 | + aNeedle[aColumnName]);
1923 | }
1924 |
1925 | return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
1926 | };
1927 |
1928 | /**
1929 | * Compute the last column for each generated mapping. The last column is
1930 | * inclusive.
1931 | */
1932 | BasicSourceMapConsumer.prototype.computeColumnSpans =
1933 | function SourceMapConsumer_computeColumnSpans() {
1934 | for (var index = 0; index < this._generatedMappings.length; ++index) {
1935 | var mapping = this._generatedMappings[index];
1936 |
1937 | // Mappings do not contain a field for the last generated columnt. We
1938 | // can come up with an optimistic estimate, however, by assuming that
1939 | // mappings are contiguous (i.e. given two consecutive mappings, the
1940 | // first mapping ends where the second one starts).
1941 | if (index + 1 < this._generatedMappings.length) {
1942 | var nextMapping = this._generatedMappings[index + 1];
1943 |
1944 | if (mapping.generatedLine === nextMapping.generatedLine) {
1945 | mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
1946 | continue;
1947 | }
1948 | }
1949 |
1950 | // The last mapping for each line spans the entire line.
1951 | mapping.lastGeneratedColumn = Infinity;
1952 | }
1953 | };
1954 |
1955 | /**
1956 | * Returns the original source, line, and column information for the generated
1957 | * source's line and column positions provided. The only argument is an object
1958 | * with the following properties:
1959 | *
1960 | * - line: The line number in the generated source. The line number
1961 | * is 1-based.
1962 | * - column: The column number in the generated source. The column
1963 | * number is 0-based.
1964 | * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
1965 | * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
1966 | * closest element that is smaller than or greater than the one we are
1967 | * searching for, respectively, if the exact element cannot be found.
1968 | * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
1969 | *
1970 | * and an object is returned with the following properties:
1971 | *
1972 | * - source: The original source file, or null.
1973 | * - line: The line number in the original source, or null. The
1974 | * line number is 1-based.
1975 | * - column: The column number in the original source, or null. The
1976 | * column number is 0-based.
1977 | * - name: The original identifier, or null.
1978 | */
1979 | BasicSourceMapConsumer.prototype.originalPositionFor =
1980 | function SourceMapConsumer_originalPositionFor(aArgs) {
1981 | var needle = {
1982 | generatedLine: util.getArg(aArgs, 'line'),
1983 | generatedColumn: util.getArg(aArgs, 'column')
1984 | };
1985 |
1986 | var index = this._findMapping(
1987 | needle,
1988 | this._generatedMappings,
1989 | "generatedLine",
1990 | "generatedColumn",
1991 | util.compareByGeneratedPositionsDeflated,
1992 | util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
1993 | );
1994 |
1995 | if (index >= 0) {
1996 | var mapping = this._generatedMappings[index];
1997 |
1998 | if (mapping.generatedLine === needle.generatedLine) {
1999 | var source = util.getArg(mapping, 'source', null);
2000 | if (source !== null) {
2001 | source = this._sources.at(source);
2002 | source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
2003 | }
2004 | var name = util.getArg(mapping, 'name', null);
2005 | if (name !== null) {
2006 | name = this._names.at(name);
2007 | }
2008 | return {
2009 | source: source,
2010 | line: util.getArg(mapping, 'originalLine', null),
2011 | column: util.getArg(mapping, 'originalColumn', null),
2012 | name: name
2013 | };
2014 | }
2015 | }
2016 |
2017 | return {
2018 | source: null,
2019 | line: null,
2020 | column: null,
2021 | name: null
2022 | };
2023 | };
2024 |
2025 | /**
2026 | * Return true if we have the source content for every source in the source
2027 | * map, false otherwise.
2028 | */
2029 | BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
2030 | function BasicSourceMapConsumer_hasContentsOfAllSources() {
2031 | if (!this.sourcesContent) {
2032 | return false;
2033 | }
2034 | return this.sourcesContent.length >= this._sources.size() &&
2035 | !this.sourcesContent.some(function (sc) { return sc == null; });
2036 | };
2037 |
2038 | /**
2039 | * Returns the original source content. The only argument is the url of the
2040 | * original source file. Returns null if no original source content is
2041 | * available.
2042 | */
2043 | BasicSourceMapConsumer.prototype.sourceContentFor =
2044 | function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
2045 | if (!this.sourcesContent) {
2046 | return null;
2047 | }
2048 |
2049 | var index = this._findSourceIndex(aSource);
2050 | if (index >= 0) {
2051 | return this.sourcesContent[index];
2052 | }
2053 |
2054 | var relativeSource = aSource;
2055 | if (this.sourceRoot != null) {
2056 | relativeSource = util.relative(this.sourceRoot, relativeSource);
2057 | }
2058 |
2059 | var url;
2060 | if (this.sourceRoot != null
2061 | && (url = util.urlParse(this.sourceRoot))) {
2062 | // XXX: file:// URIs and absolute paths lead to unexpected behavior for
2063 | // many users. We can help them out when they expect file:// URIs to
2064 | // behave like it would if they were running a local HTTP server. See
2065 | // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
2066 | var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
2067 | if (url.scheme == "file"
2068 | && this._sources.has(fileUriAbsPath)) {
2069 | return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
2070 | }
2071 |
2072 | if ((!url.path || url.path == "/")
2073 | && this._sources.has("/" + relativeSource)) {
2074 | return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
2075 | }
2076 | }
2077 |
2078 | // This function is used recursively from
2079 | // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
2080 | // don't want to throw if we can't find the source - we just want to
2081 | // return null, so we provide a flag to exit gracefully.
2082 | if (nullOnMissing) {
2083 | return null;
2084 | }
2085 | else {
2086 | throw new Error('"' + relativeSource + '" is not in the SourceMap.');
2087 | }
2088 | };
2089 |
2090 | /**
2091 | * Returns the generated line and column information for the original source,
2092 | * line, and column positions provided. The only argument is an object with
2093 | * the following properties:
2094 | *
2095 | * - source: The filename of the original source.
2096 | * - line: The line number in the original source. The line number
2097 | * is 1-based.
2098 | * - column: The column number in the original source. The column
2099 | * number is 0-based.
2100 | * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
2101 | * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
2102 | * closest element that is smaller than or greater than the one we are
2103 | * searching for, respectively, if the exact element cannot be found.
2104 | * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
2105 | *
2106 | * and an object is returned with the following properties:
2107 | *
2108 | * - line: The line number in the generated source, or null. The
2109 | * line number is 1-based.
2110 | * - column: The column number in the generated source, or null.
2111 | * The column number is 0-based.
2112 | */
2113 | BasicSourceMapConsumer.prototype.generatedPositionFor =
2114 | function SourceMapConsumer_generatedPositionFor(aArgs) {
2115 | var source = util.getArg(aArgs, 'source');
2116 | source = this._findSourceIndex(source);
2117 | if (source < 0) {
2118 | return {
2119 | line: null,
2120 | column: null,
2121 | lastColumn: null
2122 | };
2123 | }
2124 |
2125 | var needle = {
2126 | source: source,
2127 | originalLine: util.getArg(aArgs, 'line'),
2128 | originalColumn: util.getArg(aArgs, 'column')
2129 | };
2130 |
2131 | var index = this._findMapping(
2132 | needle,
2133 | this._originalMappings,
2134 | "originalLine",
2135 | "originalColumn",
2136 | util.compareByOriginalPositions,
2137 | util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
2138 | );
2139 |
2140 | if (index >= 0) {
2141 | var mapping = this._originalMappings[index];
2142 |
2143 | if (mapping.source === needle.source) {
2144 | return {
2145 | line: util.getArg(mapping, 'generatedLine', null),
2146 | column: util.getArg(mapping, 'generatedColumn', null),
2147 | lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
2148 | };
2149 | }
2150 | }
2151 |
2152 | return {
2153 | line: null,
2154 | column: null,
2155 | lastColumn: null
2156 | };
2157 | };
2158 |
2159 | __webpack_unused_export__ = BasicSourceMapConsumer;
2160 |
2161 | /**
2162 | * An IndexedSourceMapConsumer instance represents a parsed source map which
2163 | * we can query for information. It differs from BasicSourceMapConsumer in
2164 | * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
2165 | * input.
2166 | *
2167 | * The first parameter is a raw source map (either as a JSON string, or already
2168 | * parsed to an object). According to the spec for indexed source maps, they
2169 | * have the following attributes:
2170 | *
2171 | * - version: Which version of the source map spec this map is following.
2172 | * - file: Optional. The generated file this source map is associated with.
2173 | * - sections: A list of section definitions.
2174 | *
2175 | * Each value under the "sections" field has two fields:
2176 | * - offset: The offset into the original specified at which this section
2177 | * begins to apply, defined as an object with a "line" and "column"
2178 | * field.
2179 | * - map: A source map definition. This source map could also be indexed,
2180 | * but doesn't have to be.
2181 | *
2182 | * Instead of the "map" field, it's also possible to have a "url" field
2183 | * specifying a URL to retrieve a source map from, but that's currently
2184 | * unsupported.
2185 | *
2186 | * Here's an example source map, taken from the source map spec[0], but
2187 | * modified to omit a section which uses the "url" field.
2188 | *
2189 | * {
2190 | * version : 3,
2191 | * file: "app.js",
2192 | * sections: [{
2193 | * offset: {line:100, column:10},
2194 | * map: {
2195 | * version : 3,
2196 | * file: "section.js",
2197 | * sources: ["foo.js", "bar.js"],
2198 | * names: ["src", "maps", "are", "fun"],
2199 | * mappings: "AAAA,E;;ABCDE;"
2200 | * }
2201 | * }],
2202 | * }
2203 | *
2204 | * The second parameter, if given, is a string whose value is the URL
2205 | * at which the source map was found. This URL is used to compute the
2206 | * sources array.
2207 | *
2208 | * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
2209 | */
2210 | function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
2211 | var sourceMap = aSourceMap;
2212 | if (typeof aSourceMap === 'string') {
2213 | sourceMap = util.parseSourceMapInput(aSourceMap);
2214 | }
2215 |
2216 | var version = util.getArg(sourceMap, 'version');
2217 | var sections = util.getArg(sourceMap, 'sections');
2218 |
2219 | if (version != this._version) {
2220 | throw new Error('Unsupported version: ' + version);
2221 | }
2222 |
2223 | this._sources = new ArraySet();
2224 | this._names = new ArraySet();
2225 |
2226 | var lastOffset = {
2227 | line: -1,
2228 | column: 0
2229 | };
2230 | this._sections = sections.map(function (s) {
2231 | if (s.url) {
2232 | // The url field will require support for asynchronicity.
2233 | // See https://github.com/mozilla/source-map/issues/16
2234 | throw new Error('Support for url field in sections not implemented.');
2235 | }
2236 | var offset = util.getArg(s, 'offset');
2237 | var offsetLine = util.getArg(offset, 'line');
2238 | var offsetColumn = util.getArg(offset, 'column');
2239 |
2240 | if (offsetLine < lastOffset.line ||
2241 | (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
2242 | throw new Error('Section offsets must be ordered and non-overlapping.');
2243 | }
2244 | lastOffset = offset;
2245 |
2246 | return {
2247 | generatedOffset: {
2248 | // The offset fields are 0-based, but we use 1-based indices when
2249 | // encoding/decoding from VLQ.
2250 | generatedLine: offsetLine + 1,
2251 | generatedColumn: offsetColumn + 1
2252 | },
2253 | consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
2254 | }
2255 | });
2256 | }
2257 |
2258 | IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
2259 | IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
2260 |
2261 | /**
2262 | * The version of the source mapping spec that we are consuming.
2263 | */
2264 | IndexedSourceMapConsumer.prototype._version = 3;
2265 |
2266 | /**
2267 | * The list of original sources.
2268 | */
2269 | Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
2270 | get: function () {
2271 | var sources = [];
2272 | for (var i = 0; i < this._sections.length; i++) {
2273 | for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
2274 | sources.push(this._sections[i].consumer.sources[j]);
2275 | }
2276 | }
2277 | return sources;
2278 | }
2279 | });
2280 |
2281 | /**
2282 | * Returns the original source, line, and column information for the generated
2283 | * source's line and column positions provided. The only argument is an object
2284 | * with the following properties:
2285 | *
2286 | * - line: The line number in the generated source. The line number
2287 | * is 1-based.
2288 | * - column: The column number in the generated source. The column
2289 | * number is 0-based.
2290 | *
2291 | * and an object is returned with the following properties:
2292 | *
2293 | * - source: The original source file, or null.
2294 | * - line: The line number in the original source, or null. The
2295 | * line number is 1-based.
2296 | * - column: The column number in the original source, or null. The
2297 | * column number is 0-based.
2298 | * - name: The original identifier, or null.
2299 | */
2300 | IndexedSourceMapConsumer.prototype.originalPositionFor =
2301 | function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
2302 | var needle = {
2303 | generatedLine: util.getArg(aArgs, 'line'),
2304 | generatedColumn: util.getArg(aArgs, 'column')
2305 | };
2306 |
2307 | // Find the section containing the generated position we're trying to map
2308 | // to an original position.
2309 | var sectionIndex = binarySearch.search(needle, this._sections,
2310 | function(needle, section) {
2311 | var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
2312 | if (cmp) {
2313 | return cmp;
2314 | }
2315 |
2316 | return (needle.generatedColumn -
2317 | section.generatedOffset.generatedColumn);
2318 | });
2319 | var section = this._sections[sectionIndex];
2320 |
2321 | if (!section) {
2322 | return {
2323 | source: null,
2324 | line: null,
2325 | column: null,
2326 | name: null
2327 | };
2328 | }
2329 |
2330 | return section.consumer.originalPositionFor({
2331 | line: needle.generatedLine -
2332 | (section.generatedOffset.generatedLine - 1),
2333 | column: needle.generatedColumn -
2334 | (section.generatedOffset.generatedLine === needle.generatedLine
2335 | ? section.generatedOffset.generatedColumn - 1
2336 | : 0),
2337 | bias: aArgs.bias
2338 | });
2339 | };
2340 |
2341 | /**
2342 | * Return true if we have the source content for every source in the source
2343 | * map, false otherwise.
2344 | */
2345 | IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
2346 | function IndexedSourceMapConsumer_hasContentsOfAllSources() {
2347 | return this._sections.every(function (s) {
2348 | return s.consumer.hasContentsOfAllSources();
2349 | });
2350 | };
2351 |
2352 | /**
2353 | * Returns the original source content. The only argument is the url of the
2354 | * original source file. Returns null if no original source content is
2355 | * available.
2356 | */
2357 | IndexedSourceMapConsumer.prototype.sourceContentFor =
2358 | function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
2359 | for (var i = 0; i < this._sections.length; i++) {
2360 | var section = this._sections[i];
2361 |
2362 | var content = section.consumer.sourceContentFor(aSource, true);
2363 | if (content) {
2364 | return content;
2365 | }
2366 | }
2367 | if (nullOnMissing) {
2368 | return null;
2369 | }
2370 | else {
2371 | throw new Error('"' + aSource + '" is not in the SourceMap.');
2372 | }
2373 | };
2374 |
2375 | /**
2376 | * Returns the generated line and column information for the original source,
2377 | * line, and column positions provided. The only argument is an object with
2378 | * the following properties:
2379 | *
2380 | * - source: The filename of the original source.
2381 | * - line: The line number in the original source. The line number
2382 | * is 1-based.
2383 | * - column: The column number in the original source. The column
2384 | * number is 0-based.
2385 | *
2386 | * and an object is returned with the following properties:
2387 | *
2388 | * - line: The line number in the generated source, or null. The
2389 | * line number is 1-based.
2390 | * - column: The column number in the generated source, or null.
2391 | * The column number is 0-based.
2392 | */
2393 | IndexedSourceMapConsumer.prototype.generatedPositionFor =
2394 | function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
2395 | for (var i = 0; i < this._sections.length; i++) {
2396 | var section = this._sections[i];
2397 |
2398 | // Only consider this section if the requested source is in the list of
2399 | // sources of the consumer.
2400 | if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
2401 | continue;
2402 | }
2403 | var generatedPosition = section.consumer.generatedPositionFor(aArgs);
2404 | if (generatedPosition) {
2405 | var ret = {
2406 | line: generatedPosition.line +
2407 | (section.generatedOffset.generatedLine - 1),
2408 | column: generatedPosition.column +
2409 | (section.generatedOffset.generatedLine === generatedPosition.line
2410 | ? section.generatedOffset.generatedColumn - 1
2411 | : 0)
2412 | };
2413 | return ret;
2414 | }
2415 | }
2416 |
2417 | return {
2418 | line: null,
2419 | column: null
2420 | };
2421 | };
2422 |
2423 | /**
2424 | * Parse the mappings in a string in to a data structure which we can easily
2425 | * query (the ordered arrays in the `this.__generatedMappings` and
2426 | * `this.__originalMappings` properties).
2427 | */
2428 | IndexedSourceMapConsumer.prototype._parseMappings =
2429 | function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
2430 | this.__generatedMappings = [];
2431 | this.__originalMappings = [];
2432 | for (var i = 0; i < this._sections.length; i++) {
2433 | var section = this._sections[i];
2434 | var sectionMappings = section.consumer._generatedMappings;
2435 | for (var j = 0; j < sectionMappings.length; j++) {
2436 | var mapping = sectionMappings[j];
2437 |
2438 | var source = section.consumer._sources.at(mapping.source);
2439 | source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
2440 | this._sources.add(source);
2441 | source = this._sources.indexOf(source);
2442 |
2443 | var name = null;
2444 | if (mapping.name) {
2445 | name = section.consumer._names.at(mapping.name);
2446 | this._names.add(name);
2447 | name = this._names.indexOf(name);
2448 | }
2449 |
2450 | // The mappings coming from the consumer for the section have
2451 | // generated positions relative to the start of the section, so we
2452 | // need to offset them to be relative to the start of the concatenated
2453 | // generated file.
2454 | var adjustedMapping = {
2455 | source: source,
2456 | generatedLine: mapping.generatedLine +
2457 | (section.generatedOffset.generatedLine - 1),
2458 | generatedColumn: mapping.generatedColumn +
2459 | (section.generatedOffset.generatedLine === mapping.generatedLine
2460 | ? section.generatedOffset.generatedColumn - 1
2461 | : 0),
2462 | originalLine: mapping.originalLine,
2463 | originalColumn: mapping.originalColumn,
2464 | name: name
2465 | };
2466 |
2467 | this.__generatedMappings.push(adjustedMapping);
2468 | if (typeof adjustedMapping.originalLine === 'number') {
2469 | this.__originalMappings.push(adjustedMapping);
2470 | }
2471 | }
2472 | }
2473 |
2474 | quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
2475 | quickSort(this.__originalMappings, util.compareByOriginalPositions);
2476 | };
2477 |
2478 | __webpack_unused_export__ = IndexedSourceMapConsumer;
2479 |
2480 |
2481 | /***/ }),
2482 |
2483 | /***/ 341:
2484 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2485 |
2486 | /* -*- Mode: js; js-indent-level: 2; -*- */
2487 | /*
2488 | * Copyright 2011 Mozilla Foundation and contributors
2489 | * Licensed under the New BSD license. See LICENSE or:
2490 | * http://opensource.org/licenses/BSD-3-Clause
2491 | */
2492 |
2493 | var base64VLQ = __webpack_require__(215);
2494 | var util = __webpack_require__(983);
2495 | var ArraySet = __webpack_require__(837)/* .ArraySet */ .I;
2496 | var MappingList = __webpack_require__(740)/* .MappingList */ .H;
2497 |
2498 | /**
2499 | * An instance of the SourceMapGenerator represents a source map which is
2500 | * being built incrementally. You may pass an object with the following
2501 | * properties:
2502 | *
2503 | * - file: The filename of the generated source.
2504 | * - sourceRoot: A root for all relative URLs in this source map.
2505 | */
2506 | function SourceMapGenerator(aArgs) {
2507 | if (!aArgs) {
2508 | aArgs = {};
2509 | }
2510 | this._file = util.getArg(aArgs, 'file', null);
2511 | this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
2512 | this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
2513 | this._sources = new ArraySet();
2514 | this._names = new ArraySet();
2515 | this._mappings = new MappingList();
2516 | this._sourcesContents = null;
2517 | }
2518 |
2519 | SourceMapGenerator.prototype._version = 3;
2520 |
2521 | /**
2522 | * Creates a new SourceMapGenerator based on a SourceMapConsumer
2523 | *
2524 | * @param aSourceMapConsumer The SourceMap.
2525 | */
2526 | SourceMapGenerator.fromSourceMap =
2527 | function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
2528 | var sourceRoot = aSourceMapConsumer.sourceRoot;
2529 | var generator = new SourceMapGenerator({
2530 | file: aSourceMapConsumer.file,
2531 | sourceRoot: sourceRoot
2532 | });
2533 | aSourceMapConsumer.eachMapping(function (mapping) {
2534 | var newMapping = {
2535 | generated: {
2536 | line: mapping.generatedLine,
2537 | column: mapping.generatedColumn
2538 | }
2539 | };
2540 |
2541 | if (mapping.source != null) {
2542 | newMapping.source = mapping.source;
2543 | if (sourceRoot != null) {
2544 | newMapping.source = util.relative(sourceRoot, newMapping.source);
2545 | }
2546 |
2547 | newMapping.original = {
2548 | line: mapping.originalLine,
2549 | column: mapping.originalColumn
2550 | };
2551 |
2552 | if (mapping.name != null) {
2553 | newMapping.name = mapping.name;
2554 | }
2555 | }
2556 |
2557 | generator.addMapping(newMapping);
2558 | });
2559 | aSourceMapConsumer.sources.forEach(function (sourceFile) {
2560 | var sourceRelative = sourceFile;
2561 | if (sourceRoot !== null) {
2562 | sourceRelative = util.relative(sourceRoot, sourceFile);
2563 | }
2564 |
2565 | if (!generator._sources.has(sourceRelative)) {
2566 | generator._sources.add(sourceRelative);
2567 | }
2568 |
2569 | var content = aSourceMapConsumer.sourceContentFor(sourceFile);
2570 | if (content != null) {
2571 | generator.setSourceContent(sourceFile, content);
2572 | }
2573 | });
2574 | return generator;
2575 | };
2576 |
2577 | /**
2578 | * Add a single mapping from original source line and column to the generated
2579 | * source's line and column for this source map being created. The mapping
2580 | * object should have the following properties:
2581 | *
2582 | * - generated: An object with the generated line and column positions.
2583 | * - original: An object with the original line and column positions.
2584 | * - source: The original source file (relative to the sourceRoot).
2585 | * - name: An optional original token name for this mapping.
2586 | */
2587 | SourceMapGenerator.prototype.addMapping =
2588 | function SourceMapGenerator_addMapping(aArgs) {
2589 | var generated = util.getArg(aArgs, 'generated');
2590 | var original = util.getArg(aArgs, 'original', null);
2591 | var source = util.getArg(aArgs, 'source', null);
2592 | var name = util.getArg(aArgs, 'name', null);
2593 |
2594 | if (!this._skipValidation) {
2595 | this._validateMapping(generated, original, source, name);
2596 | }
2597 |
2598 | if (source != null) {
2599 | source = String(source);
2600 | if (!this._sources.has(source)) {
2601 | this._sources.add(source);
2602 | }
2603 | }
2604 |
2605 | if (name != null) {
2606 | name = String(name);
2607 | if (!this._names.has(name)) {
2608 | this._names.add(name);
2609 | }
2610 | }
2611 |
2612 | this._mappings.add({
2613 | generatedLine: generated.line,
2614 | generatedColumn: generated.column,
2615 | originalLine: original != null && original.line,
2616 | originalColumn: original != null && original.column,
2617 | source: source,
2618 | name: name
2619 | });
2620 | };
2621 |
2622 | /**
2623 | * Set the source content for a source file.
2624 | */
2625 | SourceMapGenerator.prototype.setSourceContent =
2626 | function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
2627 | var source = aSourceFile;
2628 | if (this._sourceRoot != null) {
2629 | source = util.relative(this._sourceRoot, source);
2630 | }
2631 |
2632 | if (aSourceContent != null) {
2633 | // Add the source content to the _sourcesContents map.
2634 | // Create a new _sourcesContents map if the property is null.
2635 | if (!this._sourcesContents) {
2636 | this._sourcesContents = Object.create(null);
2637 | }
2638 | this._sourcesContents[util.toSetString(source)] = aSourceContent;
2639 | } else if (this._sourcesContents) {
2640 | // Remove the source file from the _sourcesContents map.
2641 | // If the _sourcesContents map is empty, set the property to null.
2642 | delete this._sourcesContents[util.toSetString(source)];
2643 | if (Object.keys(this._sourcesContents).length === 0) {
2644 | this._sourcesContents = null;
2645 | }
2646 | }
2647 | };
2648 |
2649 | /**
2650 | * Applies the mappings of a sub-source-map for a specific source file to the
2651 | * source map being generated. Each mapping to the supplied source file is
2652 | * rewritten using the supplied source map. Note: The resolution for the
2653 | * resulting mappings is the minimium of this map and the supplied map.
2654 | *
2655 | * @param aSourceMapConsumer The source map to be applied.
2656 | * @param aSourceFile Optional. The filename of the source file.
2657 | * If omitted, SourceMapConsumer's file property will be used.
2658 | * @param aSourceMapPath Optional. The dirname of the path to the source map
2659 | * to be applied. If relative, it is relative to the SourceMapConsumer.
2660 | * This parameter is needed when the two source maps aren't in the same
2661 | * directory, and the source map to be applied contains relative source
2662 | * paths. If so, those relative source paths need to be rewritten
2663 | * relative to the SourceMapGenerator.
2664 | */
2665 | SourceMapGenerator.prototype.applySourceMap =
2666 | function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
2667 | var sourceFile = aSourceFile;
2668 | // If aSourceFile is omitted, we will use the file property of the SourceMap
2669 | if (aSourceFile == null) {
2670 | if (aSourceMapConsumer.file == null) {
2671 | throw new Error(
2672 | 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
2673 | 'or the source map\'s "file" property. Both were omitted.'
2674 | );
2675 | }
2676 | sourceFile = aSourceMapConsumer.file;
2677 | }
2678 | var sourceRoot = this._sourceRoot;
2679 | // Make "sourceFile" relative if an absolute Url is passed.
2680 | if (sourceRoot != null) {
2681 | sourceFile = util.relative(sourceRoot, sourceFile);
2682 | }
2683 | // Applying the SourceMap can add and remove items from the sources and
2684 | // the names array.
2685 | var newSources = new ArraySet();
2686 | var newNames = new ArraySet();
2687 |
2688 | // Find mappings for the "sourceFile"
2689 | this._mappings.unsortedForEach(function (mapping) {
2690 | if (mapping.source === sourceFile && mapping.originalLine != null) {
2691 | // Check if it can be mapped by the source map, then update the mapping.
2692 | var original = aSourceMapConsumer.originalPositionFor({
2693 | line: mapping.originalLine,
2694 | column: mapping.originalColumn
2695 | });
2696 | if (original.source != null) {
2697 | // Copy mapping
2698 | mapping.source = original.source;
2699 | if (aSourceMapPath != null) {
2700 | mapping.source = util.join(aSourceMapPath, mapping.source)
2701 | }
2702 | if (sourceRoot != null) {
2703 | mapping.source = util.relative(sourceRoot, mapping.source);
2704 | }
2705 | mapping.originalLine = original.line;
2706 | mapping.originalColumn = original.column;
2707 | if (original.name != null) {
2708 | mapping.name = original.name;
2709 | }
2710 | }
2711 | }
2712 |
2713 | var source = mapping.source;
2714 | if (source != null && !newSources.has(source)) {
2715 | newSources.add(source);
2716 | }
2717 |
2718 | var name = mapping.name;
2719 | if (name != null && !newNames.has(name)) {
2720 | newNames.add(name);
2721 | }
2722 |
2723 | }, this);
2724 | this._sources = newSources;
2725 | this._names = newNames;
2726 |
2727 | // Copy sourcesContents of applied map.
2728 | aSourceMapConsumer.sources.forEach(function (sourceFile) {
2729 | var content = aSourceMapConsumer.sourceContentFor(sourceFile);
2730 | if (content != null) {
2731 | if (aSourceMapPath != null) {
2732 | sourceFile = util.join(aSourceMapPath, sourceFile);
2733 | }
2734 | if (sourceRoot != null) {
2735 | sourceFile = util.relative(sourceRoot, sourceFile);
2736 | }
2737 | this.setSourceContent(sourceFile, content);
2738 | }
2739 | }, this);
2740 | };
2741 |
2742 | /**
2743 | * A mapping can have one of the three levels of data:
2744 | *
2745 | * 1. Just the generated position.
2746 | * 2. The Generated position, original position, and original source.
2747 | * 3. Generated and original position, original source, as well as a name
2748 | * token.
2749 | *
2750 | * To maintain consistency, we validate that any new mapping being added falls
2751 | * in to one of these categories.
2752 | */
2753 | SourceMapGenerator.prototype._validateMapping =
2754 | function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
2755 | aName) {
2756 | // When aOriginal is truthy but has empty values for .line and .column,
2757 | // it is most likely a programmer error. In this case we throw a very
2758 | // specific error message to try to guide them the right way.
2759 | // For example: https://github.com/Polymer/polymer-bundler/pull/519
2760 | if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
2761 | throw new Error(
2762 | 'original.line and original.column are not numbers -- you probably meant to omit ' +
2763 | 'the original mapping entirely and only map the generated position. If so, pass ' +
2764 | 'null for the original mapping instead of an object with empty or null values.'
2765 | );
2766 | }
2767 |
2768 | if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
2769 | && aGenerated.line > 0 && aGenerated.column >= 0
2770 | && !aOriginal && !aSource && !aName) {
2771 | // Case 1.
2772 | return;
2773 | }
2774 | else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
2775 | && aOriginal && 'line' in aOriginal && 'column' in aOriginal
2776 | && aGenerated.line > 0 && aGenerated.column >= 0
2777 | && aOriginal.line > 0 && aOriginal.column >= 0
2778 | && aSource) {
2779 | // Cases 2 and 3.
2780 | return;
2781 | }
2782 | else {
2783 | throw new Error('Invalid mapping: ' + JSON.stringify({
2784 | generated: aGenerated,
2785 | source: aSource,
2786 | original: aOriginal,
2787 | name: aName
2788 | }));
2789 | }
2790 | };
2791 |
2792 | /**
2793 | * Serialize the accumulated mappings in to the stream of base 64 VLQs
2794 | * specified by the source map format.
2795 | */
2796 | SourceMapGenerator.prototype._serializeMappings =
2797 | function SourceMapGenerator_serializeMappings() {
2798 | var previousGeneratedColumn = 0;
2799 | var previousGeneratedLine = 1;
2800 | var previousOriginalColumn = 0;
2801 | var previousOriginalLine = 0;
2802 | var previousName = 0;
2803 | var previousSource = 0;
2804 | var result = '';
2805 | var next;
2806 | var mapping;
2807 | var nameIdx;
2808 | var sourceIdx;
2809 |
2810 | var mappings = this._mappings.toArray();
2811 | for (var i = 0, len = mappings.length; i < len; i++) {
2812 | mapping = mappings[i];
2813 | next = ''
2814 |
2815 | if (mapping.generatedLine !== previousGeneratedLine) {
2816 | previousGeneratedColumn = 0;
2817 | while (mapping.generatedLine !== previousGeneratedLine) {
2818 | next += ';';
2819 | previousGeneratedLine++;
2820 | }
2821 | }
2822 | else {
2823 | if (i > 0) {
2824 | if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
2825 | continue;
2826 | }
2827 | next += ',';
2828 | }
2829 | }
2830 |
2831 | next += base64VLQ.encode(mapping.generatedColumn
2832 | - previousGeneratedColumn);
2833 | previousGeneratedColumn = mapping.generatedColumn;
2834 |
2835 | if (mapping.source != null) {
2836 | sourceIdx = this._sources.indexOf(mapping.source);
2837 | next += base64VLQ.encode(sourceIdx - previousSource);
2838 | previousSource = sourceIdx;
2839 |
2840 | // lines are stored 0-based in SourceMap spec version 3
2841 | next += base64VLQ.encode(mapping.originalLine - 1
2842 | - previousOriginalLine);
2843 | previousOriginalLine = mapping.originalLine - 1;
2844 |
2845 | next += base64VLQ.encode(mapping.originalColumn
2846 | - previousOriginalColumn);
2847 | previousOriginalColumn = mapping.originalColumn;
2848 |
2849 | if (mapping.name != null) {
2850 | nameIdx = this._names.indexOf(mapping.name);
2851 | next += base64VLQ.encode(nameIdx - previousName);
2852 | previousName = nameIdx;
2853 | }
2854 | }
2855 |
2856 | result += next;
2857 | }
2858 |
2859 | return result;
2860 | };
2861 |
2862 | SourceMapGenerator.prototype._generateSourcesContent =
2863 | function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
2864 | return aSources.map(function (source) {
2865 | if (!this._sourcesContents) {
2866 | return null;
2867 | }
2868 | if (aSourceRoot != null) {
2869 | source = util.relative(aSourceRoot, source);
2870 | }
2871 | var key = util.toSetString(source);
2872 | return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
2873 | ? this._sourcesContents[key]
2874 | : null;
2875 | }, this);
2876 | };
2877 |
2878 | /**
2879 | * Externalize the source map.
2880 | */
2881 | SourceMapGenerator.prototype.toJSON =
2882 | function SourceMapGenerator_toJSON() {
2883 | var map = {
2884 | version: this._version,
2885 | sources: this._sources.toArray(),
2886 | names: this._names.toArray(),
2887 | mappings: this._serializeMappings()
2888 | };
2889 | if (this._file != null) {
2890 | map.file = this._file;
2891 | }
2892 | if (this._sourceRoot != null) {
2893 | map.sourceRoot = this._sourceRoot;
2894 | }
2895 | if (this._sourcesContents) {
2896 | map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
2897 | }
2898 |
2899 | return map;
2900 | };
2901 |
2902 | /**
2903 | * Render the source map being generated to a string.
2904 | */
2905 | SourceMapGenerator.prototype.toString =
2906 | function SourceMapGenerator_toString() {
2907 | return JSON.stringify(this.toJSON());
2908 | };
2909 |
2910 | exports.h = SourceMapGenerator;
2911 |
2912 |
2913 | /***/ }),
2914 |
2915 | /***/ 990:
2916 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2917 |
2918 | var __webpack_unused_export__;
2919 | /* -*- Mode: js; js-indent-level: 2; -*- */
2920 | /*
2921 | * Copyright 2011 Mozilla Foundation and contributors
2922 | * Licensed under the New BSD license. See LICENSE or:
2923 | * http://opensource.org/licenses/BSD-3-Clause
2924 | */
2925 |
2926 | var SourceMapGenerator = __webpack_require__(341)/* .SourceMapGenerator */ .h;
2927 | var util = __webpack_require__(983);
2928 |
2929 | // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
2930 | // operating systems these days (capturing the result).
2931 | var REGEX_NEWLINE = /(\r?\n)/;
2932 |
2933 | // Newline character code for charCodeAt() comparisons
2934 | var NEWLINE_CODE = 10;
2935 |
2936 | // Private symbol for identifying `SourceNode`s when multiple versions of
2937 | // the source-map library are loaded. This MUST NOT CHANGE across
2938 | // versions!
2939 | var isSourceNode = "$$$isSourceNode$$$";
2940 |
2941 | /**
2942 | * SourceNodes provide a way to abstract over interpolating/concatenating
2943 | * snippets of generated JavaScript source code while maintaining the line and
2944 | * column information associated with the original source code.
2945 | *
2946 | * @param aLine The original line number.
2947 | * @param aColumn The original column number.
2948 | * @param aSource The original source's filename.
2949 | * @param aChunks Optional. An array of strings which are snippets of
2950 | * generated JS, or other SourceNodes.
2951 | * @param aName The original identifier.
2952 | */
2953 | function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
2954 | this.children = [];
2955 | this.sourceContents = {};
2956 | this.line = aLine == null ? null : aLine;
2957 | this.column = aColumn == null ? null : aColumn;
2958 | this.source = aSource == null ? null : aSource;
2959 | this.name = aName == null ? null : aName;
2960 | this[isSourceNode] = true;
2961 | if (aChunks != null) this.add(aChunks);
2962 | }
2963 |
2964 | /**
2965 | * Creates a SourceNode from generated code and a SourceMapConsumer.
2966 | *
2967 | * @param aGeneratedCode The generated code
2968 | * @param aSourceMapConsumer The SourceMap for the generated code
2969 | * @param aRelativePath Optional. The path that relative sources in the
2970 | * SourceMapConsumer should be relative to.
2971 | */
2972 | SourceNode.fromStringWithSourceMap =
2973 | function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
2974 | // The SourceNode we want to fill with the generated code
2975 | // and the SourceMap
2976 | var node = new SourceNode();
2977 |
2978 | // All even indices of this array are one line of the generated code,
2979 | // while all odd indices are the newlines between two adjacent lines
2980 | // (since `REGEX_NEWLINE` captures its match).
2981 | // Processed fragments are accessed by calling `shiftNextLine`.
2982 | var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
2983 | var remainingLinesIndex = 0;
2984 | var shiftNextLine = function() {
2985 | var lineContents = getNextLine();
2986 | // The last line of a file might not have a newline.
2987 | var newLine = getNextLine() || "";
2988 | return lineContents + newLine;
2989 |
2990 | function getNextLine() {
2991 | return remainingLinesIndex < remainingLines.length ?
2992 | remainingLines[remainingLinesIndex++] : undefined;
2993 | }
2994 | };
2995 |
2996 | // We need to remember the position of "remainingLines"
2997 | var lastGeneratedLine = 1, lastGeneratedColumn = 0;
2998 |
2999 | // The generate SourceNodes we need a code range.
3000 | // To extract it current and last mapping is used.
3001 | // Here we store the last mapping.
3002 | var lastMapping = null;
3003 |
3004 | aSourceMapConsumer.eachMapping(function (mapping) {
3005 | if (lastMapping !== null) {
3006 | // We add the code from "lastMapping" to "mapping":
3007 | // First check if there is a new line in between.
3008 | if (lastGeneratedLine < mapping.generatedLine) {
3009 | // Associate first line with "lastMapping"
3010 | addMappingWithCode(lastMapping, shiftNextLine());
3011 | lastGeneratedLine++;
3012 | lastGeneratedColumn = 0;
3013 | // The remaining code is added without mapping
3014 | } else {
3015 | // There is no new line in between.
3016 | // Associate the code between "lastGeneratedColumn" and
3017 | // "mapping.generatedColumn" with "lastMapping"
3018 | var nextLine = remainingLines[remainingLinesIndex] || '';
3019 | var code = nextLine.substr(0, mapping.generatedColumn -
3020 | lastGeneratedColumn);
3021 | remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
3022 | lastGeneratedColumn);
3023 | lastGeneratedColumn = mapping.generatedColumn;
3024 | addMappingWithCode(lastMapping, code);
3025 | // No more remaining code, continue
3026 | lastMapping = mapping;
3027 | return;
3028 | }
3029 | }
3030 | // We add the generated code until the first mapping
3031 | // to the SourceNode without any mapping.
3032 | // Each line is added as separate string.
3033 | while (lastGeneratedLine < mapping.generatedLine) {
3034 | node.add(shiftNextLine());
3035 | lastGeneratedLine++;
3036 | }
3037 | if (lastGeneratedColumn < mapping.generatedColumn) {
3038 | var nextLine = remainingLines[remainingLinesIndex] || '';
3039 | node.add(nextLine.substr(0, mapping.generatedColumn));
3040 | remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
3041 | lastGeneratedColumn = mapping.generatedColumn;
3042 | }
3043 | lastMapping = mapping;
3044 | }, this);
3045 | // We have processed all mappings.
3046 | if (remainingLinesIndex < remainingLines.length) {
3047 | if (lastMapping) {
3048 | // Associate the remaining code in the current line with "lastMapping"
3049 | addMappingWithCode(lastMapping, shiftNextLine());
3050 | }
3051 | // and add the remaining lines without any mapping
3052 | node.add(remainingLines.splice(remainingLinesIndex).join(""));
3053 | }
3054 |
3055 | // Copy sourcesContent into SourceNode
3056 | aSourceMapConsumer.sources.forEach(function (sourceFile) {
3057 | var content = aSourceMapConsumer.sourceContentFor(sourceFile);
3058 | if (content != null) {
3059 | if (aRelativePath != null) {
3060 | sourceFile = util.join(aRelativePath, sourceFile);
3061 | }
3062 | node.setSourceContent(sourceFile, content);
3063 | }
3064 | });
3065 |
3066 | return node;
3067 |
3068 | function addMappingWithCode(mapping, code) {
3069 | if (mapping === null || mapping.source === undefined) {
3070 | node.add(code);
3071 | } else {
3072 | var source = aRelativePath
3073 | ? util.join(aRelativePath, mapping.source)
3074 | : mapping.source;
3075 | node.add(new SourceNode(mapping.originalLine,
3076 | mapping.originalColumn,
3077 | source,
3078 | code,
3079 | mapping.name));
3080 | }
3081 | }
3082 | };
3083 |
3084 | /**
3085 | * Add a chunk of generated JS to this source node.
3086 | *
3087 | * @param aChunk A string snippet of generated JS code, another instance of
3088 | * SourceNode, or an array where each member is one of those things.
3089 | */
3090 | SourceNode.prototype.add = function SourceNode_add(aChunk) {
3091 | if (Array.isArray(aChunk)) {
3092 | aChunk.forEach(function (chunk) {
3093 | this.add(chunk);
3094 | }, this);
3095 | }
3096 | else if (aChunk[isSourceNode] || typeof aChunk === "string") {
3097 | if (aChunk) {
3098 | this.children.push(aChunk);
3099 | }
3100 | }
3101 | else {
3102 | throw new TypeError(
3103 | "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
3104 | );
3105 | }
3106 | return this;
3107 | };
3108 |
3109 | /**
3110 | * Add a chunk of generated JS to the beginning of this source node.
3111 | *
3112 | * @param aChunk A string snippet of generated JS code, another instance of
3113 | * SourceNode, or an array where each member is one of those things.
3114 | */
3115 | SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
3116 | if (Array.isArray(aChunk)) {
3117 | for (var i = aChunk.length-1; i >= 0; i--) {
3118 | this.prepend(aChunk[i]);
3119 | }
3120 | }
3121 | else if (aChunk[isSourceNode] || typeof aChunk === "string") {
3122 | this.children.unshift(aChunk);
3123 | }
3124 | else {
3125 | throw new TypeError(
3126 | "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
3127 | );
3128 | }
3129 | return this;
3130 | };
3131 |
3132 | /**
3133 | * Walk over the tree of JS snippets in this node and its children. The
3134 | * walking function is called once for each snippet of JS and is passed that
3135 | * snippet and the its original associated source's line/column location.
3136 | *
3137 | * @param aFn The traversal function.
3138 | */
3139 | SourceNode.prototype.walk = function SourceNode_walk(aFn) {
3140 | var chunk;
3141 | for (var i = 0, len = this.children.length; i < len; i++) {
3142 | chunk = this.children[i];
3143 | if (chunk[isSourceNode]) {
3144 | chunk.walk(aFn);
3145 | }
3146 | else {
3147 | if (chunk !== '') {
3148 | aFn(chunk, { source: this.source,
3149 | line: this.line,
3150 | column: this.column,
3151 | name: this.name });
3152 | }
3153 | }
3154 | }
3155 | };
3156 |
3157 | /**
3158 | * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
3159 | * each of `this.children`.
3160 | *
3161 | * @param aSep The separator.
3162 | */
3163 | SourceNode.prototype.join = function SourceNode_join(aSep) {
3164 | var newChildren;
3165 | var i;
3166 | var len = this.children.length;
3167 | if (len > 0) {
3168 | newChildren = [];
3169 | for (i = 0; i < len-1; i++) {
3170 | newChildren.push(this.children[i]);
3171 | newChildren.push(aSep);
3172 | }
3173 | newChildren.push(this.children[i]);
3174 | this.children = newChildren;
3175 | }
3176 | return this;
3177 | };
3178 |
3179 | /**
3180 | * Call String.prototype.replace on the very right-most source snippet. Useful
3181 | * for trimming whitespace from the end of a source node, etc.
3182 | *
3183 | * @param aPattern The pattern to replace.
3184 | * @param aReplacement The thing to replace the pattern with.
3185 | */
3186 | SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
3187 | var lastChild = this.children[this.children.length - 1];
3188 | if (lastChild[isSourceNode]) {
3189 | lastChild.replaceRight(aPattern, aReplacement);
3190 | }
3191 | else if (typeof lastChild === 'string') {
3192 | this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
3193 | }
3194 | else {
3195 | this.children.push(''.replace(aPattern, aReplacement));
3196 | }
3197 | return this;
3198 | };
3199 |
3200 | /**
3201 | * Set the source content for a source file. This will be added to the SourceMapGenerator
3202 | * in the sourcesContent field.
3203 | *
3204 | * @param aSourceFile The filename of the source file
3205 | * @param aSourceContent The content of the source file
3206 | */
3207 | SourceNode.prototype.setSourceContent =
3208 | function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
3209 | this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
3210 | };
3211 |
3212 | /**
3213 | * Walk over the tree of SourceNodes. The walking function is called for each
3214 | * source file content and is passed the filename and source content.
3215 | *
3216 | * @param aFn The traversal function.
3217 | */
3218 | SourceNode.prototype.walkSourceContents =
3219 | function SourceNode_walkSourceContents(aFn) {
3220 | for (var i = 0, len = this.children.length; i < len; i++) {
3221 | if (this.children[i][isSourceNode]) {
3222 | this.children[i].walkSourceContents(aFn);
3223 | }
3224 | }
3225 |
3226 | var sources = Object.keys(this.sourceContents);
3227 | for (var i = 0, len = sources.length; i < len; i++) {
3228 | aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
3229 | }
3230 | };
3231 |
3232 | /**
3233 | * Return the string representation of this source node. Walks over the tree
3234 | * and concatenates all the various snippets together to one string.
3235 | */
3236 | SourceNode.prototype.toString = function SourceNode_toString() {
3237 | var str = "";
3238 | this.walk(function (chunk) {
3239 | str += chunk;
3240 | });
3241 | return str;
3242 | };
3243 |
3244 | /**
3245 | * Returns the string representation of this source node along with a source
3246 | * map.
3247 | */
3248 | SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
3249 | var generated = {
3250 | code: "",
3251 | line: 1,
3252 | column: 0
3253 | };
3254 | var map = new SourceMapGenerator(aArgs);
3255 | var sourceMappingActive = false;
3256 | var lastOriginalSource = null;
3257 | var lastOriginalLine = null;
3258 | var lastOriginalColumn = null;
3259 | var lastOriginalName = null;
3260 | this.walk(function (chunk, original) {
3261 | generated.code += chunk;
3262 | if (original.source !== null
3263 | && original.line !== null
3264 | && original.column !== null) {
3265 | if(lastOriginalSource !== original.source
3266 | || lastOriginalLine !== original.line
3267 | || lastOriginalColumn !== original.column
3268 | || lastOriginalName !== original.name) {
3269 | map.addMapping({
3270 | source: original.source,
3271 | original: {
3272 | line: original.line,
3273 | column: original.column
3274 | },
3275 | generated: {
3276 | line: generated.line,
3277 | column: generated.column
3278 | },
3279 | name: original.name
3280 | });
3281 | }
3282 | lastOriginalSource = original.source;
3283 | lastOriginalLine = original.line;
3284 | lastOriginalColumn = original.column;
3285 | lastOriginalName = original.name;
3286 | sourceMappingActive = true;
3287 | } else if (sourceMappingActive) {
3288 | map.addMapping({
3289 | generated: {
3290 | line: generated.line,
3291 | column: generated.column
3292 | }
3293 | });
3294 | lastOriginalSource = null;
3295 | sourceMappingActive = false;
3296 | }
3297 | for (var idx = 0, length = chunk.length; idx < length; idx++) {
3298 | if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
3299 | generated.line++;
3300 | generated.column = 0;
3301 | // Mappings end at eol
3302 | if (idx + 1 === length) {
3303 | lastOriginalSource = null;
3304 | sourceMappingActive = false;
3305 | } else if (sourceMappingActive) {
3306 | map.addMapping({
3307 | source: original.source,
3308 | original: {
3309 | line: original.line,
3310 | column: original.column
3311 | },
3312 | generated: {
3313 | line: generated.line,
3314 | column: generated.column
3315 | },
3316 | name: original.name
3317 | });
3318 | }
3319 | } else {
3320 | generated.column++;
3321 | }
3322 | }
3323 | });
3324 | this.walkSourceContents(function (sourceFile, sourceContent) {
3325 | map.setSourceContent(sourceFile, sourceContent);
3326 | });
3327 |
3328 | return { code: generated.code, map: map };
3329 | };
3330 |
3331 | __webpack_unused_export__ = SourceNode;
3332 |
3333 |
3334 | /***/ }),
3335 |
3336 | /***/ 983:
3337 | /***/ ((__unused_webpack_module, exports) => {
3338 |
3339 | /* -*- Mode: js; js-indent-level: 2; -*- */
3340 | /*
3341 | * Copyright 2011 Mozilla Foundation and contributors
3342 | * Licensed under the New BSD license. See LICENSE or:
3343 | * http://opensource.org/licenses/BSD-3-Clause
3344 | */
3345 |
3346 | /**
3347 | * This is a helper function for getting values from parameter/options
3348 | * objects.
3349 | *
3350 | * @param args The object we are extracting values from
3351 | * @param name The name of the property we are getting.
3352 | * @param defaultValue An optional value to return if the property is missing
3353 | * from the object. If this is not specified and the property is missing, an
3354 | * error will be thrown.
3355 | */
3356 | function getArg(aArgs, aName, aDefaultValue) {
3357 | if (aName in aArgs) {
3358 | return aArgs[aName];
3359 | } else if (arguments.length === 3) {
3360 | return aDefaultValue;
3361 | } else {
3362 | throw new Error('"' + aName + '" is a required argument.');
3363 | }
3364 | }
3365 | exports.getArg = getArg;
3366 |
3367 | var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
3368 | var dataUrlRegexp = /^data:.+\,.+$/;
3369 |
3370 | function urlParse(aUrl) {
3371 | var match = aUrl.match(urlRegexp);
3372 | if (!match) {
3373 | return null;
3374 | }
3375 | return {
3376 | scheme: match[1],
3377 | auth: match[2],
3378 | host: match[3],
3379 | port: match[4],
3380 | path: match[5]
3381 | };
3382 | }
3383 | exports.urlParse = urlParse;
3384 |
3385 | function urlGenerate(aParsedUrl) {
3386 | var url = '';
3387 | if (aParsedUrl.scheme) {
3388 | url += aParsedUrl.scheme + ':';
3389 | }
3390 | url += '//';
3391 | if (aParsedUrl.auth) {
3392 | url += aParsedUrl.auth + '@';
3393 | }
3394 | if (aParsedUrl.host) {
3395 | url += aParsedUrl.host;
3396 | }
3397 | if (aParsedUrl.port) {
3398 | url += ":" + aParsedUrl.port
3399 | }
3400 | if (aParsedUrl.path) {
3401 | url += aParsedUrl.path;
3402 | }
3403 | return url;
3404 | }
3405 | exports.urlGenerate = urlGenerate;
3406 |
3407 | /**
3408 | * Normalizes a path, or the path portion of a URL:
3409 | *
3410 | * - Replaces consecutive slashes with one slash.
3411 | * - Removes unnecessary '.' parts.
3412 | * - Removes unnecessary '/..' parts.
3413 | *
3414 | * Based on code in the Node.js 'path' core module.
3415 | *
3416 | * @param aPath The path or url to normalize.
3417 | */
3418 | function normalize(aPath) {
3419 | var path = aPath;
3420 | var url = urlParse(aPath);
3421 | if (url) {
3422 | if (!url.path) {
3423 | return aPath;
3424 | }
3425 | path = url.path;
3426 | }
3427 | var isAbsolute = exports.isAbsolute(path);
3428 |
3429 | var parts = path.split(/\/+/);
3430 | for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
3431 | part = parts[i];
3432 | if (part === '.') {
3433 | parts.splice(i, 1);
3434 | } else if (part === '..') {
3435 | up++;
3436 | } else if (up > 0) {
3437 | if (part === '') {
3438 | // The first part is blank if the path is absolute. Trying to go
3439 | // above the root is a no-op. Therefore we can remove all '..' parts
3440 | // directly after the root.
3441 | parts.splice(i + 1, up);
3442 | up = 0;
3443 | } else {
3444 | parts.splice(i, 2);
3445 | up--;
3446 | }
3447 | }
3448 | }
3449 | path = parts.join('/');
3450 |
3451 | if (path === '') {
3452 | path = isAbsolute ? '/' : '.';
3453 | }
3454 |
3455 | if (url) {
3456 | url.path = path;
3457 | return urlGenerate(url);
3458 | }
3459 | return path;
3460 | }
3461 | exports.normalize = normalize;
3462 |
3463 | /**
3464 | * Joins two paths/URLs.
3465 | *
3466 | * @param aRoot The root path or URL.
3467 | * @param aPath The path or URL to be joined with the root.
3468 | *
3469 | * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
3470 | * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
3471 | * first.
3472 | * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
3473 | * is updated with the result and aRoot is returned. Otherwise the result
3474 | * is returned.
3475 | * - If aPath is absolute, the result is aPath.
3476 | * - Otherwise the two paths are joined with a slash.
3477 | * - Joining for example 'http://' and 'www.example.com' is also supported.
3478 | */
3479 | function join(aRoot, aPath) {
3480 | if (aRoot === "") {
3481 | aRoot = ".";
3482 | }
3483 | if (aPath === "") {
3484 | aPath = ".";
3485 | }
3486 | var aPathUrl = urlParse(aPath);
3487 | var aRootUrl = urlParse(aRoot);
3488 | if (aRootUrl) {
3489 | aRoot = aRootUrl.path || '/';
3490 | }
3491 |
3492 | // `join(foo, '//www.example.org')`
3493 | if (aPathUrl && !aPathUrl.scheme) {
3494 | if (aRootUrl) {
3495 | aPathUrl.scheme = aRootUrl.scheme;
3496 | }
3497 | return urlGenerate(aPathUrl);
3498 | }
3499 |
3500 | if (aPathUrl || aPath.match(dataUrlRegexp)) {
3501 | return aPath;
3502 | }
3503 |
3504 | // `join('http://', 'www.example.com')`
3505 | if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
3506 | aRootUrl.host = aPath;
3507 | return urlGenerate(aRootUrl);
3508 | }
3509 |
3510 | var joined = aPath.charAt(0) === '/'
3511 | ? aPath
3512 | : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
3513 |
3514 | if (aRootUrl) {
3515 | aRootUrl.path = joined;
3516 | return urlGenerate(aRootUrl);
3517 | }
3518 | return joined;
3519 | }
3520 | exports.join = join;
3521 |
3522 | exports.isAbsolute = function (aPath) {
3523 | return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
3524 | };
3525 |
3526 | /**
3527 | * Make a path relative to a URL or another path.
3528 | *
3529 | * @param aRoot The root path or URL.
3530 | * @param aPath The path or URL to be made relative to aRoot.
3531 | */
3532 | function relative(aRoot, aPath) {
3533 | if (aRoot === "") {
3534 | aRoot = ".";
3535 | }
3536 |
3537 | aRoot = aRoot.replace(/\/$/, '');
3538 |
3539 | // It is possible for the path to be above the root. In this case, simply
3540 | // checking whether the root is a prefix of the path won't work. Instead, we
3541 | // need to remove components from the root one by one, until either we find
3542 | // a prefix that fits, or we run out of components to remove.
3543 | var level = 0;
3544 | while (aPath.indexOf(aRoot + '/') !== 0) {
3545 | var index = aRoot.lastIndexOf("/");
3546 | if (index < 0) {
3547 | return aPath;
3548 | }
3549 |
3550 | // If the only part of the root that is left is the scheme (i.e. http://,
3551 | // file:///, etc.), one or more slashes (/), or simply nothing at all, we
3552 | // have exhausted all components, so the path is not relative to the root.
3553 | aRoot = aRoot.slice(0, index);
3554 | if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
3555 | return aPath;
3556 | }
3557 |
3558 | ++level;
3559 | }
3560 |
3561 | // Make sure we add a "../" for each component we removed from the root.
3562 | return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
3563 | }
3564 | exports.relative = relative;
3565 |
3566 | var supportsNullProto = (function () {
3567 | var obj = Object.create(null);
3568 | return !('__proto__' in obj);
3569 | }());
3570 |
3571 | function identity (s) {
3572 | return s;
3573 | }
3574 |
3575 | /**
3576 | * Because behavior goes wacky when you set `__proto__` on objects, we
3577 | * have to prefix all the strings in our set with an arbitrary character.
3578 | *
3579 | * See https://github.com/mozilla/source-map/pull/31 and
3580 | * https://github.com/mozilla/source-map/issues/30
3581 | *
3582 | * @param String aStr
3583 | */
3584 | function toSetString(aStr) {
3585 | if (isProtoString(aStr)) {
3586 | return '$' + aStr;
3587 | }
3588 |
3589 | return aStr;
3590 | }
3591 | exports.toSetString = supportsNullProto ? identity : toSetString;
3592 |
3593 | function fromSetString(aStr) {
3594 | if (isProtoString(aStr)) {
3595 | return aStr.slice(1);
3596 | }
3597 |
3598 | return aStr;
3599 | }
3600 | exports.fromSetString = supportsNullProto ? identity : fromSetString;
3601 |
3602 | function isProtoString(s) {
3603 | if (!s) {
3604 | return false;
3605 | }
3606 |
3607 | var length = s.length;
3608 |
3609 | if (length < 9 /* "__proto__".length */) {
3610 | return false;
3611 | }
3612 |
3613 | if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
3614 | s.charCodeAt(length - 2) !== 95 /* '_' */ ||
3615 | s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
3616 | s.charCodeAt(length - 4) !== 116 /* 't' */ ||
3617 | s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
3618 | s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
3619 | s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
3620 | s.charCodeAt(length - 8) !== 95 /* '_' */ ||
3621 | s.charCodeAt(length - 9) !== 95 /* '_' */) {
3622 | return false;
3623 | }
3624 |
3625 | for (var i = length - 10; i >= 0; i--) {
3626 | if (s.charCodeAt(i) !== 36 /* '$' */) {
3627 | return false;
3628 | }
3629 | }
3630 |
3631 | return true;
3632 | }
3633 |
3634 | /**
3635 | * Comparator between two mappings where the original positions are compared.
3636 | *
3637 | * Optionally pass in `true` as `onlyCompareGenerated` to consider two
3638 | * mappings with the same original source/line/column, but different generated
3639 | * line and column the same. Useful when searching for a mapping with a
3640 | * stubbed out mapping.
3641 | */
3642 | function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
3643 | var cmp = strcmp(mappingA.source, mappingB.source);
3644 | if (cmp !== 0) {
3645 | return cmp;
3646 | }
3647 |
3648 | cmp = mappingA.originalLine - mappingB.originalLine;
3649 | if (cmp !== 0) {
3650 | return cmp;
3651 | }
3652 |
3653 | cmp = mappingA.originalColumn - mappingB.originalColumn;
3654 | if (cmp !== 0 || onlyCompareOriginal) {
3655 | return cmp;
3656 | }
3657 |
3658 | cmp = mappingA.generatedColumn - mappingB.generatedColumn;
3659 | if (cmp !== 0) {
3660 | return cmp;
3661 | }
3662 |
3663 | cmp = mappingA.generatedLine - mappingB.generatedLine;
3664 | if (cmp !== 0) {
3665 | return cmp;
3666 | }
3667 |
3668 | return strcmp(mappingA.name, mappingB.name);
3669 | }
3670 | exports.compareByOriginalPositions = compareByOriginalPositions;
3671 |
3672 | /**
3673 | * Comparator between two mappings with deflated source and name indices where
3674 | * the generated positions are compared.
3675 | *
3676 | * Optionally pass in `true` as `onlyCompareGenerated` to consider two
3677 | * mappings with the same generated line and column, but different
3678 | * source/name/original line and column the same. Useful when searching for a
3679 | * mapping with a stubbed out mapping.
3680 | */
3681 | function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
3682 | var cmp = mappingA.generatedLine - mappingB.generatedLine;
3683 | if (cmp !== 0) {
3684 | return cmp;
3685 | }
3686 |
3687 | cmp = mappingA.generatedColumn - mappingB.generatedColumn;
3688 | if (cmp !== 0 || onlyCompareGenerated) {
3689 | return cmp;
3690 | }
3691 |
3692 | cmp = strcmp(mappingA.source, mappingB.source);
3693 | if (cmp !== 0) {
3694 | return cmp;
3695 | }
3696 |
3697 | cmp = mappingA.originalLine - mappingB.originalLine;
3698 | if (cmp !== 0) {
3699 | return cmp;
3700 | }
3701 |
3702 | cmp = mappingA.originalColumn - mappingB.originalColumn;
3703 | if (cmp !== 0) {
3704 | return cmp;
3705 | }
3706 |
3707 | return strcmp(mappingA.name, mappingB.name);
3708 | }
3709 | exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
3710 |
3711 | function strcmp(aStr1, aStr2) {
3712 | if (aStr1 === aStr2) {
3713 | return 0;
3714 | }
3715 |
3716 | if (aStr1 === null) {
3717 | return 1; // aStr2 !== null
3718 | }
3719 |
3720 | if (aStr2 === null) {
3721 | return -1; // aStr1 !== null
3722 | }
3723 |
3724 | if (aStr1 > aStr2) {
3725 | return 1;
3726 | }
3727 |
3728 | return -1;
3729 | }
3730 |
3731 | /**
3732 | * Comparator between two mappings with inflated source and name strings where
3733 | * the generated positions are compared.
3734 | */
3735 | function compareByGeneratedPositionsInflated(mappingA, mappingB) {
3736 | var cmp = mappingA.generatedLine - mappingB.generatedLine;
3737 | if (cmp !== 0) {
3738 | return cmp;
3739 | }
3740 |
3741 | cmp = mappingA.generatedColumn - mappingB.generatedColumn;
3742 | if (cmp !== 0) {
3743 | return cmp;
3744 | }
3745 |
3746 | cmp = strcmp(mappingA.source, mappingB.source);
3747 | if (cmp !== 0) {
3748 | return cmp;
3749 | }
3750 |
3751 | cmp = mappingA.originalLine - mappingB.originalLine;
3752 | if (cmp !== 0) {
3753 | return cmp;
3754 | }
3755 |
3756 | cmp = mappingA.originalColumn - mappingB.originalColumn;
3757 | if (cmp !== 0) {
3758 | return cmp;
3759 | }
3760 |
3761 | return strcmp(mappingA.name, mappingB.name);
3762 | }
3763 | exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
3764 |
3765 | /**
3766 | * Strip any JSON XSSI avoidance prefix from the string (as documented
3767 | * in the source maps specification), and then parse the string as
3768 | * JSON.
3769 | */
3770 | function parseSourceMapInput(str) {
3771 | return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
3772 | }
3773 | exports.parseSourceMapInput = parseSourceMapInput;
3774 |
3775 | /**
3776 | * Compute the URL of a source given the the source root, the source's
3777 | * URL, and the source map's URL.
3778 | */
3779 | function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
3780 | sourceURL = sourceURL || '';
3781 |
3782 | if (sourceRoot) {
3783 | // This follows what Chrome does.
3784 | if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
3785 | sourceRoot += '/';
3786 | }
3787 | // The spec says:
3788 | // Line 4: An optional source root, useful for relocating source
3789 | // files on a server or removing repeated values in the
3790 | // “sources” entry. This value is prepended to the individual
3791 | // entries in the “source” field.
3792 | sourceURL = sourceRoot + sourceURL;
3793 | }
3794 |
3795 | // Historically, SourceMapConsumer did not take the sourceMapURL as
3796 | // a parameter. This mode is still somewhat supported, which is why
3797 | // this code block is conditional. However, it's preferable to pass
3798 | // the source map URL to SourceMapConsumer, so that this function
3799 | // can implement the source URL resolution algorithm as outlined in
3800 | // the spec. This block is basically the equivalent of:
3801 | // new URL(sourceURL, sourceMapURL).toString()
3802 | // ... except it avoids using URL, which wasn't available in the
3803 | // older releases of node still supported by this library.
3804 | //
3805 | // The spec says:
3806 | // If the sources are not absolute URLs after prepending of the
3807 | // “sourceRoot”, the sources are resolved relative to the
3808 | // SourceMap (like resolving script src in a html document).
3809 | if (sourceMapURL) {
3810 | var parsed = urlParse(sourceMapURL);
3811 | if (!parsed) {
3812 | throw new Error("sourceMapURL could not be parsed");
3813 | }
3814 | if (parsed.path) {
3815 | // Strip the last path component, but keep the "/".
3816 | var index = parsed.path.lastIndexOf('/');
3817 | if (index >= 0) {
3818 | parsed.path = parsed.path.substring(0, index + 1);
3819 | }
3820 | }
3821 | sourceURL = join(urlGenerate(parsed), sourceURL);
3822 | }
3823 |
3824 | return normalize(sourceURL);
3825 | }
3826 | exports.computeSourceURL = computeSourceURL;
3827 |
3828 |
3829 | /***/ }),
3830 |
3831 | /***/ 596:
3832 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3833 |
3834 | /*
3835 | * Copyright 2009-2011 Mozilla Foundation and contributors
3836 | * Licensed under the New BSD license. See LICENSE.txt or:
3837 | * http://opensource.org/licenses/BSD-3-Clause
3838 | */
3839 | /* unused reexport */ __webpack_require__(341)/* .SourceMapGenerator */ .h;
3840 | exports.SourceMapConsumer = __webpack_require__(327).SourceMapConsumer;
3841 | /* unused reexport */ __webpack_require__(990);
3842 |
3843 |
3844 | /***/ }),
3845 |
3846 | /***/ 747:
3847 | /***/ ((module) => {
3848 |
3849 | "use strict";
3850 | module.exports = require("fs");
3851 |
3852 | /***/ }),
3853 |
3854 | /***/ 282:
3855 | /***/ ((module) => {
3856 |
3857 | "use strict";
3858 | module.exports = require("module");
3859 |
3860 | /***/ }),
3861 |
3862 | /***/ 622:
3863 | /***/ ((module) => {
3864 |
3865 | "use strict";
3866 | module.exports = require("path");
3867 |
3868 | /***/ })
3869 |
3870 | /******/ });
3871 | /************************************************************************/
3872 | /******/ // The module cache
3873 | /******/ var __webpack_module_cache__ = {};
3874 | /******/
3875 | /******/ // The require function
3876 | /******/ function __webpack_require__(moduleId) {
3877 | /******/ // Check if module is in cache
3878 | /******/ if(__webpack_module_cache__[moduleId]) {
3879 | /******/ return __webpack_module_cache__[moduleId].exports;
3880 | /******/ }
3881 | /******/ // Create a new module (and put it into the cache)
3882 | /******/ var module = __webpack_module_cache__[moduleId] = {
3883 | /******/ // no module.id needed
3884 | /******/ // no module.loaded needed
3885 | /******/ exports: {}
3886 | /******/ };
3887 | /******/
3888 | /******/ // Execute the module function
3889 | /******/ var threw = true;
3890 | /******/ try {
3891 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
3892 | /******/ threw = false;
3893 | /******/ } finally {
3894 | /******/ if(threw) delete __webpack_module_cache__[moduleId];
3895 | /******/ }
3896 | /******/
3897 | /******/ // Return the exports of the module
3898 | /******/ return module.exports;
3899 | /******/ }
3900 | /******/
3901 | /************************************************************************/
3902 | /******/ /* webpack/runtime/compat */
3903 | /******/
3904 | /******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
3905 | /******/ // module exports must be returned from runtime so entry inlining is disabled
3906 | /******/ // startup
3907 | /******/ // Load entry module and return exports
3908 | /******/ return __webpack_require__(645);
3909 | /******/ })()
3910 | ;
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "action-setup-firebase",
3 | "version": "2",
4 | "description": "Setup firebase tools CLI",
5 | "main": "lib/main.js",
6 | "scripts": {
7 | "build": "tsc && yarn run package",
8 | "lint": "eslint . --ext ts,tsx",
9 | "lint:fix": "eslint . --ext ts,tsx --fix",
10 | "format": "prettier --check .",
11 | "format:fix": "prettier --write .",
12 | "package": "ncc build --source-map --license licenses.txt",
13 | "test": "jest"
14 | },
15 | "repository": {
16 | "type": "git",
17 | "url": "git+https://github.com/pocket-studios/action-setup-firebase.git"
18 | },
19 | "keywords": [
20 | "actions",
21 | "firebase",
22 | "setup",
23 | "cli",
24 | "tools"
25 | ],
26 | "author": "Victor Navarro ",
27 | "license": "MIT",
28 | "dependencies": {
29 | "@actions/core": "1.2.6",
30 | "command-exists": "^1.2.9"
31 | },
32 | "devDependencies": {
33 | "@pocket-studios/eslint-config": "2.1.3",
34 | "@pocket-studios/prettier-config": "1.0.0",
35 | "@types/command-exists": "1.2.0",
36 | "@types/jest": "26.0.13",
37 | "@types/node": "14.6.2",
38 | "@vercel/ncc": "0.24.0",
39 | "eslint": "7.2.0",
40 | "prettier": "2.1.2",
41 | "husky": "4.2.5",
42 | "jest": "26.4.2",
43 | "lint-staged": "10.2.13",
44 | "ts-jest": "26.3.0",
45 | "typescript": "4.0.2"
46 | },
47 | "jest": {
48 | "testMatch": [
49 | "/tests/**/*.ts"
50 | ],
51 | "transform": {
52 | "^.+\\.(ts|tsx)$": "ts-jest"
53 | },
54 | "moduleFileExtensions": [
55 | "js",
56 | "ts"
57 | ]
58 | },
59 | "husky": {
60 | "hooks": {
61 | "pre-commit": "lint-staged"
62 | }
63 | },
64 | "lint-staged": {
65 | "*.(js|ts|tsx)": [
66 | "eslint --fix"
67 | ],
68 | "*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)": [
69 | "prettier --write"
70 | ]
71 | },
72 | "eslintConfig": {
73 | "extends": [
74 | "@pocket-studios/eslint-config"
75 | ]
76 | },
77 | "prettier": "@pocket-studios/prettier-config"
78 | }
79 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { execSync } from 'child_process'
2 | import * as core from '@actions/core'
3 | import commandExists from 'command-exists'
4 |
5 | const installNpm = () => execSync('npm install -g firebase-tools')
6 | const installBash = () => execSync('curl -sL https://firebase.tools | bash')
7 |
8 | const run = async () => {
9 | const token = core.getInput('firebase-token')
10 | const os = process.env.RUNNER_OS
11 |
12 | if (!token) {
13 | throw new Error('Missing mandatory input: firebase-token')
14 | }
15 |
16 | core.exportVariable('FIREBASE_TOKEN', token)
17 | core.info('Exported environment variable FIREBASE_TOKEN')
18 |
19 | if (await commandExists('npm')) {
20 | core.info('Detected NPM installation')
21 | try {
22 | core.info('Trying to install firebase-tools using NPM')
23 | installNpm()
24 | } catch (e) {
25 | core.info('Installation failed through NPM (maybe you forgot actions/setup-node before this action)')
26 | core.info('Trying BASH instead')
27 | installBash()
28 | }
29 | } else if (os === 'Linux' || os === 'macOS') {
30 | core.info('Trying to install firebase-tools using BASH')
31 | installBash()
32 | } else if (os === 'Windows') {
33 | throw new Error('On windows you must setup node before running this action')
34 | }
35 | }
36 |
37 | run()
38 | .then(() => core.info('Successfully installed firebase-tools CLI'))
39 | .catch(error => core.setFailed(error.message))
40 |
--------------------------------------------------------------------------------
/tests/enviroment.ts:
--------------------------------------------------------------------------------
1 | import commandExists from 'command-exists'
2 |
3 | test('environment variable was set correctly', () => {
4 | const token = process.env.FIREBASE_TOKEN
5 |
6 | expect(token).not.toBeUndefined()
7 | expect(token).not.toBeNull()
8 | expect(token).toBe('banana')
9 | })
10 |
11 | test('firebase tools cli is installed', async () => {
12 | expect(await commandExists('firebase')).toBe('firebase')
13 | })
14 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es6",
4 | "module": "commonjs",
5 | "outDir": "./lib",
6 | "rootDir": "./src",
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "esModuleInterop": true,
10 | "allowSyntheticDefaultImports": true
11 | },
12 | "exclude": ["node_modules", "tests"]
13 | }
14 |
--------------------------------------------------------------------------------