作者 芦瑞泽

1119测试

正在显示 63 个修改的文件 包含 4365 行增加0 行删除

要显示太多修改。

为保证性能只显示 63 of 63+ 个文件。

  1 +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
  2 + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
  3 + "version": "0.0",
  4 + "configurations": [{
  5 + "default" :
  6 + {
  7 + "launchtype" : "local"
  8 + },
  9 + "mp-weixin" :
  10 + {
  11 + "launchtype" : "local"
  12 + },
  13 + "type" : "uniCloud"
  14 + }
  15 + ]
  16 +}
  1 +<script>
  2 + export default {
  3 + onLaunch: function() {
  4 + console.log('App Launch')
  5 + },
  6 + onShow: function() {
  7 + console.log('App Show')
  8 + },
  9 + onHide: function() {
  10 + console.log('App Hide')
  11 + }
  12 + }
  13 +</script>
  14 +
  15 +<style>
  16 + /*每个页面公共css */
  17 +</style>
  18 +<style lang="scss">
  19 + /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  20 + @import "uview-ui/index.scss";
  21 +</style>
  1 +import {
  2 + request
  3 +} from '@/utils/request.js'
  4 +
  5 +
  6 +// 发送验证码 /api/sms/send
  7 +export const getSend = (mobile, event) => request({url: '/api/sms/send',method: 'post',data: {mobile, event}})
  8 +
  9 +// 手机验证码登录 /api/common/mobilelogin
  10 +export const getCodeLogin = (mobile, captcha) => request({url: '/api/common/mobilelogin',method: 'post',data: {mobile, captcha}})
  11 +
  12 +
  13 +// 搜索 /api/index/search
  14 +export const getSearch = (obj) => request({url: '/api/index/search',method: 'post',data: obj})
  15 +
  16 +// 热门配件搜索 /api/upgrade/HotGoodsSearch
  17 +export const getHot = () => request({url: '/api/upgrade/HotGoodsSearch',method: 'post',data: {}})
  18 +
  19 +// 个人信息 /api/user/usercenter
  20 +export const getUser = () => request({url: '/api/user/usercenter',method: 'post',data: {}})
  21 +
  22 +// 修改头像 /api/user/upavatar
  23 +export const getAvatar = (avatar) => request({url: '/api/user/upavatar',method: 'post',data: {avatar}})
  24 +
  25 + // 修改昵称 /api/user/upnickname
  26 +export const getnickName = (nickname) => request({url: '/api/user/upnickname',method: 'post',data: {nickname}})
  27 +
  28 +// 修改手机号 /api/user/changemobile
  29 +export const getChange = (mobile,captcha) => request({url: '/api/user/changemobile',method: 'post',data: {mobile,captcha}})
  30 +
  31 +// 绑定手机号 /api/user/phone
  32 +// export const getPhone = (phone,captcha) => request({url: '/api/user/phone',method: 'post',data: {phone,captcha}})
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 + <head>
  4 + <meta charset="UTF-8" />
  5 + <script>
  6 + var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
  7 + CSS.supports('top: constant(a)'))
  8 + document.write(
  9 + '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
  10 + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
  11 + </script>
  12 + <title></title>
  13 + <!--preload-links-->
  14 + <!--app-context-->
  15 + </head>
  16 + <body>
  17 + <div id="app"><!--app-html--></div>
  18 + <script type="module" src="/main.js"></script>
  19 + </body>
  20 +</html>
  1 +import App from './App'
  2 +
  3 +import uView from "uview-ui";
  4 +Vue.use(uView);
  5 +
  6 +
  7 +// #ifndef VUE3
  8 +import Vue from 'vue'
  9 +Vue.config.productionTip = false
  10 +App.mpType = 'app'
  11 +const app = new Vue({
  12 + ...App
  13 +})
  14 +app.$mount()
  15 +// #endif
  16 +
  17 +// #ifdef VUE3
  18 +import { createSSRApp } from 'vue'
  19 +export function createApp() {
  20 + const app = createSSRApp(App)
  21 + return {
  22 + app
  23 + }
  24 +}
  25 +// #endif
  1 +{
  2 + "name" : "myTest",
  3 + "appid" : "__UNI__4046CC1",
  4 + "description" : "",
  5 + "versionName" : "1.0.0",
  6 + "versionCode" : "100",
  7 + "transformPx" : false,
  8 + /* 5+App特有相关 */
  9 + "app-plus" : {
  10 + "usingComponents" : true,
  11 + "nvueStyleCompiler" : "uni-app",
  12 + "compilerVersion" : 3,
  13 + "splashscreen" : {
  14 + "alwaysShowBeforeRender" : true,
  15 + "waiting" : true,
  16 + "autoclose" : true,
  17 + "delay" : 0
  18 + },
  19 + /* 模块配置 */
  20 + "modules" : {},
  21 + /* 应用发布信息 */
  22 + "distribute" : {
  23 + /* android打包配置 */
  24 + "android" : {
  25 + "permissions" : [
  26 + "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
  27 + "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
  28 + "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
  29 + "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
  30 + "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
  31 + "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
  32 + "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
  33 + "<uses-permission android:name=\"android.permission.CAMERA\"/>",
  34 + "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
  35 + "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
  36 + "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
  37 + "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
  38 + "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
  39 + "<uses-feature android:name=\"android.hardware.camera\"/>",
  40 + "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
  41 + ]
  42 + },
  43 + /* ios打包配置 */
  44 + "ios" : {},
  45 + /* SDK配置 */
  46 + "sdkConfigs" : {}
  47 + }
  48 + },
  49 + /* 快应用特有相关 */
  50 + "quickapp" : {},
  51 + /* 小程序特有相关 */
  52 + "mp-weixin" : {
  53 + "appid" : "wx8a42f2d5eaa6b32e",
  54 + "setting" : {
  55 + "urlCheck" : false,
  56 + "postcss" : true,
  57 + "minified" : true
  58 + },
  59 + "usingComponents" : true
  60 + },
  61 + "mp-alipay" : {
  62 + "usingComponents" : true
  63 + },
  64 + "mp-baidu" : {
  65 + "usingComponents" : true
  66 + },
  67 + "mp-toutiao" : {
  68 + "usingComponents" : true
  69 + },
  70 + "uniStatistics" : {
  71 + "enable" : false
  72 + },
  73 + "vueVersion" : "2"
  74 +}
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
  10 +else
  11 + exec node "$basedir/../acorn/bin/acorn" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\acorn\bin\acorn" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../acorn/bin/acorn" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../acorn/bin/acorn" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../browserslist/cli.js" "$@"
  10 +else
  11 + exec node "$basedir/../browserslist/cli.js" "$@"
  12 +fi
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../update-browserslist-db/cli.js" "$@"
  10 +else
  11 + exec node "$basedir/../update-browserslist-db/cli.js" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\update-browserslist-db\cli.js" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../update-browserslist-db/cli.js" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../update-browserslist-db/cli.js" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../update-browserslist-db/cli.js" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../update-browserslist-db/cli.js" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\browserslist\cli.js" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../browserslist/cli.js" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../browserslist/cli.js" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../browserslist/cli.js" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../browserslist/cli.js" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../json5/lib/cli.js" "$@"
  10 +else
  11 + exec node "$basedir/../json5/lib/cli.js" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\json5\lib\cli.js" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../json5/lib/cli.js" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../json5/lib/cli.js" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../json5/lib/cli.js" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../json5/lib/cli.js" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../sass/sass.js" "$@"
  10 +else
  11 + exec node "$basedir/../sass/sass.js" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\sass\sass.js" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../sass/sass.js" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../sass/sass.js" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../sass/sass.js" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../sass/sass.js" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
  10 +else
  11 + exec node "$basedir/../semver/bin/semver.js" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../semver/bin/semver.js" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../terser/bin/terser" "$@"
  10 +else
  11 + exec node "$basedir/../terser/bin/terser" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\terser\bin\terser" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../terser/bin/terser" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../terser/bin/terser" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../terser/bin/terser" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../terser/bin/terser" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +#!/bin/sh
  2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
  3 +
  4 +case `uname` in
  5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
  6 +esac
  7 +
  8 +if [ -x "$basedir/node" ]; then
  9 + exec "$basedir/node" "$basedir/../webpack/bin/webpack.js" "$@"
  10 +else
  11 + exec node "$basedir/../webpack/bin/webpack.js" "$@"
  12 +fi
  1 +@ECHO off
  2 +GOTO start
  3 +:find_dp0
  4 +SET dp0=%~dp0
  5 +EXIT /b
  6 +:start
  7 +SETLOCAL
  8 +CALL :find_dp0
  9 +
  10 +IF EXIST "%dp0%\node.exe" (
  11 + SET "_prog=%dp0%\node.exe"
  12 +) ELSE (
  13 + SET "_prog=node"
  14 + SET PATHEXT=%PATHEXT:;.JS;=;%
  15 +)
  16 +
  17 +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\webpack\bin\webpack.js" %*
  1 +#!/usr/bin/env pwsh
  2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3 +
  4 +$exe=""
  5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  6 + # Fix case when both the Windows and Linux builds of Node
  7 + # are installed in the same directory
  8 + $exe=".exe"
  9 +}
  10 +$ret=0
  11 +if (Test-Path "$basedir/node$exe") {
  12 + # Support pipeline input
  13 + if ($MyInvocation.ExpectingInput) {
  14 + $input | & "$basedir/node$exe" "$basedir/../webpack/bin/webpack.js" $args
  15 + } else {
  16 + & "$basedir/node$exe" "$basedir/../webpack/bin/webpack.js" $args
  17 + }
  18 + $ret=$LASTEXITCODE
  19 +} else {
  20 + # Support pipeline input
  21 + if ($MyInvocation.ExpectingInput) {
  22 + $input | & "node$exe" "$basedir/../webpack/bin/webpack.js" $args
  23 + } else {
  24 + & "node$exe" "$basedir/../webpack/bin/webpack.js" $args
  25 + }
  26 + $ret=$LASTEXITCODE
  27 +}
  28 +exit $ret
  1 +{
  2 + "name": "myTest",
  3 + "lockfileVersion": 2,
  4 + "requires": true,
  5 + "packages": {
  6 + "node_modules/@jridgewell/gen-mapping": {
  7 + "version": "0.3.2",
  8 + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
  9 + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
  10 + "dev": true,
  11 + "peer": true,
  12 + "dependencies": {
  13 + "@jridgewell/set-array": "^1.0.1",
  14 + "@jridgewell/sourcemap-codec": "^1.4.10",
  15 + "@jridgewell/trace-mapping": "^0.3.9"
  16 + },
  17 + "engines": {
  18 + "node": ">=6.0.0"
  19 + }
  20 + },
  21 + "node_modules/@jridgewell/resolve-uri": {
  22 + "version": "3.1.0",
  23 + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
  24 + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
  25 + "dev": true,
  26 + "peer": true,
  27 + "engines": {
  28 + "node": ">=6.0.0"
  29 + }
  30 + },
  31 + "node_modules/@jridgewell/set-array": {
  32 + "version": "1.1.2",
  33 + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
  34 + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
  35 + "dev": true,
  36 + "peer": true,
  37 + "engines": {
  38 + "node": ">=6.0.0"
  39 + }
  40 + },
  41 + "node_modules/@jridgewell/source-map": {
  42 + "version": "0.3.2",
  43 + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
  44 + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
  45 + "dev": true,
  46 + "peer": true,
  47 + "dependencies": {
  48 + "@jridgewell/gen-mapping": "^0.3.0",
  49 + "@jridgewell/trace-mapping": "^0.3.9"
  50 + }
  51 + },
  52 + "node_modules/@jridgewell/sourcemap-codec": {
  53 + "version": "1.4.14",
  54 + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
  55 + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
  56 + "dev": true,
  57 + "peer": true
  58 + },
  59 + "node_modules/@jridgewell/trace-mapping": {
  60 + "version": "0.3.16",
  61 + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.16.tgz",
  62 + "integrity": "sha512-LCQ+NeThyJ4k1W2d+vIKdxuSt9R3pQSZ4P92m7EakaYuXcVWbHuT5bjNcqLd4Rdgi6xYWYDvBJZJLZSLanjDcA==",
  63 + "dev": true,
  64 + "peer": true,
  65 + "dependencies": {
  66 + "@jridgewell/resolve-uri": "3.1.0",
  67 + "@jridgewell/sourcemap-codec": "1.4.14"
  68 + }
  69 + },
  70 + "node_modules/@types/eslint": {
  71 + "version": "8.4.6",
  72 + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.6.tgz",
  73 + "integrity": "sha512-/fqTbjxyFUaYNO7VcW5g+4npmqVACz1bB7RTHYuLj+PRjw9hrCwrUXVQFpChUS0JsyEFvMZ7U/PfmvWgxJhI9g==",
  74 + "dev": true,
  75 + "peer": true,
  76 + "dependencies": {
  77 + "@types/estree": "*",
  78 + "@types/json-schema": "*"
  79 + }
  80 + },
  81 + "node_modules/@types/eslint-scope": {
  82 + "version": "3.7.4",
  83 + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz",
  84 + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==",
  85 + "dev": true,
  86 + "peer": true,
  87 + "dependencies": {
  88 + "@types/eslint": "*",
  89 + "@types/estree": "*"
  90 + }
  91 + },
  92 + "node_modules/@types/estree": {
  93 + "version": "0.0.51",
  94 + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz",
  95 + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==",
  96 + "dev": true,
  97 + "peer": true
  98 + },
  99 + "node_modules/@types/json-schema": {
  100 + "version": "7.0.11",
  101 + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
  102 + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
  103 + "dev": true
  104 + },
  105 + "node_modules/@types/node": {
  106 + "version": "18.8.3",
  107 + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.3.tgz",
  108 + "integrity": "sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w==",
  109 + "dev": true,
  110 + "peer": true
  111 + },
  112 + "node_modules/@webassemblyjs/ast": {
  113 + "version": "1.11.1",
  114 + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
  115 + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==",
  116 + "dev": true,
  117 + "peer": true,
  118 + "dependencies": {
  119 + "@webassemblyjs/helper-numbers": "1.11.1",
  120 + "@webassemblyjs/helper-wasm-bytecode": "1.11.1"
  121 + }
  122 + },
  123 + "node_modules/@webassemblyjs/floating-point-hex-parser": {
  124 + "version": "1.11.1",
  125 + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz",
  126 + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==",
  127 + "dev": true,
  128 + "peer": true
  129 + },
  130 + "node_modules/@webassemblyjs/helper-api-error": {
  131 + "version": "1.11.1",
  132 + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz",
  133 + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==",
  134 + "dev": true,
  135 + "peer": true
  136 + },
  137 + "node_modules/@webassemblyjs/helper-buffer": {
  138 + "version": "1.11.1",
  139 + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz",
  140 + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==",
  141 + "dev": true,
  142 + "peer": true
  143 + },
  144 + "node_modules/@webassemblyjs/helper-numbers": {
  145 + "version": "1.11.1",
  146 + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz",
  147 + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==",
  148 + "dev": true,
  149 + "peer": true,
  150 + "dependencies": {
  151 + "@webassemblyjs/floating-point-hex-parser": "1.11.1",
  152 + "@webassemblyjs/helper-api-error": "1.11.1",
  153 + "@xtuc/long": "4.2.2"
  154 + }
  155 + },
  156 + "node_modules/@webassemblyjs/helper-wasm-bytecode": {
  157 + "version": "1.11.1",
  158 + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz",
  159 + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==",
  160 + "dev": true,
  161 + "peer": true
  162 + },
  163 + "node_modules/@webassemblyjs/helper-wasm-section": {
  164 + "version": "1.11.1",
  165 + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz",
  166 + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==",
  167 + "dev": true,
  168 + "peer": true,
  169 + "dependencies": {
  170 + "@webassemblyjs/ast": "1.11.1",
  171 + "@webassemblyjs/helper-buffer": "1.11.1",
  172 + "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
  173 + "@webassemblyjs/wasm-gen": "1.11.1"
  174 + }
  175 + },
  176 + "node_modules/@webassemblyjs/ieee754": {
  177 + "version": "1.11.1",
  178 + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz",
  179 + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==",
  180 + "dev": true,
  181 + "peer": true,
  182 + "dependencies": {
  183 + "@xtuc/ieee754": "^1.2.0"
  184 + }
  185 + },
  186 + "node_modules/@webassemblyjs/leb128": {
  187 + "version": "1.11.1",
  188 + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz",
  189 + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==",
  190 + "dev": true,
  191 + "peer": true,
  192 + "dependencies": {
  193 + "@xtuc/long": "4.2.2"
  194 + }
  195 + },
  196 + "node_modules/@webassemblyjs/utf8": {
  197 + "version": "1.11.1",
  198 + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz",
  199 + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==",
  200 + "dev": true,
  201 + "peer": true
  202 + },
  203 + "node_modules/@webassemblyjs/wasm-edit": {
  204 + "version": "1.11.1",
  205 + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz",
  206 + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==",
  207 + "dev": true,
  208 + "peer": true,
  209 + "dependencies": {
  210 + "@webassemblyjs/ast": "1.11.1",
  211 + "@webassemblyjs/helper-buffer": "1.11.1",
  212 + "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
  213 + "@webassemblyjs/helper-wasm-section": "1.11.1",
  214 + "@webassemblyjs/wasm-gen": "1.11.1",
  215 + "@webassemblyjs/wasm-opt": "1.11.1",
  216 + "@webassemblyjs/wasm-parser": "1.11.1",
  217 + "@webassemblyjs/wast-printer": "1.11.1"
  218 + }
  219 + },
  220 + "node_modules/@webassemblyjs/wasm-gen": {
  221 + "version": "1.11.1",
  222 + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz",
  223 + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==",
  224 + "dev": true,
  225 + "peer": true,
  226 + "dependencies": {
  227 + "@webassemblyjs/ast": "1.11.1",
  228 + "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
  229 + "@webassemblyjs/ieee754": "1.11.1",
  230 + "@webassemblyjs/leb128": "1.11.1",
  231 + "@webassemblyjs/utf8": "1.11.1"
  232 + }
  233 + },
  234 + "node_modules/@webassemblyjs/wasm-opt": {
  235 + "version": "1.11.1",
  236 + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz",
  237 + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==",
  238 + "dev": true,
  239 + "peer": true,
  240 + "dependencies": {
  241 + "@webassemblyjs/ast": "1.11.1",
  242 + "@webassemblyjs/helper-buffer": "1.11.1",
  243 + "@webassemblyjs/wasm-gen": "1.11.1",
  244 + "@webassemblyjs/wasm-parser": "1.11.1"
  245 + }
  246 + },
  247 + "node_modules/@webassemblyjs/wasm-parser": {
  248 + "version": "1.11.1",
  249 + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz",
  250 + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==",
  251 + "dev": true,
  252 + "peer": true,
  253 + "dependencies": {
  254 + "@webassemblyjs/ast": "1.11.1",
  255 + "@webassemblyjs/helper-api-error": "1.11.1",
  256 + "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
  257 + "@webassemblyjs/ieee754": "1.11.1",
  258 + "@webassemblyjs/leb128": "1.11.1",
  259 + "@webassemblyjs/utf8": "1.11.1"
  260 + }
  261 + },
  262 + "node_modules/@webassemblyjs/wast-printer": {
  263 + "version": "1.11.1",
  264 + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz",
  265 + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==",
  266 + "dev": true,
  267 + "peer": true,
  268 + "dependencies": {
  269 + "@webassemblyjs/ast": "1.11.1",
  270 + "@xtuc/long": "4.2.2"
  271 + }
  272 + },
  273 + "node_modules/@xtuc/ieee754": {
  274 + "version": "1.2.0",
  275 + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
  276 + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
  277 + "dev": true,
  278 + "peer": true
  279 + },
  280 + "node_modules/@xtuc/long": {
  281 + "version": "4.2.2",
  282 + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
  283 + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
  284 + "dev": true,
  285 + "peer": true
  286 + },
  287 + "node_modules/acorn": {
  288 + "version": "8.8.0",
  289 + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz",
  290 + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==",
  291 + "dev": true,
  292 + "peer": true,
  293 + "bin": {
  294 + "acorn": "bin/acorn"
  295 + },
  296 + "engines": {
  297 + "node": ">=0.4.0"
  298 + }
  299 + },
  300 + "node_modules/acorn-import-assertions": {
  301 + "version": "1.8.0",
  302 + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
  303 + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
  304 + "dev": true,
  305 + "peer": true,
  306 + "peerDependencies": {
  307 + "acorn": "^8"
  308 + }
  309 + },
  310 + "node_modules/ajv": {
  311 + "version": "6.12.6",
  312 + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
  313 + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
  314 + "dev": true,
  315 + "dependencies": {
  316 + "fast-deep-equal": "^3.1.1",
  317 + "fast-json-stable-stringify": "^2.0.0",
  318 + "json-schema-traverse": "^0.4.1",
  319 + "uri-js": "^4.2.2"
  320 + },
  321 + "funding": {
  322 + "type": "github",
  323 + "url": "https://github.com/sponsors/epoberezkin"
  324 + }
  325 + },
  326 + "node_modules/ajv-keywords": {
  327 + "version": "3.5.2",
  328 + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
  329 + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
  330 + "dev": true,
  331 + "peerDependencies": {
  332 + "ajv": "^6.9.1"
  333 + }
  334 + },
  335 + "node_modules/anymatch": {
  336 + "version": "3.1.2",
  337 + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
  338 + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
  339 + "dev": true,
  340 + "dependencies": {
  341 + "normalize-path": "^3.0.0",
  342 + "picomatch": "^2.0.4"
  343 + },
  344 + "engines": {
  345 + "node": ">= 8"
  346 + }
  347 + },
  348 + "node_modules/big.js": {
  349 + "version": "5.2.2",
  350 + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
  351 + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
  352 + "dev": true,
  353 + "engines": {
  354 + "node": "*"
  355 + }
  356 + },
  357 + "node_modules/binary-extensions": {
  358 + "version": "2.2.0",
  359 + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
  360 + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
  361 + "dev": true,
  362 + "engines": {
  363 + "node": ">=8"
  364 + }
  365 + },
  366 + "node_modules/braces": {
  367 + "version": "3.0.2",
  368 + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
  369 + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
  370 + "dev": true,
  371 + "dependencies": {
  372 + "fill-range": "^7.0.1"
  373 + },
  374 + "engines": {
  375 + "node": ">=8"
  376 + }
  377 + },
  378 + "node_modules/browserslist": {
  379 + "version": "4.21.4",
  380 + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz",
  381 + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==",
  382 + "dev": true,
  383 + "funding": [
  384 + {
  385 + "type": "opencollective",
  386 + "url": "https://opencollective.com/browserslist"
  387 + },
  388 + {
  389 + "type": "tidelift",
  390 + "url": "https://tidelift.com/funding/github/npm/browserslist"
  391 + }
  392 + ],
  393 + "peer": true,
  394 + "dependencies": {
  395 + "caniuse-lite": "^1.0.30001400",
  396 + "electron-to-chromium": "^1.4.251",
  397 + "node-releases": "^2.0.6",
  398 + "update-browserslist-db": "^1.0.9"
  399 + },
  400 + "bin": {
  401 + "browserslist": "cli.js"
  402 + },
  403 + "engines": {
  404 + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
  405 + }
  406 + },
  407 + "node_modules/buffer-from": {
  408 + "version": "1.1.2",
  409 + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
  410 + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
  411 + "dev": true,
  412 + "peer": true
  413 + },
  414 + "node_modules/caniuse-lite": {
  415 + "version": "1.0.30001418",
  416 + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001418.tgz",
  417 + "integrity": "sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg==",
  418 + "dev": true,
  419 + "funding": [
  420 + {
  421 + "type": "opencollective",
  422 + "url": "https://opencollective.com/browserslist"
  423 + },
  424 + {
  425 + "type": "tidelift",
  426 + "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
  427 + }
  428 + ],
  429 + "peer": true
  430 + },
  431 + "node_modules/chokidar": {
  432 + "version": "3.5.3",
  433 + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
  434 + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
  435 + "dev": true,
  436 + "funding": [
  437 + {
  438 + "type": "individual",
  439 + "url": "https://paulmillr.com/funding/"
  440 + }
  441 + ],
  442 + "dependencies": {
  443 + "anymatch": "~3.1.2",
  444 + "braces": "~3.0.2",
  445 + "glob-parent": "~5.1.2",
  446 + "is-binary-path": "~2.1.0",
  447 + "is-glob": "~4.0.1",
  448 + "normalize-path": "~3.0.0",
  449 + "readdirp": "~3.6.0"
  450 + },
  451 + "engines": {
  452 + "node": ">= 8.10.0"
  453 + },
  454 + "optionalDependencies": {
  455 + "fsevents": "~2.3.2"
  456 + }
  457 + },
  458 + "node_modules/chrome-trace-event": {
  459 + "version": "1.0.3",
  460 + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz",
  461 + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==",
  462 + "dev": true,
  463 + "peer": true,
  464 + "engines": {
  465 + "node": ">=6.0"
  466 + }
  467 + },
  468 + "node_modules/commander": {
  469 + "version": "2.20.3",
  470 + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
  471 + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
  472 + "dev": true,
  473 + "peer": true
  474 + },
  475 + "node_modules/electron-to-chromium": {
  476 + "version": "1.4.276",
  477 + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.276.tgz",
  478 + "integrity": "sha512-EpuHPqu8YhonqLBXHoU6hDJCD98FCe6KDoet3/gY1qsQ6usjJoHqBH2YIVs8FXaAtHwVL8Uqa/fsYao/vq9VWQ==",
  479 + "dev": true,
  480 + "peer": true
  481 + },
  482 + "node_modules/emojis-list": {
  483 + "version": "3.0.0",
  484 + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
  485 + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
  486 + "dev": true,
  487 + "engines": {
  488 + "node": ">= 4"
  489 + }
  490 + },
  491 + "node_modules/enhanced-resolve": {
  492 + "version": "5.10.0",
  493 + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz",
  494 + "integrity": "sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==",
  495 + "dev": true,
  496 + "peer": true,
  497 + "dependencies": {
  498 + "graceful-fs": "^4.2.4",
  499 + "tapable": "^2.2.0"
  500 + },
  501 + "engines": {
  502 + "node": ">=10.13.0"
  503 + }
  504 + },
  505 + "node_modules/es-module-lexer": {
  506 + "version": "0.9.3",
  507 + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
  508 + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
  509 + "dev": true,
  510 + "peer": true
  511 + },
  512 + "node_modules/escalade": {
  513 + "version": "3.1.1",
  514 + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
  515 + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
  516 + "dev": true,
  517 + "peer": true,
  518 + "engines": {
  519 + "node": ">=6"
  520 + }
  521 + },
  522 + "node_modules/eslint-scope": {
  523 + "version": "5.1.1",
  524 + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
  525 + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
  526 + "dev": true,
  527 + "peer": true,
  528 + "dependencies": {
  529 + "esrecurse": "^4.3.0",
  530 + "estraverse": "^4.1.1"
  531 + },
  532 + "engines": {
  533 + "node": ">=8.0.0"
  534 + }
  535 + },
  536 + "node_modules/esrecurse": {
  537 + "version": "4.3.0",
  538 + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
  539 + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
  540 + "dev": true,
  541 + "peer": true,
  542 + "dependencies": {
  543 + "estraverse": "^5.2.0"
  544 + },
  545 + "engines": {
  546 + "node": ">=4.0"
  547 + }
  548 + },
  549 + "node_modules/esrecurse/node_modules/estraverse": {
  550 + "version": "5.3.0",
  551 + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
  552 + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
  553 + "dev": true,
  554 + "peer": true,
  555 + "engines": {
  556 + "node": ">=4.0"
  557 + }
  558 + },
  559 + "node_modules/estraverse": {
  560 + "version": "4.3.0",
  561 + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
  562 + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
  563 + "dev": true,
  564 + "peer": true,
  565 + "engines": {
  566 + "node": ">=4.0"
  567 + }
  568 + },
  569 + "node_modules/events": {
  570 + "version": "3.3.0",
  571 + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
  572 + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
  573 + "dev": true,
  574 + "peer": true,
  575 + "engines": {
  576 + "node": ">=0.8.x"
  577 + }
  578 + },
  579 + "node_modules/fast-deep-equal": {
  580 + "version": "3.1.3",
  581 + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
  582 + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
  583 + "dev": true
  584 + },
  585 + "node_modules/fast-json-stable-stringify": {
  586 + "version": "2.1.0",
  587 + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
  588 + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
  589 + "dev": true
  590 + },
  591 + "node_modules/fill-range": {
  592 + "version": "7.0.1",
  593 + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
  594 + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
  595 + "dev": true,
  596 + "dependencies": {
  597 + "to-regex-range": "^5.0.1"
  598 + },
  599 + "engines": {
  600 + "node": ">=8"
  601 + }
  602 + },
  603 + "node_modules/glob-parent": {
  604 + "version": "5.1.2",
  605 + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
  606 + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
  607 + "dev": true,
  608 + "dependencies": {
  609 + "is-glob": "^4.0.1"
  610 + },
  611 + "engines": {
  612 + "node": ">= 6"
  613 + }
  614 + },
  615 + "node_modules/glob-to-regexp": {
  616 + "version": "0.4.1",
  617 + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
  618 + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
  619 + "dev": true,
  620 + "peer": true
  621 + },
  622 + "node_modules/graceful-fs": {
  623 + "version": "4.2.10",
  624 + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
  625 + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
  626 + "dev": true,
  627 + "peer": true
  628 + },
  629 + "node_modules/has-flag": {
  630 + "version": "4.0.0",
  631 + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
  632 + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
  633 + "dev": true,
  634 + "peer": true,
  635 + "engines": {
  636 + "node": ">=8"
  637 + }
  638 + },
  639 + "node_modules/immutable": {
  640 + "version": "4.1.0",
  641 + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz",
  642 + "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
  643 + "dev": true
  644 + },
  645 + "node_modules/is-binary-path": {
  646 + "version": "2.1.0",
  647 + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
  648 + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
  649 + "dev": true,
  650 + "dependencies": {
  651 + "binary-extensions": "^2.0.0"
  652 + },
  653 + "engines": {
  654 + "node": ">=8"
  655 + }
  656 + },
  657 + "node_modules/is-extglob": {
  658 + "version": "2.1.1",
  659 + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
  660 + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
  661 + "dev": true,
  662 + "engines": {
  663 + "node": ">=0.10.0"
  664 + }
  665 + },
  666 + "node_modules/is-glob": {
  667 + "version": "4.0.3",
  668 + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
  669 + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
  670 + "dev": true,
  671 + "dependencies": {
  672 + "is-extglob": "^2.1.1"
  673 + },
  674 + "engines": {
  675 + "node": ">=0.10.0"
  676 + }
  677 + },
  678 + "node_modules/is-number": {
  679 + "version": "7.0.0",
  680 + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
  681 + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
  682 + "dev": true,
  683 + "engines": {
  684 + "node": ">=0.12.0"
  685 + }
  686 + },
  687 + "node_modules/jest-worker": {
  688 + "version": "27.5.1",
  689 + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",
  690 + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
  691 + "dev": true,
  692 + "peer": true,
  693 + "dependencies": {
  694 + "@types/node": "*",
  695 + "merge-stream": "^2.0.0",
  696 + "supports-color": "^8.0.0"
  697 + },
  698 + "engines": {
  699 + "node": ">= 10.13.0"
  700 + }
  701 + },
  702 + "node_modules/json-parse-even-better-errors": {
  703 + "version": "2.3.1",
  704 + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
  705 + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
  706 + "dev": true,
  707 + "peer": true
  708 + },
  709 + "node_modules/json-schema-traverse": {
  710 + "version": "0.4.1",
  711 + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
  712 + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
  713 + "dev": true
  714 + },
  715 + "node_modules/json5": {
  716 + "version": "2.2.1",
  717 + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
  718 + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
  719 + "dev": true,
  720 + "bin": {
  721 + "json5": "lib/cli.js"
  722 + },
  723 + "engines": {
  724 + "node": ">=6"
  725 + }
  726 + },
  727 + "node_modules/klona": {
  728 + "version": "2.0.5",
  729 + "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.5.tgz",
  730 + "integrity": "sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ==",
  731 + "dev": true,
  732 + "engines": {
  733 + "node": ">= 8"
  734 + }
  735 + },
  736 + "node_modules/loader-runner": {
  737 + "version": "4.3.0",
  738 + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
  739 + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==",
  740 + "dev": true,
  741 + "peer": true,
  742 + "engines": {
  743 + "node": ">=6.11.5"
  744 + }
  745 + },
  746 + "node_modules/loader-utils": {
  747 + "version": "2.0.2",
  748 + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
  749 + "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
  750 + "dev": true,
  751 + "dependencies": {
  752 + "big.js": "^5.2.2",
  753 + "emojis-list": "^3.0.0",
  754 + "json5": "^2.1.2"
  755 + },
  756 + "engines": {
  757 + "node": ">=8.9.0"
  758 + }
  759 + },
  760 + "node_modules/lru-cache": {
  761 + "version": "6.0.0",
  762 + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
  763 + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
  764 + "dev": true,
  765 + "dependencies": {
  766 + "yallist": "^4.0.0"
  767 + },
  768 + "engines": {
  769 + "node": ">=10"
  770 + }
  771 + },
  772 + "node_modules/merge-stream": {
  773 + "version": "2.0.0",
  774 + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
  775 + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
  776 + "dev": true,
  777 + "peer": true
  778 + },
  779 + "node_modules/mime-db": {
  780 + "version": "1.52.0",
  781 + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
  782 + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
  783 + "dev": true,
  784 + "peer": true,
  785 + "engines": {
  786 + "node": ">= 0.6"
  787 + }
  788 + },
  789 + "node_modules/mime-types": {
  790 + "version": "2.1.35",
  791 + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
  792 + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
  793 + "dev": true,
  794 + "peer": true,
  795 + "dependencies": {
  796 + "mime-db": "1.52.0"
  797 + },
  798 + "engines": {
  799 + "node": ">= 0.6"
  800 + }
  801 + },
  802 + "node_modules/neo-async": {
  803 + "version": "2.6.2",
  804 + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
  805 + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
  806 + "dev": true
  807 + },
  808 + "node_modules/node-releases": {
  809 + "version": "2.0.6",
  810 + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz",
  811 + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==",
  812 + "dev": true,
  813 + "peer": true
  814 + },
  815 + "node_modules/normalize-path": {
  816 + "version": "3.0.0",
  817 + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
  818 + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
  819 + "dev": true,
  820 + "engines": {
  821 + "node": ">=0.10.0"
  822 + }
  823 + },
  824 + "node_modules/picocolors": {
  825 + "version": "1.0.0",
  826 + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
  827 + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
  828 + "dev": true,
  829 + "peer": true
  830 + },
  831 + "node_modules/picomatch": {
  832 + "version": "2.3.1",
  833 + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
  834 + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
  835 + "dev": true,
  836 + "engines": {
  837 + "node": ">=8.6"
  838 + },
  839 + "funding": {
  840 + "url": "https://github.com/sponsors/jonschlinkert"
  841 + }
  842 + },
  843 + "node_modules/punycode": {
  844 + "version": "2.1.1",
  845 + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
  846 + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
  847 + "dev": true,
  848 + "engines": {
  849 + "node": ">=6"
  850 + }
  851 + },
  852 + "node_modules/randombytes": {
  853 + "version": "2.1.0",
  854 + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
  855 + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
  856 + "dev": true,
  857 + "peer": true,
  858 + "dependencies": {
  859 + "safe-buffer": "^5.1.0"
  860 + }
  861 + },
  862 + "node_modules/readdirp": {
  863 + "version": "3.6.0",
  864 + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
  865 + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
  866 + "dev": true,
  867 + "dependencies": {
  868 + "picomatch": "^2.2.1"
  869 + },
  870 + "engines": {
  871 + "node": ">=8.10.0"
  872 + }
  873 + },
  874 + "node_modules/safe-buffer": {
  875 + "version": "5.2.1",
  876 + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
  877 + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
  878 + "dev": true,
  879 + "funding": [
  880 + {
  881 + "type": "github",
  882 + "url": "https://github.com/sponsors/feross"
  883 + },
  884 + {
  885 + "type": "patreon",
  886 + "url": "https://www.patreon.com/feross"
  887 + },
  888 + {
  889 + "type": "consulting",
  890 + "url": "https://feross.org/support"
  891 + }
  892 + ],
  893 + "peer": true
  894 + },
  895 + "node_modules/sass": {
  896 + "version": "1.55.0",
  897 + "resolved": "https://registry.npmjs.org/sass/-/sass-1.55.0.tgz",
  898 + "integrity": "sha512-Pk+PMy7OGLs9WaxZGJMn7S96dvlyVBwwtToX895WmCpAOr5YiJYEUJfiJidMuKb613z2xNWcXCHEuOvjZbqC6A==",
  899 + "dev": true,
  900 + "dependencies": {
  901 + "chokidar": ">=3.0.0 <4.0.0",
  902 + "immutable": "^4.0.0",
  903 + "source-map-js": ">=0.6.2 <2.0.0"
  904 + },
  905 + "bin": {
  906 + "sass": "sass.js"
  907 + },
  908 + "engines": {
  909 + "node": ">=12.0.0"
  910 + }
  911 + },
  912 + "node_modules/sass-loader": {
  913 + "version": "10.3.1",
  914 + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-10.3.1.tgz",
  915 + "integrity": "sha512-y2aBdtYkbqorVavkC3fcJIUDGIegzDWPn3/LAFhsf3G+MzPKTJx37sROf5pXtUeggSVbNbmfj8TgRaSLMelXRA==",
  916 + "dev": true,
  917 + "dependencies": {
  918 + "klona": "^2.0.4",
  919 + "loader-utils": "^2.0.0",
  920 + "neo-async": "^2.6.2",
  921 + "schema-utils": "^3.0.0",
  922 + "semver": "^7.3.2"
  923 + },
  924 + "engines": {
  925 + "node": ">= 10.13.0"
  926 + },
  927 + "funding": {
  928 + "type": "opencollective",
  929 + "url": "https://opencollective.com/webpack"
  930 + },
  931 + "peerDependencies": {
  932 + "fibers": ">= 3.1.0",
  933 + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
  934 + "sass": "^1.3.0",
  935 + "webpack": "^4.36.0 || ^5.0.0"
  936 + },
  937 + "peerDependenciesMeta": {
  938 + "fibers": {
  939 + "optional": true
  940 + },
  941 + "node-sass": {
  942 + "optional": true
  943 + },
  944 + "sass": {
  945 + "optional": true
  946 + }
  947 + }
  948 + },
  949 + "node_modules/schema-utils": {
  950 + "version": "3.1.1",
  951 + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
  952 + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
  953 + "dev": true,
  954 + "dependencies": {
  955 + "@types/json-schema": "^7.0.8",
  956 + "ajv": "^6.12.5",
  957 + "ajv-keywords": "^3.5.2"
  958 + },
  959 + "engines": {
  960 + "node": ">= 10.13.0"
  961 + },
  962 + "funding": {
  963 + "type": "opencollective",
  964 + "url": "https://opencollective.com/webpack"
  965 + }
  966 + },
  967 + "node_modules/semver": {
  968 + "version": "7.3.8",
  969 + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
  970 + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
  971 + "dev": true,
  972 + "dependencies": {
  973 + "lru-cache": "^6.0.0"
  974 + },
  975 + "bin": {
  976 + "semver": "bin/semver.js"
  977 + },
  978 + "engines": {
  979 + "node": ">=10"
  980 + }
  981 + },
  982 + "node_modules/serialize-javascript": {
  983 + "version": "6.0.0",
  984 + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
  985 + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
  986 + "dev": true,
  987 + "peer": true,
  988 + "dependencies": {
  989 + "randombytes": "^2.1.0"
  990 + }
  991 + },
  992 + "node_modules/source-map": {
  993 + "version": "0.6.1",
  994 + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
  995 + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
  996 + "dev": true,
  997 + "peer": true,
  998 + "engines": {
  999 + "node": ">=0.10.0"
  1000 + }
  1001 + },
  1002 + "node_modules/source-map-js": {
  1003 + "version": "1.0.2",
  1004 + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
  1005 + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
  1006 + "dev": true,
  1007 + "engines": {
  1008 + "node": ">=0.10.0"
  1009 + }
  1010 + },
  1011 + "node_modules/source-map-support": {
  1012 + "version": "0.5.21",
  1013 + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
  1014 + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
  1015 + "dev": true,
  1016 + "peer": true,
  1017 + "dependencies": {
  1018 + "buffer-from": "^1.0.0",
  1019 + "source-map": "^0.6.0"
  1020 + }
  1021 + },
  1022 + "node_modules/supports-color": {
  1023 + "version": "8.1.1",
  1024 + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
  1025 + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
  1026 + "dev": true,
  1027 + "peer": true,
  1028 + "dependencies": {
  1029 + "has-flag": "^4.0.0"
  1030 + },
  1031 + "engines": {
  1032 + "node": ">=10"
  1033 + },
  1034 + "funding": {
  1035 + "url": "https://github.com/chalk/supports-color?sponsor=1"
  1036 + }
  1037 + },
  1038 + "node_modules/tapable": {
  1039 + "version": "2.2.1",
  1040 + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
  1041 + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
  1042 + "dev": true,
  1043 + "peer": true,
  1044 + "engines": {
  1045 + "node": ">=6"
  1046 + }
  1047 + },
  1048 + "node_modules/terser": {
  1049 + "version": "5.15.1",
  1050 + "resolved": "https://registry.npmjs.org/terser/-/terser-5.15.1.tgz",
  1051 + "integrity": "sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw==",
  1052 + "dev": true,
  1053 + "peer": true,
  1054 + "dependencies": {
  1055 + "@jridgewell/source-map": "^0.3.2",
  1056 + "acorn": "^8.5.0",
  1057 + "commander": "^2.20.0",
  1058 + "source-map-support": "~0.5.20"
  1059 + },
  1060 + "bin": {
  1061 + "terser": "bin/terser"
  1062 + },
  1063 + "engines": {
  1064 + "node": ">=10"
  1065 + }
  1066 + },
  1067 + "node_modules/terser-webpack-plugin": {
  1068 + "version": "5.3.6",
  1069 + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.6.tgz",
  1070 + "integrity": "sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ==",
  1071 + "dev": true,
  1072 + "peer": true,
  1073 + "dependencies": {
  1074 + "@jridgewell/trace-mapping": "^0.3.14",
  1075 + "jest-worker": "^27.4.5",
  1076 + "schema-utils": "^3.1.1",
  1077 + "serialize-javascript": "^6.0.0",
  1078 + "terser": "^5.14.1"
  1079 + },
  1080 + "engines": {
  1081 + "node": ">= 10.13.0"
  1082 + },
  1083 + "funding": {
  1084 + "type": "opencollective",
  1085 + "url": "https://opencollective.com/webpack"
  1086 + },
  1087 + "peerDependencies": {
  1088 + "webpack": "^5.1.0"
  1089 + },
  1090 + "peerDependenciesMeta": {
  1091 + "@swc/core": {
  1092 + "optional": true
  1093 + },
  1094 + "esbuild": {
  1095 + "optional": true
  1096 + },
  1097 + "uglify-js": {
  1098 + "optional": true
  1099 + }
  1100 + }
  1101 + },
  1102 + "node_modules/to-regex-range": {
  1103 + "version": "5.0.1",
  1104 + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
  1105 + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
  1106 + "dev": true,
  1107 + "dependencies": {
  1108 + "is-number": "^7.0.0"
  1109 + },
  1110 + "engines": {
  1111 + "node": ">=8.0"
  1112 + }
  1113 + },
  1114 + "node_modules/update-browserslist-db": {
  1115 + "version": "1.0.10",
  1116 + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz",
  1117 + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==",
  1118 + "dev": true,
  1119 + "funding": [
  1120 + {
  1121 + "type": "opencollective",
  1122 + "url": "https://opencollective.com/browserslist"
  1123 + },
  1124 + {
  1125 + "type": "tidelift",
  1126 + "url": "https://tidelift.com/funding/github/npm/browserslist"
  1127 + }
  1128 + ],
  1129 + "peer": true,
  1130 + "dependencies": {
  1131 + "escalade": "^3.1.1",
  1132 + "picocolors": "^1.0.0"
  1133 + },
  1134 + "bin": {
  1135 + "browserslist-lint": "cli.js"
  1136 + },
  1137 + "peerDependencies": {
  1138 + "browserslist": ">= 4.21.0"
  1139 + }
  1140 + },
  1141 + "node_modules/uri-js": {
  1142 + "version": "4.4.1",
  1143 + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
  1144 + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
  1145 + "dev": true,
  1146 + "dependencies": {
  1147 + "punycode": "^2.1.0"
  1148 + }
  1149 + },
  1150 + "node_modules/uview-ui": {
  1151 + "version": "2.0.31",
  1152 + "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.31.tgz",
  1153 + "integrity": "sha512-I/0fGuvtiKHH/mBb864SGYk+SJ7WaF32tsBgYgeBOsxlUp+Th+Ac2tgz2cTvsQJl6eZYWsKZ3ixiSXCAcxZ8Sw==",
  1154 + "engines": {
  1155 + "HBuilderX": "^3.1.0"
  1156 + }
  1157 + },
  1158 + "node_modules/watchpack": {
  1159 + "version": "2.4.0",
  1160 + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
  1161 + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==",
  1162 + "dev": true,
  1163 + "peer": true,
  1164 + "dependencies": {
  1165 + "glob-to-regexp": "^0.4.1",
  1166 + "graceful-fs": "^4.1.2"
  1167 + },
  1168 + "engines": {
  1169 + "node": ">=10.13.0"
  1170 + }
  1171 + },
  1172 + "node_modules/webpack": {
  1173 + "version": "5.74.0",
  1174 + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz",
  1175 + "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==",
  1176 + "dev": true,
  1177 + "peer": true,
  1178 + "dependencies": {
  1179 + "@types/eslint-scope": "^3.7.3",
  1180 + "@types/estree": "^0.0.51",
  1181 + "@webassemblyjs/ast": "1.11.1",
  1182 + "@webassemblyjs/wasm-edit": "1.11.1",
  1183 + "@webassemblyjs/wasm-parser": "1.11.1",
  1184 + "acorn": "^8.7.1",
  1185 + "acorn-import-assertions": "^1.7.6",
  1186 + "browserslist": "^4.14.5",
  1187 + "chrome-trace-event": "^1.0.2",
  1188 + "enhanced-resolve": "^5.10.0",
  1189 + "es-module-lexer": "^0.9.0",
  1190 + "eslint-scope": "5.1.1",
  1191 + "events": "^3.2.0",
  1192 + "glob-to-regexp": "^0.4.1",
  1193 + "graceful-fs": "^4.2.9",
  1194 + "json-parse-even-better-errors": "^2.3.1",
  1195 + "loader-runner": "^4.2.0",
  1196 + "mime-types": "^2.1.27",
  1197 + "neo-async": "^2.6.2",
  1198 + "schema-utils": "^3.1.0",
  1199 + "tapable": "^2.1.1",
  1200 + "terser-webpack-plugin": "^5.1.3",
  1201 + "watchpack": "^2.4.0",
  1202 + "webpack-sources": "^3.2.3"
  1203 + },
  1204 + "bin": {
  1205 + "webpack": "bin/webpack.js"
  1206 + },
  1207 + "engines": {
  1208 + "node": ">=10.13.0"
  1209 + },
  1210 + "funding": {
  1211 + "type": "opencollective",
  1212 + "url": "https://opencollective.com/webpack"
  1213 + },
  1214 + "peerDependenciesMeta": {
  1215 + "webpack-cli": {
  1216 + "optional": true
  1217 + }
  1218 + }
  1219 + },
  1220 + "node_modules/webpack-sources": {
  1221 + "version": "3.2.3",
  1222 + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
  1223 + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
  1224 + "dev": true,
  1225 + "peer": true,
  1226 + "engines": {
  1227 + "node": ">=10.13.0"
  1228 + }
  1229 + },
  1230 + "node_modules/yallist": {
  1231 + "version": "4.0.0",
  1232 + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
  1233 + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
  1234 + "dev": true
  1235 + }
  1236 + }
  1237 +}
  1 +Copyright 2022 Justin Ridgewell <jridgewell@google.com>
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is
  8 +furnished to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in
  11 +all copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19 +SOFTWARE.
  1 +# @jridgewell/gen-mapping
  2 +
  3 +> Generate source maps
  4 +
  5 +`gen-mapping` allows you to generate a source map during transpilation or minification.
  6 +With a source map, you're able to trace the original location in the source file, either in Chrome's
  7 +DevTools or using a library like [`@jridgewell/trace-mapping`][trace-mapping].
  8 +
  9 +You may already be familiar with the [`source-map`][source-map] package's `SourceMapGenerator`. This
  10 +provides the same `addMapping` and `setSourceContent` API.
  11 +
  12 +## Installation
  13 +
  14 +```sh
  15 +npm install @jridgewell/gen-mapping
  16 +```
  17 +
  18 +## Usage
  19 +
  20 +```typescript
  21 +import { GenMapping, addMapping, setSourceContent, toEncodedMap, toDecodedMap } from '@jridgewell/gen-mapping';
  22 +
  23 +const map = new GenMapping({
  24 + file: 'output.js',
  25 + sourceRoot: 'https://example.com/',
  26 +});
  27 +
  28 +setSourceContent(map, 'input.js', `function foo() {}`);
  29 +
  30 +addMapping(map, {
  31 + // Lines start at line 1, columns at column 0.
  32 + generated: { line: 1, column: 0 },
  33 + source: 'input.js',
  34 + original: { line: 1, column: 0 },
  35 +});
  36 +
  37 +addMapping(map, {
  38 + generated: { line: 1, column: 9 },
  39 + source: 'input.js',
  40 + original: { line: 1, column: 9 },
  41 + name: 'foo',
  42 +});
  43 +
  44 +assert.deepEqual(toDecodedMap(map), {
  45 + version: 3,
  46 + file: 'output.js',
  47 + names: ['foo'],
  48 + sourceRoot: 'https://example.com/',
  49 + sources: ['input.js'],
  50 + sourcesContent: ['function foo() {}'],
  51 + mappings: [
  52 + [ [0, 0, 0, 0], [9, 0, 0, 9, 0] ]
  53 + ],
  54 +});
  55 +
  56 +assert.deepEqual(toEncodedMap(map), {
  57 + version: 3,
  58 + file: 'output.js',
  59 + names: ['foo'],
  60 + sourceRoot: 'https://example.com/',
  61 + sources: ['input.js'],
  62 + sourcesContent: ['function foo() {}'],
  63 + mappings: 'AAAA,SAASA',
  64 +});
  65 +```
  66 +
  67 +### Smaller Sourcemaps
  68 +
  69 +Not everything needs to be added to a sourcemap, and needless markings can cause signficantly
  70 +larger file sizes. `gen-mapping` exposes `maybeAddSegment`/`maybeAddMapping` APIs that will
  71 +intelligently determine if this marking adds useful information. If not, the marking will be
  72 +skipped.
  73 +
  74 +```typescript
  75 +import { maybeAddMapping } from '@jridgewell/gen-mapping';
  76 +
  77 +const map = new GenMapping();
  78 +
  79 +// Adding a sourceless marking at the beginning of a line isn't useful.
  80 +maybeAddMapping(map, {
  81 + generated: { line: 1, column: 0 },
  82 +});
  83 +
  84 +// Adding a new source marking is useful.
  85 +maybeAddMapping(map, {
  86 + generated: { line: 1, column: 0 },
  87 + source: 'input.js',
  88 + original: { line: 1, column: 0 },
  89 +});
  90 +
  91 +// But adding another marking pointing to the exact same original location isn't, even if the
  92 +// generated column changed.
  93 +maybeAddMapping(map, {
  94 + generated: { line: 1, column: 9 },
  95 + source: 'input.js',
  96 + original: { line: 1, column: 0 },
  97 +});
  98 +
  99 +assert.deepEqual(toEncodedMap(map), {
  100 + version: 3,
  101 + names: [],
  102 + sources: ['input.js'],
  103 + sourcesContent: [null],
  104 + mappings: 'AAAA',
  105 +});
  106 +```
  107 +
  108 +## Benchmarks
  109 +
  110 +```
  111 +node v18.0.0
  112 +
  113 +amp.js.map
  114 +Memory Usage:
  115 +gen-mapping: addSegment 5852872 bytes
  116 +gen-mapping: addMapping 7716042 bytes
  117 +source-map-js 6143250 bytes
  118 +source-map-0.6.1 6124102 bytes
  119 +source-map-0.8.0 6121173 bytes
  120 +Smallest memory usage is gen-mapping: addSegment
  121 +
  122 +Adding speed:
  123 +gen-mapping: addSegment x 441 ops/sec ±2.07% (90 runs sampled)
  124 +gen-mapping: addMapping x 350 ops/sec ±2.40% (86 runs sampled)
  125 +source-map-js: addMapping x 169 ops/sec ±2.42% (80 runs sampled)
  126 +source-map-0.6.1: addMapping x 167 ops/sec ±2.56% (80 runs sampled)
  127 +source-map-0.8.0: addMapping x 168 ops/sec ±2.52% (80 runs sampled)
  128 +Fastest is gen-mapping: addSegment
  129 +
  130 +Generate speed:
  131 +gen-mapping: decoded output x 150,824,370 ops/sec ±0.07% (102 runs sampled)
  132 +gen-mapping: encoded output x 663 ops/sec ±0.22% (98 runs sampled)
  133 +source-map-js: encoded output x 197 ops/sec ±0.45% (84 runs sampled)
  134 +source-map-0.6.1: encoded output x 198 ops/sec ±0.33% (85 runs sampled)
  135 +source-map-0.8.0: encoded output x 197 ops/sec ±0.06% (93 runs sampled)
  136 +Fastest is gen-mapping: decoded output
  137 +
  138 +
  139 +***
  140 +
  141 +
  142 +babel.min.js.map
  143 +Memory Usage:
  144 +gen-mapping: addSegment 37578063 bytes
  145 +gen-mapping: addMapping 37212897 bytes
  146 +source-map-js 47638527 bytes
  147 +source-map-0.6.1 47690503 bytes
  148 +source-map-0.8.0 47470188 bytes
  149 +Smallest memory usage is gen-mapping: addMapping
  150 +
  151 +Adding speed:
  152 +gen-mapping: addSegment x 31.05 ops/sec ±8.31% (43 runs sampled)
  153 +gen-mapping: addMapping x 29.83 ops/sec ±7.36% (51 runs sampled)
  154 +source-map-js: addMapping x 20.73 ops/sec ±6.22% (38 runs sampled)
  155 +source-map-0.6.1: addMapping x 20.03 ops/sec ±10.51% (38 runs sampled)
  156 +source-map-0.8.0: addMapping x 19.30 ops/sec ±8.27% (37 runs sampled)
  157 +Fastest is gen-mapping: addSegment
  158 +
  159 +Generate speed:
  160 +gen-mapping: decoded output x 381,379,234 ops/sec ±0.29% (96 runs sampled)
  161 +gen-mapping: encoded output x 95.15 ops/sec ±2.98% (72 runs sampled)
  162 +source-map-js: encoded output x 15.20 ops/sec ±7.41% (33 runs sampled)
  163 +source-map-0.6.1: encoded output x 16.36 ops/sec ±10.46% (31 runs sampled)
  164 +source-map-0.8.0: encoded output x 16.06 ops/sec ±6.45% (31 runs sampled)
  165 +Fastest is gen-mapping: decoded output
  166 +
  167 +
  168 +***
  169 +
  170 +
  171 +preact.js.map
  172 +Memory Usage:
  173 +gen-mapping: addSegment 416247 bytes
  174 +gen-mapping: addMapping 419824 bytes
  175 +source-map-js 1024619 bytes
  176 +source-map-0.6.1 1146004 bytes
  177 +source-map-0.8.0 1113250 bytes
  178 +Smallest memory usage is gen-mapping: addSegment
  179 +
  180 +Adding speed:
  181 +gen-mapping: addSegment x 13,755 ops/sec ±0.15% (98 runs sampled)
  182 +gen-mapping: addMapping x 13,013 ops/sec ±0.11% (101 runs sampled)
  183 +source-map-js: addMapping x 4,564 ops/sec ±0.21% (98 runs sampled)
  184 +source-map-0.6.1: addMapping x 4,562 ops/sec ±0.11% (99 runs sampled)
  185 +source-map-0.8.0: addMapping x 4,593 ops/sec ±0.11% (100 runs sampled)
  186 +Fastest is gen-mapping: addSegment
  187 +
  188 +Generate speed:
  189 +gen-mapping: decoded output x 379,864,020 ops/sec ±0.23% (93 runs sampled)
  190 +gen-mapping: encoded output x 14,368 ops/sec ±4.07% (82 runs sampled)
  191 +source-map-js: encoded output x 5,261 ops/sec ±0.21% (99 runs sampled)
  192 +source-map-0.6.1: encoded output x 5,124 ops/sec ±0.58% (99 runs sampled)
  193 +source-map-0.8.0: encoded output x 5,434 ops/sec ±0.33% (96 runs sampled)
  194 +Fastest is gen-mapping: decoded output
  195 +
  196 +
  197 +***
  198 +
  199 +
  200 +react.js.map
  201 +Memory Usage:
  202 +gen-mapping: addSegment 975096 bytes
  203 +gen-mapping: addMapping 1102981 bytes
  204 +source-map-js 2918836 bytes
  205 +source-map-0.6.1 2885435 bytes
  206 +source-map-0.8.0 2874336 bytes
  207 +Smallest memory usage is gen-mapping: addSegment
  208 +
  209 +Adding speed:
  210 +gen-mapping: addSegment x 4,772 ops/sec ±0.15% (100 runs sampled)
  211 +gen-mapping: addMapping x 4,456 ops/sec ±0.13% (97 runs sampled)
  212 +source-map-js: addMapping x 1,618 ops/sec ±0.24% (97 runs sampled)
  213 +source-map-0.6.1: addMapping x 1,622 ops/sec ±0.12% (99 runs sampled)
  214 +source-map-0.8.0: addMapping x 1,631 ops/sec ±0.12% (100 runs sampled)
  215 +Fastest is gen-mapping: addSegment
  216 +
  217 +Generate speed:
  218 +gen-mapping: decoded output x 379,107,695 ops/sec ±0.07% (99 runs sampled)
  219 +gen-mapping: encoded output x 5,421 ops/sec ±1.60% (89 runs sampled)
  220 +source-map-js: encoded output x 2,113 ops/sec ±1.81% (98 runs sampled)
  221 +source-map-0.6.1: encoded output x 2,126 ops/sec ±0.10% (100 runs sampled)
  222 +source-map-0.8.0: encoded output x 2,176 ops/sec ±0.39% (98 runs sampled)
  223 +Fastest is gen-mapping: decoded output
  224 +```
  225 +
  226 +[source-map]: https://www.npmjs.com/package/source-map
  227 +[trace-mapping]: https://github.com/jridgewell/trace-mapping
  1 +import { SetArray, put } from '@jridgewell/set-array';
  2 +import { encode } from '@jridgewell/sourcemap-codec';
  3 +import { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';
  4 +
  5 +const COLUMN = 0;
  6 +const SOURCES_INDEX = 1;
  7 +const SOURCE_LINE = 2;
  8 +const SOURCE_COLUMN = 3;
  9 +const NAMES_INDEX = 4;
  10 +
  11 +const NO_NAME = -1;
  12 +/**
  13 + * A low-level API to associate a generated position with an original source position. Line and
  14 + * column here are 0-based, unlike `addMapping`.
  15 + */
  16 +let addSegment;
  17 +/**
  18 + * A high-level API to associate a generated position with an original source position. Line is
  19 + * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
  20 + */
  21 +let addMapping;
  22 +/**
  23 + * Same as `addSegment`, but will only add the segment if it generates useful information in the
  24 + * resulting map. This only works correctly if segments are added **in order**, meaning you should
  25 + * not add a segment with a lower generated line/column than one that came before.
  26 + */
  27 +let maybeAddSegment;
  28 +/**
  29 + * Same as `addMapping`, but will only add the mapping if it generates useful information in the
  30 + * resulting map. This only works correctly if mappings are added **in order**, meaning you should
  31 + * not add a mapping with a lower generated line/column than one that came before.
  32 + */
  33 +let maybeAddMapping;
  34 +/**
  35 + * Adds/removes the content of the source file to the source map.
  36 + */
  37 +let setSourceContent;
  38 +/**
  39 + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
  40 + * a sourcemap, or to JSON.stringify.
  41 + */
  42 +let toDecodedMap;
  43 +/**
  44 + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
  45 + * a sourcemap, or to JSON.stringify.
  46 + */
  47 +let toEncodedMap;
  48 +/**
  49 + * Constructs a new GenMapping, using the already present mappings of the input.
  50 + */
  51 +let fromMap;
  52 +/**
  53 + * Returns an array of high-level mapping objects for every recorded segment, which could then be
  54 + * passed to the `source-map` library.
  55 + */
  56 +let allMappings;
  57 +// This split declaration is only so that terser can elminiate the static initialization block.
  58 +let addSegmentInternal;
  59 +/**
  60 + * Provides the state to generate a sourcemap.
  61 + */
  62 +class GenMapping {
  63 + constructor({ file, sourceRoot } = {}) {
  64 + this._names = new SetArray();
  65 + this._sources = new SetArray();
  66 + this._sourcesContent = [];
  67 + this._mappings = [];
  68 + this.file = file;
  69 + this.sourceRoot = sourceRoot;
  70 + }
  71 +}
  72 +(() => {
  73 + addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  74 + return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
  75 + };
  76 + maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  77 + return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
  78 + };
  79 + addMapping = (map, mapping) => {
  80 + return addMappingInternal(false, map, mapping);
  81 + };
  82 + maybeAddMapping = (map, mapping) => {
  83 + return addMappingInternal(true, map, mapping);
  84 + };
  85 + setSourceContent = (map, source, content) => {
  86 + const { _sources: sources, _sourcesContent: sourcesContent } = map;
  87 + sourcesContent[put(sources, source)] = content;
  88 + };
  89 + toDecodedMap = (map) => {
  90 + const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
  91 + removeEmptyFinalLines(mappings);
  92 + return {
  93 + version: 3,
  94 + file: file || undefined,
  95 + names: names.array,
  96 + sourceRoot: sourceRoot || undefined,
  97 + sources: sources.array,
  98 + sourcesContent,
  99 + mappings,
  100 + };
  101 + };
  102 + toEncodedMap = (map) => {
  103 + const decoded = toDecodedMap(map);
  104 + return Object.assign(Object.assign({}, decoded), { mappings: encode(decoded.mappings) });
  105 + };
  106 + allMappings = (map) => {
  107 + const out = [];
  108 + const { _mappings: mappings, _sources: sources, _names: names } = map;
  109 + for (let i = 0; i < mappings.length; i++) {
  110 + const line = mappings[i];
  111 + for (let j = 0; j < line.length; j++) {
  112 + const seg = line[j];
  113 + const generated = { line: i + 1, column: seg[COLUMN] };
  114 + let source = undefined;
  115 + let original = undefined;
  116 + let name = undefined;
  117 + if (seg.length !== 1) {
  118 + source = sources.array[seg[SOURCES_INDEX]];
  119 + original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
  120 + if (seg.length === 5)
  121 + name = names.array[seg[NAMES_INDEX]];
  122 + }
  123 + out.push({ generated, source, original, name });
  124 + }
  125 + }
  126 + return out;
  127 + };
  128 + fromMap = (input) => {
  129 + const map = new TraceMap(input);
  130 + const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });
  131 + putAll(gen._names, map.names);
  132 + putAll(gen._sources, map.sources);
  133 + gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);
  134 + gen._mappings = decodedMappings(map);
  135 + return gen;
  136 + };
  137 + // Internal helpers
  138 + addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  139 + const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
  140 + const line = getLine(mappings, genLine);
  141 + const index = getColumnIndex(line, genColumn);
  142 + if (!source) {
  143 + if (skipable && skipSourceless(line, index))
  144 + return;
  145 + return insert(line, index, [genColumn]);
  146 + }
  147 + const sourcesIndex = put(sources, source);
  148 + const namesIndex = name ? put(names, name) : NO_NAME;
  149 + if (sourcesIndex === sourcesContent.length)
  150 + sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
  151 + if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
  152 + return;
  153 + }
  154 + return insert(line, index, name
  155 + ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
  156 + : [genColumn, sourcesIndex, sourceLine, sourceColumn]);
  157 + };
  158 +})();
  159 +function getLine(mappings, index) {
  160 + for (let i = mappings.length; i <= index; i++) {
  161 + mappings[i] = [];
  162 + }
  163 + return mappings[index];
  164 +}
  165 +function getColumnIndex(line, genColumn) {
  166 + let index = line.length;
  167 + for (let i = index - 1; i >= 0; index = i--) {
  168 + const current = line[i];
  169 + if (genColumn >= current[COLUMN])
  170 + break;
  171 + }
  172 + return index;
  173 +}
  174 +function insert(array, index, value) {
  175 + for (let i = array.length; i > index; i--) {
  176 + array[i] = array[i - 1];
  177 + }
  178 + array[index] = value;
  179 +}
  180 +function removeEmptyFinalLines(mappings) {
  181 + const { length } = mappings;
  182 + let len = length;
  183 + for (let i = len - 1; i >= 0; len = i, i--) {
  184 + if (mappings[i].length > 0)
  185 + break;
  186 + }
  187 + if (len < length)
  188 + mappings.length = len;
  189 +}
  190 +function putAll(strarr, array) {
  191 + for (let i = 0; i < array.length; i++)
  192 + put(strarr, array[i]);
  193 +}
  194 +function skipSourceless(line, index) {
  195 + // The start of a line is already sourceless, so adding a sourceless segment to the beginning
  196 + // doesn't generate any useful information.
  197 + if (index === 0)
  198 + return true;
  199 + const prev = line[index - 1];
  200 + // If the previous segment is also sourceless, then adding another sourceless segment doesn't
  201 + // genrate any new information. Else, this segment will end the source/named segment and point to
  202 + // a sourceless position, which is useful.
  203 + return prev.length === 1;
  204 +}
  205 +function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
  206 + // A source/named segment at the start of a line gives position at that genColumn
  207 + if (index === 0)
  208 + return false;
  209 + const prev = line[index - 1];
  210 + // If the previous segment is sourceless, then we're transitioning to a source.
  211 + if (prev.length === 1)
  212 + return false;
  213 + // If the previous segment maps to the exact same source position, then this segment doesn't
  214 + // provide any new position information.
  215 + return (sourcesIndex === prev[SOURCES_INDEX] &&
  216 + sourceLine === prev[SOURCE_LINE] &&
  217 + sourceColumn === prev[SOURCE_COLUMN] &&
  218 + namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
  219 +}
  220 +function addMappingInternal(skipable, map, mapping) {
  221 + const { generated, source, original, name, content } = mapping;
  222 + if (!source) {
  223 + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null);
  224 + }
  225 + const s = source;
  226 + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content);
  227 +}
  228 +
  229 +export { GenMapping, addMapping, addSegment, allMappings, fromMap, maybeAddMapping, maybeAddSegment, setSourceContent, toDecodedMap, toEncodedMap };
  230 +//# sourceMappingURL=gen-mapping.mjs.map
  1 +{"version":3,"file":"gen-mapping.mjs","sources":["../src/sourcemap-segment.ts","../src/gen-mapping.ts"],"sourcesContent":["type GeneratedColumn = number;\ntype SourcesIndex = number;\ntype SourceLine = number;\ntype SourceColumn = number;\ntype NamesIndex = number;\n\nexport type SourceMapSegment =\n | [GeneratedColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];\n\nexport const COLUMN = 0;\nexport const SOURCES_INDEX = 1;\nexport const SOURCE_LINE = 2;\nexport const SOURCE_COLUMN = 3;\nexport const NAMES_INDEX = 4;\n","import { SetArray, put } from '@jridgewell/set-array';\nimport { encode } from '@jridgewell/sourcemap-codec';\nimport { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';\n\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n} from './sourcemap-segment';\n\nimport type { SourceMapInput } from '@jridgewell/trace-mapping';\nimport type { SourceMapSegment } from './sourcemap-segment';\nimport type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';\n\nexport type { DecodedSourceMap, EncodedSourceMap, Mapping };\n\nexport type Options = {\n file?: string | null;\n sourceRoot?: string | null;\n};\n\nconst NO_NAME = -1;\n\n/**\n * A low-level API to associate a generated position with an original source position. Line and\n * column here are 0-based, unlike `addMapping`.\n */\nexport let addSegment: {\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source?: null,\n sourceLine?: null,\n sourceColumn?: null,\n name?: null,\n content?: null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name?: null,\n content?: string | null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name: string,\n content?: string | null,\n ): void;\n};\n\n/**\n * A high-level API to associate a generated position with an original source position. Line is\n * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.\n */\nexport let addMapping: {\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source?: null;\n original?: null;\n name?: null;\n content?: null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name?: null;\n content?: string | null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name: string;\n content?: string | null;\n },\n ): void;\n};\n\n/**\n * Same as `addSegment`, but will only add the segment if it generates useful information in the\n * resulting map. This only works correctly if segments are added **in order**, meaning you should\n * not add a segment with a lower generated line/column than one that came before.\n */\nexport let maybeAddSegment: typeof addSegment;\n\n/**\n * Same as `addMapping`, but will only add the mapping if it generates useful information in the\n * resulting map. This only works correctly if mappings are added **in order**, meaning you should\n * not add a mapping with a lower generated line/column than one that came before.\n */\nexport let maybeAddMapping: typeof addMapping;\n\n/**\n * Adds/removes the content of the source file to the source map.\n */\nexport let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;\n\n/**\n * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toDecodedMap: (map: GenMapping) => DecodedSourceMap;\n\n/**\n * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toEncodedMap: (map: GenMapping) => EncodedSourceMap;\n\n/**\n * Constructs a new GenMapping, using the already present mappings of the input.\n */\nexport let fromMap: (input: SourceMapInput) => GenMapping;\n\n/**\n * Returns an array of high-level mapping objects for every recorded segment, which could then be\n * passed to the `source-map` library.\n */\nexport let allMappings: (map: GenMapping) => Mapping[];\n\n// This split declaration is only so that terser can elminiate the static initialization block.\nlet addSegmentInternal: <S extends string | null | undefined>(\n skipable: boolean,\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: S,\n sourceLine: S extends string ? number : null | undefined,\n sourceColumn: S extends string ? number : null | undefined,\n name: S extends string ? string | null | undefined : null | undefined,\n content: S extends string ? string | null | undefined : null | undefined,\n) => void;\n\n/**\n * Provides the state to generate a sourcemap.\n */\nexport class GenMapping {\n private _names = new SetArray();\n private _sources = new SetArray();\n private _sourcesContent: (string | null)[] = [];\n private _mappings: SourceMapSegment[][] = [];\n declare file: string | null | undefined;\n declare sourceRoot: string | null | undefined;\n\n constructor({ file, sourceRoot }: Options = {}) {\n this.file = file;\n this.sourceRoot = sourceRoot;\n }\n\n static {\n addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {\n return addSegmentInternal(\n false,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n maybeAddSegment = (\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n return addSegmentInternal(\n true,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n addMapping = (map, mapping) => {\n return addMappingInternal(false, map, mapping as Parameters<typeof addMappingInternal>[2]);\n };\n\n maybeAddMapping = (map, mapping) => {\n return addMappingInternal(true, map, mapping as Parameters<typeof addMappingInternal>[2]);\n };\n\n setSourceContent = (map, source, content) => {\n const { _sources: sources, _sourcesContent: sourcesContent } = map;\n sourcesContent[put(sources, source)] = content;\n };\n\n toDecodedMap = (map) => {\n const {\n file,\n sourceRoot,\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n removeEmptyFinalLines(mappings);\n\n return {\n version: 3,\n file: file || undefined,\n names: names.array,\n sourceRoot: sourceRoot || undefined,\n sources: sources.array,\n sourcesContent,\n mappings,\n };\n };\n\n toEncodedMap = (map) => {\n const decoded = toDecodedMap(map);\n return {\n ...decoded,\n mappings: encode(decoded.mappings as SourceMapSegment[][]),\n };\n };\n\n allMappings = (map) => {\n const out: Mapping[] = [];\n const { _mappings: mappings, _sources: sources, _names: names } = map;\n\n for (let i = 0; i < mappings.length; i++) {\n const line = mappings[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n\n const generated = { line: i + 1, column: seg[COLUMN] };\n let source: string | undefined = undefined;\n let original: Pos | undefined = undefined;\n let name: string | undefined = undefined;\n\n if (seg.length !== 1) {\n source = sources.array[seg[SOURCES_INDEX]];\n original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };\n\n if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];\n }\n\n out.push({ generated, source, original, name } as Mapping);\n }\n }\n\n return out;\n };\n\n fromMap = (input) => {\n const map = new TraceMap(input);\n const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });\n\n putAll(gen._names, map.names);\n putAll(gen._sources, map.sources as string[]);\n gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);\n gen._mappings = decodedMappings(map) as GenMapping['_mappings'];\n\n return gen;\n };\n\n // Internal helpers\n addSegmentInternal = (\n skipable,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n const {\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n const line = getLine(mappings, genLine);\n const index = getColumnIndex(line, genColumn);\n\n if (!source) {\n if (skipable && skipSourceless(line, index)) return;\n return insert(line, index, [genColumn]);\n }\n\n // Sigh, TypeScript can't figure out sourceLine and sourceColumn aren't nullish if source\n // isn't nullish.\n assert<number>(sourceLine);\n assert<number>(sourceColumn);\n\n const sourcesIndex = put(sources, source);\n const namesIndex = name ? put(names, name) : NO_NAME;\n if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content ?? null;\n\n if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {\n return;\n }\n\n return insert(\n line,\n index,\n name\n ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]\n : [genColumn, sourcesIndex, sourceLine, sourceColumn],\n );\n };\n }\n}\n\nfunction assert<T>(_val: unknown): asserts _val is T {\n // noop.\n}\n\nfunction getLine(mappings: SourceMapSegment[][], index: number): SourceMapSegment[] {\n for (let i = mappings.length; i <= index; i++) {\n mappings[i] = [];\n }\n return mappings[index];\n}\n\nfunction getColumnIndex(line: SourceMapSegment[], genColumn: number): number {\n let index = line.length;\n for (let i = index - 1; i >= 0; index = i--) {\n const current = line[i];\n if (genColumn >= current[COLUMN]) break;\n }\n return index;\n}\n\nfunction insert<T>(array: T[], index: number, value: T) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\n\nfunction removeEmptyFinalLines(mappings: SourceMapSegment[][]) {\n const { length } = mappings;\n let len = length;\n for (let i = len - 1; i >= 0; len = i, i--) {\n if (mappings[i].length > 0) break;\n }\n if (len < length) mappings.length = len;\n}\n\nfunction putAll(strarr: SetArray, array: string[]) {\n for (let i = 0; i < array.length; i++) put(strarr, array[i]);\n}\n\nfunction skipSourceless(line: SourceMapSegment[], index: number): boolean {\n // The start of a line is already sourceless, so adding a sourceless segment to the beginning\n // doesn't generate any useful information.\n if (index === 0) return true;\n\n const prev = line[index - 1];\n // If the previous segment is also sourceless, then adding another sourceless segment doesn't\n // genrate any new information. Else, this segment will end the source/named segment and point to\n // a sourceless position, which is useful.\n return prev.length === 1;\n}\n\nfunction skipSource(\n line: SourceMapSegment[],\n index: number,\n sourcesIndex: number,\n sourceLine: number,\n sourceColumn: number,\n namesIndex: number,\n): boolean {\n // A source/named segment at the start of a line gives position at that genColumn\n if (index === 0) return false;\n\n const prev = line[index - 1];\n\n // If the previous segment is sourceless, then we're transitioning to a source.\n if (prev.length === 1) return false;\n\n // If the previous segment maps to the exact same source position, then this segment doesn't\n // provide any new position information.\n return (\n sourcesIndex === prev[SOURCES_INDEX] &&\n sourceLine === prev[SOURCE_LINE] &&\n sourceColumn === prev[SOURCE_COLUMN] &&\n namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)\n );\n}\n\nfunction addMappingInternal<S extends string | null | undefined>(\n skipable: boolean,\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: S;\n original: S extends string ? Pos : null | undefined;\n name: S extends string ? string | null | undefined : null | undefined;\n content: S extends string ? string | null | undefined : null | undefined;\n },\n) {\n const { generated, source, original, name, content } = mapping;\n if (!source) {\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n null,\n null,\n null,\n null,\n null,\n );\n }\n const s: string = source;\n assert<Pos>(original);\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n s,\n original.line - 1,\n original.column,\n name,\n content,\n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AI,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,EAChE;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,QAAiB,EACjB,GAAe,EACf,OAMC,EAAA;AAED,IAAA,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC/D,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,kBAAkB,CACvB,QAAQ,EACR,GAAG,EACH,SAAS,CAAC,IAAI,GAAG,CAAC,EAClB,SAAS,CAAC,MAAM,EAChB,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,CACL,CAAC;AACH,KAAA;IACD,MAAM,CAAC,GAAW,MAAM,CAAC;AAEzB,IAAA,OAAO,kBAAkB,CACvB,QAAQ,EACR,GAAG,EACH,SAAS,CAAC,IAAI,GAAG,CAAC,EAClB,SAAS,CAAC,MAAM,EAChB,CAAC,EACD,QAAQ,CAAC,IAAI,GAAG,CAAC,EACjB,QAAQ,CAAC,MAAM,EACf,IAAI,EACJ,OAAO,CACR,CAAC;AACJ;;;;"}
  1 +(function (global, factory) {
  2 + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jridgewell/set-array'), require('@jridgewell/sourcemap-codec'), require('@jridgewell/trace-mapping')) :
  3 + typeof define === 'function' && define.amd ? define(['exports', '@jridgewell/set-array', '@jridgewell/sourcemap-codec', '@jridgewell/trace-mapping'], factory) :
  4 + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.genMapping = {}, global.setArray, global.sourcemapCodec, global.traceMapping));
  5 +})(this, (function (exports, setArray, sourcemapCodec, traceMapping) { 'use strict';
  6 +
  7 + const COLUMN = 0;
  8 + const SOURCES_INDEX = 1;
  9 + const SOURCE_LINE = 2;
  10 + const SOURCE_COLUMN = 3;
  11 + const NAMES_INDEX = 4;
  12 +
  13 + const NO_NAME = -1;
  14 + /**
  15 + * A low-level API to associate a generated position with an original source position. Line and
  16 + * column here are 0-based, unlike `addMapping`.
  17 + */
  18 + exports.addSegment = void 0;
  19 + /**
  20 + * A high-level API to associate a generated position with an original source position. Line is
  21 + * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
  22 + */
  23 + exports.addMapping = void 0;
  24 + /**
  25 + * Same as `addSegment`, but will only add the segment if it generates useful information in the
  26 + * resulting map. This only works correctly if segments are added **in order**, meaning you should
  27 + * not add a segment with a lower generated line/column than one that came before.
  28 + */
  29 + exports.maybeAddSegment = void 0;
  30 + /**
  31 + * Same as `addMapping`, but will only add the mapping if it generates useful information in the
  32 + * resulting map. This only works correctly if mappings are added **in order**, meaning you should
  33 + * not add a mapping with a lower generated line/column than one that came before.
  34 + */
  35 + exports.maybeAddMapping = void 0;
  36 + /**
  37 + * Adds/removes the content of the source file to the source map.
  38 + */
  39 + exports.setSourceContent = void 0;
  40 + /**
  41 + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
  42 + * a sourcemap, or to JSON.stringify.
  43 + */
  44 + exports.toDecodedMap = void 0;
  45 + /**
  46 + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
  47 + * a sourcemap, or to JSON.stringify.
  48 + */
  49 + exports.toEncodedMap = void 0;
  50 + /**
  51 + * Constructs a new GenMapping, using the already present mappings of the input.
  52 + */
  53 + exports.fromMap = void 0;
  54 + /**
  55 + * Returns an array of high-level mapping objects for every recorded segment, which could then be
  56 + * passed to the `source-map` library.
  57 + */
  58 + exports.allMappings = void 0;
  59 + // This split declaration is only so that terser can elminiate the static initialization block.
  60 + let addSegmentInternal;
  61 + /**
  62 + * Provides the state to generate a sourcemap.
  63 + */
  64 + class GenMapping {
  65 + constructor({ file, sourceRoot } = {}) {
  66 + this._names = new setArray.SetArray();
  67 + this._sources = new setArray.SetArray();
  68 + this._sourcesContent = [];
  69 + this._mappings = [];
  70 + this.file = file;
  71 + this.sourceRoot = sourceRoot;
  72 + }
  73 + }
  74 + (() => {
  75 + exports.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  76 + return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
  77 + };
  78 + exports.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  79 + return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
  80 + };
  81 + exports.addMapping = (map, mapping) => {
  82 + return addMappingInternal(false, map, mapping);
  83 + };
  84 + exports.maybeAddMapping = (map, mapping) => {
  85 + return addMappingInternal(true, map, mapping);
  86 + };
  87 + exports.setSourceContent = (map, source, content) => {
  88 + const { _sources: sources, _sourcesContent: sourcesContent } = map;
  89 + sourcesContent[setArray.put(sources, source)] = content;
  90 + };
  91 + exports.toDecodedMap = (map) => {
  92 + const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
  93 + removeEmptyFinalLines(mappings);
  94 + return {
  95 + version: 3,
  96 + file: file || undefined,
  97 + names: names.array,
  98 + sourceRoot: sourceRoot || undefined,
  99 + sources: sources.array,
  100 + sourcesContent,
  101 + mappings,
  102 + };
  103 + };
  104 + exports.toEncodedMap = (map) => {
  105 + const decoded = exports.toDecodedMap(map);
  106 + return Object.assign(Object.assign({}, decoded), { mappings: sourcemapCodec.encode(decoded.mappings) });
  107 + };
  108 + exports.allMappings = (map) => {
  109 + const out = [];
  110 + const { _mappings: mappings, _sources: sources, _names: names } = map;
  111 + for (let i = 0; i < mappings.length; i++) {
  112 + const line = mappings[i];
  113 + for (let j = 0; j < line.length; j++) {
  114 + const seg = line[j];
  115 + const generated = { line: i + 1, column: seg[COLUMN] };
  116 + let source = undefined;
  117 + let original = undefined;
  118 + let name = undefined;
  119 + if (seg.length !== 1) {
  120 + source = sources.array[seg[SOURCES_INDEX]];
  121 + original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
  122 + if (seg.length === 5)
  123 + name = names.array[seg[NAMES_INDEX]];
  124 + }
  125 + out.push({ generated, source, original, name });
  126 + }
  127 + }
  128 + return out;
  129 + };
  130 + exports.fromMap = (input) => {
  131 + const map = new traceMapping.TraceMap(input);
  132 + const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });
  133 + putAll(gen._names, map.names);
  134 + putAll(gen._sources, map.sources);
  135 + gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);
  136 + gen._mappings = traceMapping.decodedMappings(map);
  137 + return gen;
  138 + };
  139 + // Internal helpers
  140 + addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  141 + const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
  142 + const line = getLine(mappings, genLine);
  143 + const index = getColumnIndex(line, genColumn);
  144 + if (!source) {
  145 + if (skipable && skipSourceless(line, index))
  146 + return;
  147 + return insert(line, index, [genColumn]);
  148 + }
  149 + const sourcesIndex = setArray.put(sources, source);
  150 + const namesIndex = name ? setArray.put(names, name) : NO_NAME;
  151 + if (sourcesIndex === sourcesContent.length)
  152 + sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
  153 + if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
  154 + return;
  155 + }
  156 + return insert(line, index, name
  157 + ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
  158 + : [genColumn, sourcesIndex, sourceLine, sourceColumn]);
  159 + };
  160 + })();
  161 + function getLine(mappings, index) {
  162 + for (let i = mappings.length; i <= index; i++) {
  163 + mappings[i] = [];
  164 + }
  165 + return mappings[index];
  166 + }
  167 + function getColumnIndex(line, genColumn) {
  168 + let index = line.length;
  169 + for (let i = index - 1; i >= 0; index = i--) {
  170 + const current = line[i];
  171 + if (genColumn >= current[COLUMN])
  172 + break;
  173 + }
  174 + return index;
  175 + }
  176 + function insert(array, index, value) {
  177 + for (let i = array.length; i > index; i--) {
  178 + array[i] = array[i - 1];
  179 + }
  180 + array[index] = value;
  181 + }
  182 + function removeEmptyFinalLines(mappings) {
  183 + const { length } = mappings;
  184 + let len = length;
  185 + for (let i = len - 1; i >= 0; len = i, i--) {
  186 + if (mappings[i].length > 0)
  187 + break;
  188 + }
  189 + if (len < length)
  190 + mappings.length = len;
  191 + }
  192 + function putAll(strarr, array) {
  193 + for (let i = 0; i < array.length; i++)
  194 + setArray.put(strarr, array[i]);
  195 + }
  196 + function skipSourceless(line, index) {
  197 + // The start of a line is already sourceless, so adding a sourceless segment to the beginning
  198 + // doesn't generate any useful information.
  199 + if (index === 0)
  200 + return true;
  201 + const prev = line[index - 1];
  202 + // If the previous segment is also sourceless, then adding another sourceless segment doesn't
  203 + // genrate any new information. Else, this segment will end the source/named segment and point to
  204 + // a sourceless position, which is useful.
  205 + return prev.length === 1;
  206 + }
  207 + function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
  208 + // A source/named segment at the start of a line gives position at that genColumn
  209 + if (index === 0)
  210 + return false;
  211 + const prev = line[index - 1];
  212 + // If the previous segment is sourceless, then we're transitioning to a source.
  213 + if (prev.length === 1)
  214 + return false;
  215 + // If the previous segment maps to the exact same source position, then this segment doesn't
  216 + // provide any new position information.
  217 + return (sourcesIndex === prev[SOURCES_INDEX] &&
  218 + sourceLine === prev[SOURCE_LINE] &&
  219 + sourceColumn === prev[SOURCE_COLUMN] &&
  220 + namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
  221 + }
  222 + function addMappingInternal(skipable, map, mapping) {
  223 + const { generated, source, original, name, content } = mapping;
  224 + if (!source) {
  225 + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null);
  226 + }
  227 + const s = source;
  228 + return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content);
  229 + }
  230 +
  231 + exports.GenMapping = GenMapping;
  232 +
  233 + Object.defineProperty(exports, '__esModule', { value: true });
  234 +
  235 +}));
  236 +//# sourceMappingURL=gen-mapping.umd.js.map
  1 +{"version":3,"file":"gen-mapping.umd.js","sources":["../src/sourcemap-segment.ts","../src/gen-mapping.ts"],"sourcesContent":["type GeneratedColumn = number;\ntype SourcesIndex = number;\ntype SourceLine = number;\ntype SourceColumn = number;\ntype NamesIndex = number;\n\nexport type SourceMapSegment =\n | [GeneratedColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]\n | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];\n\nexport const COLUMN = 0;\nexport const SOURCES_INDEX = 1;\nexport const SOURCE_LINE = 2;\nexport const SOURCE_COLUMN = 3;\nexport const NAMES_INDEX = 4;\n","import { SetArray, put } from '@jridgewell/set-array';\nimport { encode } from '@jridgewell/sourcemap-codec';\nimport { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';\n\nimport {\n COLUMN,\n SOURCES_INDEX,\n SOURCE_LINE,\n SOURCE_COLUMN,\n NAMES_INDEX,\n} from './sourcemap-segment';\n\nimport type { SourceMapInput } from '@jridgewell/trace-mapping';\nimport type { SourceMapSegment } from './sourcemap-segment';\nimport type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';\n\nexport type { DecodedSourceMap, EncodedSourceMap, Mapping };\n\nexport type Options = {\n file?: string | null;\n sourceRoot?: string | null;\n};\n\nconst NO_NAME = -1;\n\n/**\n * A low-level API to associate a generated position with an original source position. Line and\n * column here are 0-based, unlike `addMapping`.\n */\nexport let addSegment: {\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source?: null,\n sourceLine?: null,\n sourceColumn?: null,\n name?: null,\n content?: null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name?: null,\n content?: string | null,\n ): void;\n (\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: string,\n sourceLine: number,\n sourceColumn: number,\n name: string,\n content?: string | null,\n ): void;\n};\n\n/**\n * A high-level API to associate a generated position with an original source position. Line is\n * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.\n */\nexport let addMapping: {\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source?: null;\n original?: null;\n name?: null;\n content?: null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name?: null;\n content?: string | null;\n },\n ): void;\n (\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: string;\n original: Pos;\n name: string;\n content?: string | null;\n },\n ): void;\n};\n\n/**\n * Same as `addSegment`, but will only add the segment if it generates useful information in the\n * resulting map. This only works correctly if segments are added **in order**, meaning you should\n * not add a segment with a lower generated line/column than one that came before.\n */\nexport let maybeAddSegment: typeof addSegment;\n\n/**\n * Same as `addMapping`, but will only add the mapping if it generates useful information in the\n * resulting map. This only works correctly if mappings are added **in order**, meaning you should\n * not add a mapping with a lower generated line/column than one that came before.\n */\nexport let maybeAddMapping: typeof addMapping;\n\n/**\n * Adds/removes the content of the source file to the source map.\n */\nexport let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;\n\n/**\n * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toDecodedMap: (map: GenMapping) => DecodedSourceMap;\n\n/**\n * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects\n * a sourcemap, or to JSON.stringify.\n */\nexport let toEncodedMap: (map: GenMapping) => EncodedSourceMap;\n\n/**\n * Constructs a new GenMapping, using the already present mappings of the input.\n */\nexport let fromMap: (input: SourceMapInput) => GenMapping;\n\n/**\n * Returns an array of high-level mapping objects for every recorded segment, which could then be\n * passed to the `source-map` library.\n */\nexport let allMappings: (map: GenMapping) => Mapping[];\n\n// This split declaration is only so that terser can elminiate the static initialization block.\nlet addSegmentInternal: <S extends string | null | undefined>(\n skipable: boolean,\n map: GenMapping,\n genLine: number,\n genColumn: number,\n source: S,\n sourceLine: S extends string ? number : null | undefined,\n sourceColumn: S extends string ? number : null | undefined,\n name: S extends string ? string | null | undefined : null | undefined,\n content: S extends string ? string | null | undefined : null | undefined,\n) => void;\n\n/**\n * Provides the state to generate a sourcemap.\n */\nexport class GenMapping {\n private _names = new SetArray();\n private _sources = new SetArray();\n private _sourcesContent: (string | null)[] = [];\n private _mappings: SourceMapSegment[][] = [];\n declare file: string | null | undefined;\n declare sourceRoot: string | null | undefined;\n\n constructor({ file, sourceRoot }: Options = {}) {\n this.file = file;\n this.sourceRoot = sourceRoot;\n }\n\n static {\n addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {\n return addSegmentInternal(\n false,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n maybeAddSegment = (\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n return addSegmentInternal(\n true,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n );\n };\n\n addMapping = (map, mapping) => {\n return addMappingInternal(false, map, mapping as Parameters<typeof addMappingInternal>[2]);\n };\n\n maybeAddMapping = (map, mapping) => {\n return addMappingInternal(true, map, mapping as Parameters<typeof addMappingInternal>[2]);\n };\n\n setSourceContent = (map, source, content) => {\n const { _sources: sources, _sourcesContent: sourcesContent } = map;\n sourcesContent[put(sources, source)] = content;\n };\n\n toDecodedMap = (map) => {\n const {\n file,\n sourceRoot,\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n removeEmptyFinalLines(mappings);\n\n return {\n version: 3,\n file: file || undefined,\n names: names.array,\n sourceRoot: sourceRoot || undefined,\n sources: sources.array,\n sourcesContent,\n mappings,\n };\n };\n\n toEncodedMap = (map) => {\n const decoded = toDecodedMap(map);\n return {\n ...decoded,\n mappings: encode(decoded.mappings as SourceMapSegment[][]),\n };\n };\n\n allMappings = (map) => {\n const out: Mapping[] = [];\n const { _mappings: mappings, _sources: sources, _names: names } = map;\n\n for (let i = 0; i < mappings.length; i++) {\n const line = mappings[i];\n for (let j = 0; j < line.length; j++) {\n const seg = line[j];\n\n const generated = { line: i + 1, column: seg[COLUMN] };\n let source: string | undefined = undefined;\n let original: Pos | undefined = undefined;\n let name: string | undefined = undefined;\n\n if (seg.length !== 1) {\n source = sources.array[seg[SOURCES_INDEX]];\n original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };\n\n if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];\n }\n\n out.push({ generated, source, original, name } as Mapping);\n }\n }\n\n return out;\n };\n\n fromMap = (input) => {\n const map = new TraceMap(input);\n const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });\n\n putAll(gen._names, map.names);\n putAll(gen._sources, map.sources as string[]);\n gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);\n gen._mappings = decodedMappings(map) as GenMapping['_mappings'];\n\n return gen;\n };\n\n // Internal helpers\n addSegmentInternal = (\n skipable,\n map,\n genLine,\n genColumn,\n source,\n sourceLine,\n sourceColumn,\n name,\n content,\n ) => {\n const {\n _mappings: mappings,\n _sources: sources,\n _sourcesContent: sourcesContent,\n _names: names,\n } = map;\n const line = getLine(mappings, genLine);\n const index = getColumnIndex(line, genColumn);\n\n if (!source) {\n if (skipable && skipSourceless(line, index)) return;\n return insert(line, index, [genColumn]);\n }\n\n // Sigh, TypeScript can't figure out sourceLine and sourceColumn aren't nullish if source\n // isn't nullish.\n assert<number>(sourceLine);\n assert<number>(sourceColumn);\n\n const sourcesIndex = put(sources, source);\n const namesIndex = name ? put(names, name) : NO_NAME;\n if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content ?? null;\n\n if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {\n return;\n }\n\n return insert(\n line,\n index,\n name\n ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]\n : [genColumn, sourcesIndex, sourceLine, sourceColumn],\n );\n };\n }\n}\n\nfunction assert<T>(_val: unknown): asserts _val is T {\n // noop.\n}\n\nfunction getLine(mappings: SourceMapSegment[][], index: number): SourceMapSegment[] {\n for (let i = mappings.length; i <= index; i++) {\n mappings[i] = [];\n }\n return mappings[index];\n}\n\nfunction getColumnIndex(line: SourceMapSegment[], genColumn: number): number {\n let index = line.length;\n for (let i = index - 1; i >= 0; index = i--) {\n const current = line[i];\n if (genColumn >= current[COLUMN]) break;\n }\n return index;\n}\n\nfunction insert<T>(array: T[], index: number, value: T) {\n for (let i = array.length; i > index; i--) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n}\n\nfunction removeEmptyFinalLines(mappings: SourceMapSegment[][]) {\n const { length } = mappings;\n let len = length;\n for (let i = len - 1; i >= 0; len = i, i--) {\n if (mappings[i].length > 0) break;\n }\n if (len < length) mappings.length = len;\n}\n\nfunction putAll(strarr: SetArray, array: string[]) {\n for (let i = 0; i < array.length; i++) put(strarr, array[i]);\n}\n\nfunction skipSourceless(line: SourceMapSegment[], index: number): boolean {\n // The start of a line is already sourceless, so adding a sourceless segment to the beginning\n // doesn't generate any useful information.\n if (index === 0) return true;\n\n const prev = line[index - 1];\n // If the previous segment is also sourceless, then adding another sourceless segment doesn't\n // genrate any new information. Else, this segment will end the source/named segment and point to\n // a sourceless position, which is useful.\n return prev.length === 1;\n}\n\nfunction skipSource(\n line: SourceMapSegment[],\n index: number,\n sourcesIndex: number,\n sourceLine: number,\n sourceColumn: number,\n namesIndex: number,\n): boolean {\n // A source/named segment at the start of a line gives position at that genColumn\n if (index === 0) return false;\n\n const prev = line[index - 1];\n\n // If the previous segment is sourceless, then we're transitioning to a source.\n if (prev.length === 1) return false;\n\n // If the previous segment maps to the exact same source position, then this segment doesn't\n // provide any new position information.\n return (\n sourcesIndex === prev[SOURCES_INDEX] &&\n sourceLine === prev[SOURCE_LINE] &&\n sourceColumn === prev[SOURCE_COLUMN] &&\n namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)\n );\n}\n\nfunction addMappingInternal<S extends string | null | undefined>(\n skipable: boolean,\n map: GenMapping,\n mapping: {\n generated: Pos;\n source: S;\n original: S extends string ? Pos : null | undefined;\n name: S extends string ? string | null | undefined : null | undefined;\n content: S extends string ? string | null | undefined : null | undefined;\n },\n) {\n const { generated, source, original, name, content } = mapping;\n if (!source) {\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n null,\n null,\n null,\n null,\n null,\n );\n }\n const s: string = source;\n assert<Pos>(original);\n return addSegmentInternal(\n skipable,\n map,\n generated.line - 1,\n generated.column,\n s,\n original.line - 1,\n original.column,\n name,\n content,\n );\n}\n"],"names":["addSegment","addMapping","maybeAddSegment","maybeAddMapping","setSourceContent","toDecodedMap","toEncodedMap","fromMap","allMappings","SetArray","put","encode","TraceMap","decodedMappings"],"mappings":";;;;;;IAWO,MAAM,MAAM,GAAG,CAAC,CAAC;IACjB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC;IACtB,MAAM,aAAa,GAAG,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,CAAC;;ICQ5B,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC;IAEnB;;;IAGG;AACQA,gCA+BT;IAEF;;;IAGG;AACQC,gCA+BT;IAEF;;;;IAIG;AACQC,qCAAmC;IAE9C;;;;IAIG;AACQC,qCAAmC;IAE9C;;IAEG;AACQC,sCAAoF;IAE/F;;;IAGG;AACQC,kCAAoD;IAE/D;;;IAGG;AACQC,kCAAoD;IAE/D;;IAEG;AACQC,6BAA+C;IAE1D;;;IAGG;AACQC,iCAA4C;IAEvD;IACA,IAAI,kBAUK,CAAC;IAEV;;IAEG;UACU,UAAU,CAAA;IAQrB,IAAA,WAAA,CAAY,EAAE,IAAI,EAAE,UAAU,KAAc,EAAE,EAAA;IAPtC,QAAA,IAAA,CAAA,MAAM,GAAG,IAAIC,iBAAQ,EAAE,CAAC;IACxB,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAIA,iBAAQ,EAAE,CAAC;YAC1B,IAAe,CAAA,eAAA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from './types';
  3 +export type { DecodedSourceMap, EncodedSourceMap, Mapping };
  4 +export declare type Options = {
  5 + file?: string | null;
  6 + sourceRoot?: string | null;
  7 +};
  8 +/**
  9 + * A low-level API to associate a generated position with an original source position. Line and
  10 + * column here are 0-based, unlike `addMapping`.
  11 + */
  12 +export declare let addSegment: {
  13 + (map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void;
  14 + (map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void;
  15 + (map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void;
  16 +};
  17 +/**
  18 + * A high-level API to associate a generated position with an original source position. Line is
  19 + * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
  20 + */
  21 +export declare let addMapping: {
  22 + (map: GenMapping, mapping: {
  23 + generated: Pos;
  24 + source?: null;
  25 + original?: null;
  26 + name?: null;
  27 + content?: null;
  28 + }): void;
  29 + (map: GenMapping, mapping: {
  30 + generated: Pos;
  31 + source: string;
  32 + original: Pos;
  33 + name?: null;
  34 + content?: string | null;
  35 + }): void;
  36 + (map: GenMapping, mapping: {
  37 + generated: Pos;
  38 + source: string;
  39 + original: Pos;
  40 + name: string;
  41 + content?: string | null;
  42 + }): void;
  43 +};
  44 +/**
  45 + * Same as `addSegment`, but will only add the segment if it generates useful information in the
  46 + * resulting map. This only works correctly if segments are added **in order**, meaning you should
  47 + * not add a segment with a lower generated line/column than one that came before.
  48 + */
  49 +export declare let maybeAddSegment: typeof addSegment;
  50 +/**
  51 + * Same as `addMapping`, but will only add the mapping if it generates useful information in the
  52 + * resulting map. This only works correctly if mappings are added **in order**, meaning you should
  53 + * not add a mapping with a lower generated line/column than one that came before.
  54 + */
  55 +export declare let maybeAddMapping: typeof addMapping;
  56 +/**
  57 + * Adds/removes the content of the source file to the source map.
  58 + */
  59 +export declare let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;
  60 +/**
  61 + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
  62 + * a sourcemap, or to JSON.stringify.
  63 + */
  64 +export declare let toDecodedMap: (map: GenMapping) => DecodedSourceMap;
  65 +/**
  66 + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
  67 + * a sourcemap, or to JSON.stringify.
  68 + */
  69 +export declare let toEncodedMap: (map: GenMapping) => EncodedSourceMap;
  70 +/**
  71 + * Constructs a new GenMapping, using the already present mappings of the input.
  72 + */
  73 +export declare let fromMap: (input: SourceMapInput) => GenMapping;
  74 +/**
  75 + * Returns an array of high-level mapping objects for every recorded segment, which could then be
  76 + * passed to the `source-map` library.
  77 + */
  78 +export declare let allMappings: (map: GenMapping) => Mapping[];
  79 +/**
  80 + * Provides the state to generate a sourcemap.
  81 + */
  82 +export declare class GenMapping {
  83 + private _names;
  84 + private _sources;
  85 + private _sourcesContent;
  86 + private _mappings;
  87 + file: string | null | undefined;
  88 + sourceRoot: string | null | undefined;
  89 + constructor({ file, sourceRoot }?: Options);
  90 +}
  1 +declare type GeneratedColumn = number;
  2 +declare type SourcesIndex = number;
  3 +declare type SourceLine = number;
  4 +declare type SourceColumn = number;
  5 +declare type NamesIndex = number;
  6 +export declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
  7 +export declare const COLUMN = 0;
  8 +export declare const SOURCES_INDEX = 1;
  9 +export declare const SOURCE_LINE = 2;
  10 +export declare const SOURCE_COLUMN = 3;
  11 +export declare const NAMES_INDEX = 4;
  12 +export {};
  1 +import type { SourceMapSegment } from './sourcemap-segment';
  2 +export interface SourceMapV3 {
  3 + file?: string | null;
  4 + names: readonly string[];
  5 + sourceRoot?: string;
  6 + sources: readonly (string | null)[];
  7 + sourcesContent?: readonly (string | null)[];
  8 + version: 3;
  9 +}
  10 +export interface EncodedSourceMap extends SourceMapV3 {
  11 + mappings: string;
  12 +}
  13 +export interface DecodedSourceMap extends SourceMapV3 {
  14 + mappings: readonly SourceMapSegment[][];
  15 +}
  16 +export interface Pos {
  17 + line: number;
  18 + column: number;
  19 +}
  20 +export declare type Mapping = {
  21 + generated: Pos;
  22 + source: undefined;
  23 + original: undefined;
  24 + name: undefined;
  25 +} | {
  26 + generated: Pos;
  27 + source: string;
  28 + original: Pos;
  29 + name: string;
  30 +} | {
  31 + generated: Pos;
  32 + source: string;
  33 + original: Pos;
  34 + name: undefined;
  35 +};
  1 +{
  2 + "name": "@jridgewell/gen-mapping",
  3 + "version": "0.3.2",
  4 + "description": "Generate source maps",
  5 + "keywords": [
  6 + "source",
  7 + "map"
  8 + ],
  9 + "author": "Justin Ridgewell <justin@ridgewell.name>",
  10 + "license": "MIT",
  11 + "repository": "https://github.com/jridgewell/gen-mapping",
  12 + "main": "dist/gen-mapping.umd.js",
  13 + "module": "dist/gen-mapping.mjs",
  14 + "typings": "dist/types/gen-mapping.d.ts",
  15 + "exports": {
  16 + ".": [
  17 + {
  18 + "types": "./dist/types/gen-mapping.d.ts",
  19 + "browser": "./dist/gen-mapping.umd.js",
  20 + "require": "./dist/gen-mapping.umd.js",
  21 + "import": "./dist/gen-mapping.mjs"
  22 + },
  23 + "./dist/gen-mapping.umd.js"
  24 + ],
  25 + "./package.json": "./package.json"
  26 + },
  27 + "files": [
  28 + "dist",
  29 + "src"
  30 + ],
  31 + "engines": {
  32 + "node": ">=6.0.0"
  33 + },
  34 + "scripts": {
  35 + "benchmark": "run-s build:rollup benchmark:*",
  36 + "benchmark:install": "cd benchmark && npm install",
  37 + "benchmark:only": "node benchmark/index.mjs",
  38 + "prebuild": "rm -rf dist",
  39 + "build": "run-s -n build:*",
  40 + "build:rollup": "rollup -c rollup.config.js",
  41 + "build:ts": "tsc --project tsconfig.build.json",
  42 + "lint": "run-s -n lint:*",
  43 + "lint:prettier": "npm run test:lint:prettier -- --write",
  44 + "lint:ts": "npm run test:lint:ts -- --fix",
  45 + "pretest": "run-s build:rollup",
  46 + "test": "run-s -n test:lint test:coverage",
  47 + "test:debug": "mocha --inspect-brk",
  48 + "test:lint": "run-s -n test:lint:*",
  49 + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
  50 + "test:lint:ts": "eslint '{src,test}/**/*.ts'",
  51 + "test:only": "mocha",
  52 + "test:coverage": "c8 mocha",
  53 + "test:watch": "run-p 'build:rollup -- --watch' 'test:only -- --watch'",
  54 + "prepublishOnly": "npm run preversion",
  55 + "preversion": "run-s test build"
  56 + },
  57 + "devDependencies": {
  58 + "@rollup/plugin-typescript": "8.3.2",
  59 + "@types/mocha": "9.1.1",
  60 + "@types/node": "17.0.29",
  61 + "@typescript-eslint/eslint-plugin": "5.21.0",
  62 + "@typescript-eslint/parser": "5.21.0",
  63 + "benchmark": "2.1.4",
  64 + "c8": "7.11.2",
  65 + "eslint": "8.14.0",
  66 + "eslint-config-prettier": "8.5.0",
  67 + "mocha": "9.2.2",
  68 + "npm-run-all": "4.1.5",
  69 + "prettier": "2.6.2",
  70 + "rollup": "2.70.2",
  71 + "typescript": "4.6.3"
  72 + },
  73 + "dependencies": {
  74 + "@jridgewell/set-array": "^1.0.1",
  75 + "@jridgewell/sourcemap-codec": "^1.4.10",
  76 + "@jridgewell/trace-mapping": "^0.3.9"
  77 + }
  78 +}
  1 +import { SetArray, put } from '@jridgewell/set-array';
  2 +import { encode } from '@jridgewell/sourcemap-codec';
  3 +import { TraceMap, decodedMappings } from '@jridgewell/trace-mapping';
  4 +
  5 +import {
  6 + COLUMN,
  7 + SOURCES_INDEX,
  8 + SOURCE_LINE,
  9 + SOURCE_COLUMN,
  10 + NAMES_INDEX,
  11 +} from './sourcemap-segment';
  12 +
  13 +import type { SourceMapInput } from '@jridgewell/trace-mapping';
  14 +import type { SourceMapSegment } from './sourcemap-segment';
  15 +import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';
  16 +
  17 +export type { DecodedSourceMap, EncodedSourceMap, Mapping };
  18 +
  19 +export type Options = {
  20 + file?: string | null;
  21 + sourceRoot?: string | null;
  22 +};
  23 +
  24 +const NO_NAME = -1;
  25 +
  26 +/**
  27 + * A low-level API to associate a generated position with an original source position. Line and
  28 + * column here are 0-based, unlike `addMapping`.
  29 + */
  30 +export let addSegment: {
  31 + (
  32 + map: GenMapping,
  33 + genLine: number,
  34 + genColumn: number,
  35 + source?: null,
  36 + sourceLine?: null,
  37 + sourceColumn?: null,
  38 + name?: null,
  39 + content?: null,
  40 + ): void;
  41 + (
  42 + map: GenMapping,
  43 + genLine: number,
  44 + genColumn: number,
  45 + source: string,
  46 + sourceLine: number,
  47 + sourceColumn: number,
  48 + name?: null,
  49 + content?: string | null,
  50 + ): void;
  51 + (
  52 + map: GenMapping,
  53 + genLine: number,
  54 + genColumn: number,
  55 + source: string,
  56 + sourceLine: number,
  57 + sourceColumn: number,
  58 + name: string,
  59 + content?: string | null,
  60 + ): void;
  61 +};
  62 +
  63 +/**
  64 + * A high-level API to associate a generated position with an original source position. Line is
  65 + * 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
  66 + */
  67 +export let addMapping: {
  68 + (
  69 + map: GenMapping,
  70 + mapping: {
  71 + generated: Pos;
  72 + source?: null;
  73 + original?: null;
  74 + name?: null;
  75 + content?: null;
  76 + },
  77 + ): void;
  78 + (
  79 + map: GenMapping,
  80 + mapping: {
  81 + generated: Pos;
  82 + source: string;
  83 + original: Pos;
  84 + name?: null;
  85 + content?: string | null;
  86 + },
  87 + ): void;
  88 + (
  89 + map: GenMapping,
  90 + mapping: {
  91 + generated: Pos;
  92 + source: string;
  93 + original: Pos;
  94 + name: string;
  95 + content?: string | null;
  96 + },
  97 + ): void;
  98 +};
  99 +
  100 +/**
  101 + * Same as `addSegment`, but will only add the segment if it generates useful information in the
  102 + * resulting map. This only works correctly if segments are added **in order**, meaning you should
  103 + * not add a segment with a lower generated line/column than one that came before.
  104 + */
  105 +export let maybeAddSegment: typeof addSegment;
  106 +
  107 +/**
  108 + * Same as `addMapping`, but will only add the mapping if it generates useful information in the
  109 + * resulting map. This only works correctly if mappings are added **in order**, meaning you should
  110 + * not add a mapping with a lower generated line/column than one that came before.
  111 + */
  112 +export let maybeAddMapping: typeof addMapping;
  113 +
  114 +/**
  115 + * Adds/removes the content of the source file to the source map.
  116 + */
  117 +export let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;
  118 +
  119 +/**
  120 + * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
  121 + * a sourcemap, or to JSON.stringify.
  122 + */
  123 +export let toDecodedMap: (map: GenMapping) => DecodedSourceMap;
  124 +
  125 +/**
  126 + * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
  127 + * a sourcemap, or to JSON.stringify.
  128 + */
  129 +export let toEncodedMap: (map: GenMapping) => EncodedSourceMap;
  130 +
  131 +/**
  132 + * Constructs a new GenMapping, using the already present mappings of the input.
  133 + */
  134 +export let fromMap: (input: SourceMapInput) => GenMapping;
  135 +
  136 +/**
  137 + * Returns an array of high-level mapping objects for every recorded segment, which could then be
  138 + * passed to the `source-map` library.
  139 + */
  140 +export let allMappings: (map: GenMapping) => Mapping[];
  141 +
  142 +// This split declaration is only so that terser can elminiate the static initialization block.
  143 +let addSegmentInternal: <S extends string | null | undefined>(
  144 + skipable: boolean,
  145 + map: GenMapping,
  146 + genLine: number,
  147 + genColumn: number,
  148 + source: S,
  149 + sourceLine: S extends string ? number : null | undefined,
  150 + sourceColumn: S extends string ? number : null | undefined,
  151 + name: S extends string ? string | null | undefined : null | undefined,
  152 + content: S extends string ? string | null | undefined : null | undefined,
  153 +) => void;
  154 +
  155 +/**
  156 + * Provides the state to generate a sourcemap.
  157 + */
  158 +export class GenMapping {
  159 + private _names = new SetArray();
  160 + private _sources = new SetArray();
  161 + private _sourcesContent: (string | null)[] = [];
  162 + private _mappings: SourceMapSegment[][] = [];
  163 + declare file: string | null | undefined;
  164 + declare sourceRoot: string | null | undefined;
  165 +
  166 + constructor({ file, sourceRoot }: Options = {}) {
  167 + this.file = file;
  168 + this.sourceRoot = sourceRoot;
  169 + }
  170 +
  171 + static {
  172 + addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
  173 + return addSegmentInternal(
  174 + false,
  175 + map,
  176 + genLine,
  177 + genColumn,
  178 + source,
  179 + sourceLine,
  180 + sourceColumn,
  181 + name,
  182 + content,
  183 + );
  184 + };
  185 +
  186 + maybeAddSegment = (
  187 + map,
  188 + genLine,
  189 + genColumn,
  190 + source,
  191 + sourceLine,
  192 + sourceColumn,
  193 + name,
  194 + content,
  195 + ) => {
  196 + return addSegmentInternal(
  197 + true,
  198 + map,
  199 + genLine,
  200 + genColumn,
  201 + source,
  202 + sourceLine,
  203 + sourceColumn,
  204 + name,
  205 + content,
  206 + );
  207 + };
  208 +
  209 + addMapping = (map, mapping) => {
  210 + return addMappingInternal(false, map, mapping as Parameters<typeof addMappingInternal>[2]);
  211 + };
  212 +
  213 + maybeAddMapping = (map, mapping) => {
  214 + return addMappingInternal(true, map, mapping as Parameters<typeof addMappingInternal>[2]);
  215 + };
  216 +
  217 + setSourceContent = (map, source, content) => {
  218 + const { _sources: sources, _sourcesContent: sourcesContent } = map;
  219 + sourcesContent[put(sources, source)] = content;
  220 + };
  221 +
  222 + toDecodedMap = (map) => {
  223 + const {
  224 + file,
  225 + sourceRoot,
  226 + _mappings: mappings,
  227 + _sources: sources,
  228 + _sourcesContent: sourcesContent,
  229 + _names: names,
  230 + } = map;
  231 + removeEmptyFinalLines(mappings);
  232 +
  233 + return {
  234 + version: 3,
  235 + file: file || undefined,
  236 + names: names.array,
  237 + sourceRoot: sourceRoot || undefined,
  238 + sources: sources.array,
  239 + sourcesContent,
  240 + mappings,
  241 + };
  242 + };
  243 +
  244 + toEncodedMap = (map) => {
  245 + const decoded = toDecodedMap(map);
  246 + return {
  247 + ...decoded,
  248 + mappings: encode(decoded.mappings as SourceMapSegment[][]),
  249 + };
  250 + };
  251 +
  252 + allMappings = (map) => {
  253 + const out: Mapping[] = [];
  254 + const { _mappings: mappings, _sources: sources, _names: names } = map;
  255 +
  256 + for (let i = 0; i < mappings.length; i++) {
  257 + const line = mappings[i];
  258 + for (let j = 0; j < line.length; j++) {
  259 + const seg = line[j];
  260 +
  261 + const generated = { line: i + 1, column: seg[COLUMN] };
  262 + let source: string | undefined = undefined;
  263 + let original: Pos | undefined = undefined;
  264 + let name: string | undefined = undefined;
  265 +
  266 + if (seg.length !== 1) {
  267 + source = sources.array[seg[SOURCES_INDEX]];
  268 + original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
  269 +
  270 + if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];
  271 + }
  272 +
  273 + out.push({ generated, source, original, name } as Mapping);
  274 + }
  275 + }
  276 +
  277 + return out;
  278 + };
  279 +
  280 + fromMap = (input) => {
  281 + const map = new TraceMap(input);
  282 + const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });
  283 +
  284 + putAll(gen._names, map.names);
  285 + putAll(gen._sources, map.sources as string[]);
  286 + gen._sourcesContent = map.sourcesContent || map.sources.map(() => null);
  287 + gen._mappings = decodedMappings(map) as GenMapping['_mappings'];
  288 +
  289 + return gen;
  290 + };
  291 +
  292 + // Internal helpers
  293 + addSegmentInternal = (
  294 + skipable,
  295 + map,
  296 + genLine,
  297 + genColumn,
  298 + source,
  299 + sourceLine,
  300 + sourceColumn,
  301 + name,
  302 + content,
  303 + ) => {
  304 + const {
  305 + _mappings: mappings,
  306 + _sources: sources,
  307 + _sourcesContent: sourcesContent,
  308 + _names: names,
  309 + } = map;
  310 + const line = getLine(mappings, genLine);
  311 + const index = getColumnIndex(line, genColumn);
  312 +
  313 + if (!source) {
  314 + if (skipable && skipSourceless(line, index)) return;
  315 + return insert(line, index, [genColumn]);
  316 + }
  317 +
  318 + // Sigh, TypeScript can't figure out sourceLine and sourceColumn aren't nullish if source
  319 + // isn't nullish.
  320 + assert<number>(sourceLine);
  321 + assert<number>(sourceColumn);
  322 +
  323 + const sourcesIndex = put(sources, source);
  324 + const namesIndex = name ? put(names, name) : NO_NAME;
  325 + if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content ?? null;
  326 +
  327 + if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
  328 + return;
  329 + }
  330 +
  331 + return insert(
  332 + line,
  333 + index,
  334 + name
  335 + ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
  336 + : [genColumn, sourcesIndex, sourceLine, sourceColumn],
  337 + );
  338 + };
  339 + }
  340 +}
  341 +
  342 +function assert<T>(_val: unknown): asserts _val is T {
  343 + // noop.
  344 +}
  345 +
  346 +function getLine(mappings: SourceMapSegment[][], index: number): SourceMapSegment[] {
  347 + for (let i = mappings.length; i <= index; i++) {
  348 + mappings[i] = [];
  349 + }
  350 + return mappings[index];
  351 +}
  352 +
  353 +function getColumnIndex(line: SourceMapSegment[], genColumn: number): number {
  354 + let index = line.length;
  355 + for (let i = index - 1; i >= 0; index = i--) {
  356 + const current = line[i];
  357 + if (genColumn >= current[COLUMN]) break;
  358 + }
  359 + return index;
  360 +}
  361 +
  362 +function insert<T>(array: T[], index: number, value: T) {
  363 + for (let i = array.length; i > index; i--) {
  364 + array[i] = array[i - 1];
  365 + }
  366 + array[index] = value;
  367 +}
  368 +
  369 +function removeEmptyFinalLines(mappings: SourceMapSegment[][]) {
  370 + const { length } = mappings;
  371 + let len = length;
  372 + for (let i = len - 1; i >= 0; len = i, i--) {
  373 + if (mappings[i].length > 0) break;
  374 + }
  375 + if (len < length) mappings.length = len;
  376 +}
  377 +
  378 +function putAll(strarr: SetArray, array: string[]) {
  379 + for (let i = 0; i < array.length; i++) put(strarr, array[i]);
  380 +}
  381 +
  382 +function skipSourceless(line: SourceMapSegment[], index: number): boolean {
  383 + // The start of a line is already sourceless, so adding a sourceless segment to the beginning
  384 + // doesn't generate any useful information.
  385 + if (index === 0) return true;
  386 +
  387 + const prev = line[index - 1];
  388 + // If the previous segment is also sourceless, then adding another sourceless segment doesn't
  389 + // genrate any new information. Else, this segment will end the source/named segment and point to
  390 + // a sourceless position, which is useful.
  391 + return prev.length === 1;
  392 +}
  393 +
  394 +function skipSource(
  395 + line: SourceMapSegment[],
  396 + index: number,
  397 + sourcesIndex: number,
  398 + sourceLine: number,
  399 + sourceColumn: number,
  400 + namesIndex: number,
  401 +): boolean {
  402 + // A source/named segment at the start of a line gives position at that genColumn
  403 + if (index === 0) return false;
  404 +
  405 + const prev = line[index - 1];
  406 +
  407 + // If the previous segment is sourceless, then we're transitioning to a source.
  408 + if (prev.length === 1) return false;
  409 +
  410 + // If the previous segment maps to the exact same source position, then this segment doesn't
  411 + // provide any new position information.
  412 + return (
  413 + sourcesIndex === prev[SOURCES_INDEX] &&
  414 + sourceLine === prev[SOURCE_LINE] &&
  415 + sourceColumn === prev[SOURCE_COLUMN] &&
  416 + namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME)
  417 + );
  418 +}
  419 +
  420 +function addMappingInternal<S extends string | null | undefined>(
  421 + skipable: boolean,
  422 + map: GenMapping,
  423 + mapping: {
  424 + generated: Pos;
  425 + source: S;
  426 + original: S extends string ? Pos : null | undefined;
  427 + name: S extends string ? string | null | undefined : null | undefined;
  428 + content: S extends string ? string | null | undefined : null | undefined;
  429 + },
  430 +) {
  431 + const { generated, source, original, name, content } = mapping;
  432 + if (!source) {
  433 + return addSegmentInternal(
  434 + skipable,
  435 + map,
  436 + generated.line - 1,
  437 + generated.column,
  438 + null,
  439 + null,
  440 + null,
  441 + null,
  442 + null,
  443 + );
  444 + }
  445 + const s: string = source;
  446 + assert<Pos>(original);
  447 + return addSegmentInternal(
  448 + skipable,
  449 + map,
  450 + generated.line - 1,
  451 + generated.column,
  452 + s,
  453 + original.line - 1,
  454 + original.column,
  455 + name,
  456 + content,
  457 + );
  458 +}
  1 +type GeneratedColumn = number;
  2 +type SourcesIndex = number;
  3 +type SourceLine = number;
  4 +type SourceColumn = number;
  5 +type NamesIndex = number;
  6 +
  7 +export type SourceMapSegment =
  8 + | [GeneratedColumn]
  9 + | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn]
  10 + | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
  11 +
  12 +export const COLUMN = 0;
  13 +export const SOURCES_INDEX = 1;
  14 +export const SOURCE_LINE = 2;
  15 +export const SOURCE_COLUMN = 3;
  16 +export const NAMES_INDEX = 4;
  1 +import type { SourceMapSegment } from './sourcemap-segment';
  2 +
  3 +export interface SourceMapV3 {
  4 + file?: string | null;
  5 + names: readonly string[];
  6 + sourceRoot?: string;
  7 + sources: readonly (string | null)[];
  8 + sourcesContent?: readonly (string | null)[];
  9 + version: 3;
  10 +}
  11 +
  12 +export interface EncodedSourceMap extends SourceMapV3 {
  13 + mappings: string;
  14 +}
  15 +
  16 +export interface DecodedSourceMap extends SourceMapV3 {
  17 + mappings: readonly SourceMapSegment[][];
  18 +}
  19 +
  20 +export interface Pos {
  21 + line: number;
  22 + column: number;
  23 +}
  24 +
  25 +export type Mapping =
  26 + | {
  27 + generated: Pos;
  28 + source: undefined;
  29 + original: undefined;
  30 + name: undefined;
  31 + }
  32 + | {
  33 + generated: Pos;
  34 + source: string;
  35 + original: Pos;
  36 + name: string;
  37 + }
  38 + | {
  39 + generated: Pos;
  40 + source: string;
  41 + original: Pos;
  42 + name: undefined;
  43 + };
  1 +Copyright 2019 Justin Ridgewell <jridgewell@google.com>
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is
  8 +furnished to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in
  11 +all copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19 +SOFTWARE.
  1 +# @jridgewell/resolve-uri
  2 +
  3 +> Resolve a URI relative to an optional base URI
  4 +
  5 +Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.
  6 +
  7 +## Installation
  8 +
  9 +```sh
  10 +npm install @jridgewell/resolve-uri
  11 +```
  12 +
  13 +## Usage
  14 +
  15 +```typescript
  16 +function resolve(input: string, base?: string): string;
  17 +```
  18 +
  19 +```js
  20 +import resolve from '@jridgewell/resolve-uri';
  21 +
  22 +resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
  23 +```
  24 +
  25 +| Input | Base | Resolution | Explanation |
  26 +|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------|
  27 +| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only |
  28 +| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol |
  29 +| `//example.com` | _rest_ | `//example.com/` | Input is normalized only |
  30 +| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin |
  31 +| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative |
  32 +| `/example` | _rest_ | `/example` | Input is normalized only |
  33 +| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base |
  34 +| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file |
  35 +| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory |
  36 +| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file |
  37 +| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory |
  38 +| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file |
  39 +| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory |
  40 +| `example` | `base/file` | `base/example` | Input is joined with the base without its file |
  1 +// Matches the scheme of a URL, eg "http://"
  2 +const schemeRegex = /^[\w+.-]+:\/\//;
  3 +/**
  4 + * Matches the parts of a URL:
  5 + * 1. Scheme, including ":", guaranteed.
  6 + * 2. User/password, including "@", optional.
  7 + * 3. Host, guaranteed.
  8 + * 4. Port, including ":", optional.
  9 + * 5. Path, including "/", optional.
  10 + * 6. Query, including "?", optional.
  11 + * 7. Hash, including "#", optional.
  12 + */
  13 +const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
  14 +/**
  15 + * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
  16 + * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
  17 + *
  18 + * 1. Host, optional.
  19 + * 2. Path, which may include "/", guaranteed.
  20 + * 3. Query, including "?", optional.
  21 + * 4. Hash, including "#", optional.
  22 + */
  23 +const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
  24 +var UrlType;
  25 +(function (UrlType) {
  26 + UrlType[UrlType["Empty"] = 1] = "Empty";
  27 + UrlType[UrlType["Hash"] = 2] = "Hash";
  28 + UrlType[UrlType["Query"] = 3] = "Query";
  29 + UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
  30 + UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
  31 + UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
  32 + UrlType[UrlType["Absolute"] = 7] = "Absolute";
  33 +})(UrlType || (UrlType = {}));
  34 +function isAbsoluteUrl(input) {
  35 + return schemeRegex.test(input);
  36 +}
  37 +function isSchemeRelativeUrl(input) {
  38 + return input.startsWith('//');
  39 +}
  40 +function isAbsolutePath(input) {
  41 + return input.startsWith('/');
  42 +}
  43 +function isFileUrl(input) {
  44 + return input.startsWith('file:');
  45 +}
  46 +function isRelative(input) {
  47 + return /^[.?#]/.test(input);
  48 +}
  49 +function parseAbsoluteUrl(input) {
  50 + const match = urlRegex.exec(input);
  51 + return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
  52 +}
  53 +function parseFileUrl(input) {
  54 + const match = fileRegex.exec(input);
  55 + const path = match[2];
  56 + return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
  57 +}
  58 +function makeUrl(scheme, user, host, port, path, query, hash) {
  59 + return {
  60 + scheme,
  61 + user,
  62 + host,
  63 + port,
  64 + path,
  65 + query,
  66 + hash,
  67 + type: UrlType.Absolute,
  68 + };
  69 +}
  70 +function parseUrl(input) {
  71 + if (isSchemeRelativeUrl(input)) {
  72 + const url = parseAbsoluteUrl('http:' + input);
  73 + url.scheme = '';
  74 + url.type = UrlType.SchemeRelative;
  75 + return url;
  76 + }
  77 + if (isAbsolutePath(input)) {
  78 + const url = parseAbsoluteUrl('http://foo.com' + input);
  79 + url.scheme = '';
  80 + url.host = '';
  81 + url.type = UrlType.AbsolutePath;
  82 + return url;
  83 + }
  84 + if (isFileUrl(input))
  85 + return parseFileUrl(input);
  86 + if (isAbsoluteUrl(input))
  87 + return parseAbsoluteUrl(input);
  88 + const url = parseAbsoluteUrl('http://foo.com/' + input);
  89 + url.scheme = '';
  90 + url.host = '';
  91 + url.type = input
  92 + ? input.startsWith('?')
  93 + ? UrlType.Query
  94 + : input.startsWith('#')
  95 + ? UrlType.Hash
  96 + : UrlType.RelativePath
  97 + : UrlType.Empty;
  98 + return url;
  99 +}
  100 +function stripPathFilename(path) {
  101 + // If a path ends with a parent directory "..", then it's a relative path with excess parent
  102 + // paths. It's not a file, so we can't strip it.
  103 + if (path.endsWith('/..'))
  104 + return path;
  105 + const index = path.lastIndexOf('/');
  106 + return path.slice(0, index + 1);
  107 +}
  108 +function mergePaths(url, base) {
  109 + normalizePath(base, base.type);
  110 + // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
  111 + // path).
  112 + if (url.path === '/') {
  113 + url.path = base.path;
  114 + }
  115 + else {
  116 + // Resolution happens relative to the base path's directory, not the file.
  117 + url.path = stripPathFilename(base.path) + url.path;
  118 + }
  119 +}
  120 +/**
  121 + * The path can have empty directories "//", unneeded parents "foo/..", or current directory
  122 + * "foo/.". We need to normalize to a standard representation.
  123 + */
  124 +function normalizePath(url, type) {
  125 + const rel = type <= UrlType.RelativePath;
  126 + const pieces = url.path.split('/');
  127 + // We need to preserve the first piece always, so that we output a leading slash. The item at
  128 + // pieces[0] is an empty string.
  129 + let pointer = 1;
  130 + // Positive is the number of real directories we've output, used for popping a parent directory.
  131 + // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
  132 + let positive = 0;
  133 + // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
  134 + // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
  135 + // real directory, we won't need to append, unless the other conditions happen again.
  136 + let addTrailingSlash = false;
  137 + for (let i = 1; i < pieces.length; i++) {
  138 + const piece = pieces[i];
  139 + // An empty directory, could be a trailing slash, or just a double "//" in the path.
  140 + if (!piece) {
  141 + addTrailingSlash = true;
  142 + continue;
  143 + }
  144 + // If we encounter a real directory, then we don't need to append anymore.
  145 + addTrailingSlash = false;
  146 + // A current directory, which we can always drop.
  147 + if (piece === '.')
  148 + continue;
  149 + // A parent directory, we need to see if there are any real directories we can pop. Else, we
  150 + // have an excess of parents, and we'll need to keep the "..".
  151 + if (piece === '..') {
  152 + if (positive) {
  153 + addTrailingSlash = true;
  154 + positive--;
  155 + pointer--;
  156 + }
  157 + else if (rel) {
  158 + // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
  159 + // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
  160 + pieces[pointer++] = piece;
  161 + }
  162 + continue;
  163 + }
  164 + // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
  165 + // any popped or dropped directories.
  166 + pieces[pointer++] = piece;
  167 + positive++;
  168 + }
  169 + let path = '';
  170 + for (let i = 1; i < pointer; i++) {
  171 + path += '/' + pieces[i];
  172 + }
  173 + if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
  174 + path += '/';
  175 + }
  176 + url.path = path;
  177 +}
  178 +/**
  179 + * Attempts to resolve `input` URL/path relative to `base`.
  180 + */
  181 +function resolve(input, base) {
  182 + if (!input && !base)
  183 + return '';
  184 + const url = parseUrl(input);
  185 + let inputType = url.type;
  186 + if (base && inputType !== UrlType.Absolute) {
  187 + const baseUrl = parseUrl(base);
  188 + const baseType = baseUrl.type;
  189 + switch (inputType) {
  190 + case UrlType.Empty:
  191 + url.hash = baseUrl.hash;
  192 + // fall through
  193 + case UrlType.Hash:
  194 + url.query = baseUrl.query;
  195 + // fall through
  196 + case UrlType.Query:
  197 + case UrlType.RelativePath:
  198 + mergePaths(url, baseUrl);
  199 + // fall through
  200 + case UrlType.AbsolutePath:
  201 + // The host, user, and port are joined, you can't copy one without the others.
  202 + url.user = baseUrl.user;
  203 + url.host = baseUrl.host;
  204 + url.port = baseUrl.port;
  205 + // fall through
  206 + case UrlType.SchemeRelative:
  207 + // The input doesn't have a schema at least, so we need to copy at least that over.
  208 + url.scheme = baseUrl.scheme;
  209 + }
  210 + if (baseType > inputType)
  211 + inputType = baseType;
  212 + }
  213 + normalizePath(url, inputType);
  214 + const queryHash = url.query + url.hash;
  215 + switch (inputType) {
  216 + // This is impossible, because of the empty checks at the start of the function.
  217 + // case UrlType.Empty:
  218 + case UrlType.Hash:
  219 + case UrlType.Query:
  220 + return queryHash;
  221 + case UrlType.RelativePath: {
  222 + // The first char is always a "/", and we need it to be relative.
  223 + const path = url.path.slice(1);
  224 + if (!path)
  225 + return queryHash || '.';
  226 + if (isRelative(base || input) && !isRelative(path)) {
  227 + // If base started with a leading ".", or there is no base and input started with a ".",
  228 + // then we need to ensure that the relative path starts with a ".". We don't know if
  229 + // relative starts with a "..", though, so check before prepending.
  230 + return './' + path + queryHash;
  231 + }
  232 + return path + queryHash;
  233 + }
  234 + case UrlType.AbsolutePath:
  235 + return url.path + queryHash;
  236 + default:
  237 + return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
  238 + }
  239 +}
  240 +
  241 +export { resolve as default };
  242 +//# sourceMappingURL=resolve-uri.mjs.map
  1 +{"version":3,"file":"resolve-uri.mjs","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nenum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":"AAAA;AACA,MAAM,WAAW,GAA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;;;QAIf,KAAK,OAAO,CAAC,IAAI,CAAC;QAClB,KAAK,OAAO,CAAC,KAAK;YAChB,OAAO,SAAS,CAAC;QAEnB,KAAK,OAAO,CAAC,YAAY,EAAE;;YAEzB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,IAAI;gBAAE,OAAO,SAAS,IAAI,GAAG,CAAC;YAEnC,IAAI,UAAU,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;;;;gBAIlD,OAAO,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;aAChC;YAED,OAAO,IAAI,GAAG,SAAS,CAAC;SACzB;QAED,KAAK,OAAO,CAAC,YAAY;YACvB,OAAO,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;QAE9B;YACE,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;KACpF;AACH;;;;"}
  1 +(function (global, factory) {
  2 + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3 + typeof define === 'function' && define.amd ? define(factory) :
  4 + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory());
  5 +})(this, (function () { 'use strict';
  6 +
  7 + // Matches the scheme of a URL, eg "http://"
  8 + const schemeRegex = /^[\w+.-]+:\/\//;
  9 + /**
  10 + * Matches the parts of a URL:
  11 + * 1. Scheme, including ":", guaranteed.
  12 + * 2. User/password, including "@", optional.
  13 + * 3. Host, guaranteed.
  14 + * 4. Port, including ":", optional.
  15 + * 5. Path, including "/", optional.
  16 + * 6. Query, including "?", optional.
  17 + * 7. Hash, including "#", optional.
  18 + */
  19 + const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
  20 + /**
  21 + * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
  22 + * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
  23 + *
  24 + * 1. Host, optional.
  25 + * 2. Path, which may include "/", guaranteed.
  26 + * 3. Query, including "?", optional.
  27 + * 4. Hash, including "#", optional.
  28 + */
  29 + const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
  30 + var UrlType;
  31 + (function (UrlType) {
  32 + UrlType[UrlType["Empty"] = 1] = "Empty";
  33 + UrlType[UrlType["Hash"] = 2] = "Hash";
  34 + UrlType[UrlType["Query"] = 3] = "Query";
  35 + UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
  36 + UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
  37 + UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
  38 + UrlType[UrlType["Absolute"] = 7] = "Absolute";
  39 + })(UrlType || (UrlType = {}));
  40 + function isAbsoluteUrl(input) {
  41 + return schemeRegex.test(input);
  42 + }
  43 + function isSchemeRelativeUrl(input) {
  44 + return input.startsWith('//');
  45 + }
  46 + function isAbsolutePath(input) {
  47 + return input.startsWith('/');
  48 + }
  49 + function isFileUrl(input) {
  50 + return input.startsWith('file:');
  51 + }
  52 + function isRelative(input) {
  53 + return /^[.?#]/.test(input);
  54 + }
  55 + function parseAbsoluteUrl(input) {
  56 + const match = urlRegex.exec(input);
  57 + return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
  58 + }
  59 + function parseFileUrl(input) {
  60 + const match = fileRegex.exec(input);
  61 + const path = match[2];
  62 + return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
  63 + }
  64 + function makeUrl(scheme, user, host, port, path, query, hash) {
  65 + return {
  66 + scheme,
  67 + user,
  68 + host,
  69 + port,
  70 + path,
  71 + query,
  72 + hash,
  73 + type: UrlType.Absolute,
  74 + };
  75 + }
  76 + function parseUrl(input) {
  77 + if (isSchemeRelativeUrl(input)) {
  78 + const url = parseAbsoluteUrl('http:' + input);
  79 + url.scheme = '';
  80 + url.type = UrlType.SchemeRelative;
  81 + return url;
  82 + }
  83 + if (isAbsolutePath(input)) {
  84 + const url = parseAbsoluteUrl('http://foo.com' + input);
  85 + url.scheme = '';
  86 + url.host = '';
  87 + url.type = UrlType.AbsolutePath;
  88 + return url;
  89 + }
  90 + if (isFileUrl(input))
  91 + return parseFileUrl(input);
  92 + if (isAbsoluteUrl(input))
  93 + return parseAbsoluteUrl(input);
  94 + const url = parseAbsoluteUrl('http://foo.com/' + input);
  95 + url.scheme = '';
  96 + url.host = '';
  97 + url.type = input
  98 + ? input.startsWith('?')
  99 + ? UrlType.Query
  100 + : input.startsWith('#')
  101 + ? UrlType.Hash
  102 + : UrlType.RelativePath
  103 + : UrlType.Empty;
  104 + return url;
  105 + }
  106 + function stripPathFilename(path) {
  107 + // If a path ends with a parent directory "..", then it's a relative path with excess parent
  108 + // paths. It's not a file, so we can't strip it.
  109 + if (path.endsWith('/..'))
  110 + return path;
  111 + const index = path.lastIndexOf('/');
  112 + return path.slice(0, index + 1);
  113 + }
  114 + function mergePaths(url, base) {
  115 + normalizePath(base, base.type);
  116 + // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
  117 + // path).
  118 + if (url.path === '/') {
  119 + url.path = base.path;
  120 + }
  121 + else {
  122 + // Resolution happens relative to the base path's directory, not the file.
  123 + url.path = stripPathFilename(base.path) + url.path;
  124 + }
  125 + }
  126 + /**
  127 + * The path can have empty directories "//", unneeded parents "foo/..", or current directory
  128 + * "foo/.". We need to normalize to a standard representation.
  129 + */
  130 + function normalizePath(url, type) {
  131 + const rel = type <= UrlType.RelativePath;
  132 + const pieces = url.path.split('/');
  133 + // We need to preserve the first piece always, so that we output a leading slash. The item at
  134 + // pieces[0] is an empty string.
  135 + let pointer = 1;
  136 + // Positive is the number of real directories we've output, used for popping a parent directory.
  137 + // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
  138 + let positive = 0;
  139 + // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
  140 + // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
  141 + // real directory, we won't need to append, unless the other conditions happen again.
  142 + let addTrailingSlash = false;
  143 + for (let i = 1; i < pieces.length; i++) {
  144 + const piece = pieces[i];
  145 + // An empty directory, could be a trailing slash, or just a double "//" in the path.
  146 + if (!piece) {
  147 + addTrailingSlash = true;
  148 + continue;
  149 + }
  150 + // If we encounter a real directory, then we don't need to append anymore.
  151 + addTrailingSlash = false;
  152 + // A current directory, which we can always drop.
  153 + if (piece === '.')
  154 + continue;
  155 + // A parent directory, we need to see if there are any real directories we can pop. Else, we
  156 + // have an excess of parents, and we'll need to keep the "..".
  157 + if (piece === '..') {
  158 + if (positive) {
  159 + addTrailingSlash = true;
  160 + positive--;
  161 + pointer--;
  162 + }
  163 + else if (rel) {
  164 + // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
  165 + // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
  166 + pieces[pointer++] = piece;
  167 + }
  168 + continue;
  169 + }
  170 + // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
  171 + // any popped or dropped directories.
  172 + pieces[pointer++] = piece;
  173 + positive++;
  174 + }
  175 + let path = '';
  176 + for (let i = 1; i < pointer; i++) {
  177 + path += '/' + pieces[i];
  178 + }
  179 + if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
  180 + path += '/';
  181 + }
  182 + url.path = path;
  183 + }
  184 + /**
  185 + * Attempts to resolve `input` URL/path relative to `base`.
  186 + */
  187 + function resolve(input, base) {
  188 + if (!input && !base)
  189 + return '';
  190 + const url = parseUrl(input);
  191 + let inputType = url.type;
  192 + if (base && inputType !== UrlType.Absolute) {
  193 + const baseUrl = parseUrl(base);
  194 + const baseType = baseUrl.type;
  195 + switch (inputType) {
  196 + case UrlType.Empty:
  197 + url.hash = baseUrl.hash;
  198 + // fall through
  199 + case UrlType.Hash:
  200 + url.query = baseUrl.query;
  201 + // fall through
  202 + case UrlType.Query:
  203 + case UrlType.RelativePath:
  204 + mergePaths(url, baseUrl);
  205 + // fall through
  206 + case UrlType.AbsolutePath:
  207 + // The host, user, and port are joined, you can't copy one without the others.
  208 + url.user = baseUrl.user;
  209 + url.host = baseUrl.host;
  210 + url.port = baseUrl.port;
  211 + // fall through
  212 + case UrlType.SchemeRelative:
  213 + // The input doesn't have a schema at least, so we need to copy at least that over.
  214 + url.scheme = baseUrl.scheme;
  215 + }
  216 + if (baseType > inputType)
  217 + inputType = baseType;
  218 + }
  219 + normalizePath(url, inputType);
  220 + const queryHash = url.query + url.hash;
  221 + switch (inputType) {
  222 + // This is impossible, because of the empty checks at the start of the function.
  223 + // case UrlType.Empty:
  224 + case UrlType.Hash:
  225 + case UrlType.Query:
  226 + return queryHash;
  227 + case UrlType.RelativePath: {
  228 + // The first char is always a "/", and we need it to be relative.
  229 + const path = url.path.slice(1);
  230 + if (!path)
  231 + return queryHash || '.';
  232 + if (isRelative(base || input) && !isRelative(path)) {
  233 + // If base started with a leading ".", or there is no base and input started with a ".",
  234 + // then we need to ensure that the relative path starts with a ".". We don't know if
  235 + // relative starts with a "..", though, so check before prepending.
  236 + return './' + path + queryHash;
  237 + }
  238 + return path + queryHash;
  239 + }
  240 + case UrlType.AbsolutePath:
  241 + return url.path + queryHash;
  242 + default:
  243 + return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
  244 + }
  245 + }
  246 +
  247 + return resolve;
  248 +
  249 +}));
  250 +//# sourceMappingURL=resolve-uri.umd.js.map
  1 +{"version":3,"file":"resolve-uri.umd.js","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nenum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA,MAAM,WAAW,GAAG,gBAAgB,CAAC;IAErC;;;;;;;;;;IAUA,MAAM,QAAQ,GAAG,0EAA0E,CAAC;IAE5F;;;;;;;;;IASA,MAAM,SAAS,GAAG,iEAAiE,CAAC;IAapF,IAAK,OAQJ;IARD,WAAK,OAAO;QACV,uCAAS,CAAA;QACT,qCAAQ,CAAA;QACR,uCAAS,CAAA;QACT,qDAAgB,CAAA;QAChB,qDAAgB,CAAA;QAChB,yDAAkB,CAAA;QAClB,6CAAY,CAAA;IACd,CAAC,EARI,OAAO,KAAP,OAAO,QAQX;IAED,SAAS,aAAa,CAAC,KAAa;QAClC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,mBAAmB,CAAC,KAAa;QACxC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CA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,YAAY;gBACvB,OAAO,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;YAE9B;gBACE,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC;SACpF;IACH;;;;;;;;"}
  1 +/**
  2 + * Attempts to resolve `input` URL/path relative to `base`.
  3 + */
  4 +export default function resolve(input: string, base: string | undefined): string;
  1 +{
  2 + "name": "@jridgewell/resolve-uri",
  3 + "version": "3.1.0",
  4 + "description": "Resolve a URI relative to an optional base URI",
  5 + "keywords": [
  6 + "resolve",
  7 + "uri",
  8 + "url",
  9 + "path"
  10 + ],
  11 + "author": "Justin Ridgewell <justin@ridgewell.name>",
  12 + "license": "MIT",
  13 + "repository": "https://github.com/jridgewell/resolve-uri",
  14 + "main": "dist/resolve-uri.umd.js",
  15 + "module": "dist/resolve-uri.mjs",
  16 + "typings": "dist/types/resolve-uri.d.ts",
  17 + "exports": {
  18 + ".": [
  19 + {
  20 + "types": "./dist/types/resolve-uri.d.ts",
  21 + "browser": "./dist/resolve-uri.umd.js",
  22 + "require": "./dist/resolve-uri.umd.js",
  23 + "import": "./dist/resolve-uri.mjs"
  24 + },
  25 + "./dist/resolve-uri.umd.js"
  26 + ],
  27 + "./package.json": "./package.json"
  28 + },
  29 + "files": [
  30 + "dist"
  31 + ],
  32 + "engines": {
  33 + "node": ">=6.0.0"
  34 + },
  35 + "scripts": {
  36 + "prebuild": "rm -rf dist",
  37 + "build": "run-s -n build:*",
  38 + "build:rollup": "rollup -c rollup.config.js",
  39 + "build:ts": "tsc --project tsconfig.build.json",
  40 + "lint": "run-s -n lint:*",
  41 + "lint:prettier": "npm run test:lint:prettier -- --write",
  42 + "lint:ts": "npm run test:lint:ts -- --fix",
  43 + "pretest": "run-s build:rollup",
  44 + "test": "run-s -n test:lint test:only",
  45 + "test:debug": "mocha --inspect-brk",
  46 + "test:lint": "run-s -n test:lint:*",
  47 + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
  48 + "test:lint:ts": "eslint '{src,test}/**/*.ts'",
  49 + "test:only": "mocha",
  50 + "test:coverage": "c8 mocha",
  51 + "test:watch": "mocha --watch",
  52 + "prepublishOnly": "npm run preversion",
  53 + "preversion": "run-s test build"
  54 + },
  55 + "devDependencies": {
  56 + "@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*",
  57 + "@rollup/plugin-typescript": "8.3.0",
  58 + "@typescript-eslint/eslint-plugin": "5.10.0",
  59 + "@typescript-eslint/parser": "5.10.0",
  60 + "c8": "7.11.0",
  61 + "eslint": "8.7.0",
  62 + "eslint-config-prettier": "8.3.0",
  63 + "mocha": "9.2.0",
  64 + "npm-run-all": "4.1.5",
  65 + "prettier": "2.5.1",
  66 + "rollup": "2.66.0",
  67 + "typescript": "4.5.5"
  68 + }
  69 +}
  1 +Copyright 2022 Justin Ridgewell <jridgewell@google.com>
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is
  8 +furnished to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in
  11 +all copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19 +SOFTWARE.
  1 +# @jridgewell/set-array
  2 +
  3 +> Like a Set, but provides the index of the `key` in the backing array
  4 +
  5 +This is designed to allow synchronizing a second array with the contents of the backing array, like
  6 +how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, and there
  7 +are never duplicates.
  8 +
  9 +## Installation
  10 +
  11 +```sh
  12 +npm install @jridgewell/set-array
  13 +```
  14 +
  15 +## Usage
  16 +
  17 +```js
  18 +import { SetArray, get, put, pop } from '@jridgewell/set-array';
  19 +
  20 +const sa = new SetArray();
  21 +
  22 +let index = put(sa, 'first');
  23 +assert.strictEqual(index, 0);
  24 +
  25 +index = put(sa, 'second');
  26 +assert.strictEqual(index, 1);
  27 +
  28 +assert.deepEqual(sa.array, [ 'first', 'second' ]);
  29 +
  30 +index = get(sa, 'first');
  31 +assert.strictEqual(index, 0);
  32 +
  33 +pop(sa);
  34 +index = get(sa, 'second');
  35 +assert.strictEqual(index, undefined);
  36 +assert.deepEqual(sa.array, [ 'first' ]);
  37 +```
  1 +/**
  2 + * Gets the index associated with `key` in the backing array, if it is already present.
  3 + */
  4 +let get;
  5 +/**
  6 + * Puts `key` into the backing array, if it is not already present. Returns
  7 + * the index of the `key` in the backing array.
  8 + */
  9 +let put;
  10 +/**
  11 + * Pops the last added item out of the SetArray.
  12 + */
  13 +let pop;
  14 +/**
  15 + * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
  16 + * index of the `key` in the backing array.
  17 + *
  18 + * This is designed to allow synchronizing a second array with the contents of the backing array,
  19 + * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
  20 + * and there are never duplicates.
  21 + */
  22 +class SetArray {
  23 + constructor() {
  24 + this._indexes = { __proto__: null };
  25 + this.array = [];
  26 + }
  27 +}
  28 +(() => {
  29 + get = (strarr, key) => strarr._indexes[key];
  30 + put = (strarr, key) => {
  31 + // The key may or may not be present. If it is present, it's a number.
  32 + const index = get(strarr, key);
  33 + if (index !== undefined)
  34 + return index;
  35 + const { array, _indexes: indexes } = strarr;
  36 + return (indexes[key] = array.push(key) - 1);
  37 + };
  38 + pop = (strarr) => {
  39 + const { array, _indexes: indexes } = strarr;
  40 + if (array.length === 0)
  41 + return;
  42 + const last = array.pop();
  43 + indexes[last] = undefined;
  44 + };
  45 +})();
  46 +
  47 +export { SetArray, get, pop, put };
  48 +//# sourceMappingURL=set-array.mjs.map
  1 +{"version":3,"file":"set-array.mjs","sources":["../src/set-array.ts"],"sourcesContent":["/**\n * Gets the index associated with `key` in the backing array, if it is already present.\n */\nexport let get: (strarr: SetArray, key: string) => number | undefined;\n\n/**\n * Puts `key` into the backing array, if it is not already present. Returns\n * the index of the `key` in the backing array.\n */\nexport let put: (strarr: SetArray, key: string) => number;\n\n/**\n * Pops the last added item out of the SetArray.\n */\nexport let pop: (strarr: SetArray) => void;\n\n/**\n * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the\n * index of the `key` in the backing array.\n *\n * This is designed to allow synchronizing a second array with the contents of the backing array,\n * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,\n * and there are never duplicates.\n */\nexport class SetArray {\n private declare _indexes: { [key: string]: number | undefined };\n declare array: readonly string[];\n\n constructor() {\n this._indexes = { __proto__: null } as any;\n this.array = [];\n }\n\n static {\n get = (strarr, key) => strarr._indexes[key];\n\n put = (strarr, key) => {\n // The key may or may not be present. If it is present, it's a number.\n const index = get(strarr, key);\n if (index !== undefined) return index;\n\n const { array, _indexes: indexes } = strarr;\n\n return (indexes[key] = (array as string[]).push(key) - 1);\n };\n\n pop = (strarr) => {\n const { array, _indexes: indexes } = strarr;\n if (array.length === 0) return;\n\n const last = (array as string[]).pop()!;\n indexes[last] = undefined;\n };\n }\n}\n"],"names":[],"mappings":"AAAA;;;IAGW,IAA2D;AAEtE;;;;IAIW,IAA+C;AAE1D;;;IAGW,IAAgC;AAE3C;;;;;;;;MAQa,QAAQ;IAInB;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;KACjB;CAuBF;AArBC;IACE,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE5C,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG;;QAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAEtC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAE5C,QAAQ,OAAO,CAAC,GAAG,CAAC,GAAI,KAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;KAC3D,CAAC;IAEF,GAAG,GAAG,CAAC,MAAM;QACX,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAE/B,MAAM,IAAI,GAAI,KAAkB,CAAC,GAAG,EAAG,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;KAC3B,CAAC;AACJ,CAAC,GAAA;;;;"}
  1 +(function (global, factory) {
  2 + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3 + typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4 + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.setArray = {}));
  5 +})(this, (function (exports) { 'use strict';
  6 +
  7 + /**
  8 + * Gets the index associated with `key` in the backing array, if it is already present.
  9 + */
  10 + exports.get = void 0;
  11 + /**
  12 + * Puts `key` into the backing array, if it is not already present. Returns
  13 + * the index of the `key` in the backing array.
  14 + */
  15 + exports.put = void 0;
  16 + /**
  17 + * Pops the last added item out of the SetArray.
  18 + */
  19 + exports.pop = void 0;
  20 + /**
  21 + * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
  22 + * index of the `key` in the backing array.
  23 + *
  24 + * This is designed to allow synchronizing a second array with the contents of the backing array,
  25 + * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
  26 + * and there are never duplicates.
  27 + */
  28 + class SetArray {
  29 + constructor() {
  30 + this._indexes = { __proto__: null };
  31 + this.array = [];
  32 + }
  33 + }
  34 + (() => {
  35 + exports.get = (strarr, key) => strarr._indexes[key];
  36 + exports.put = (strarr, key) => {
  37 + // The key may or may not be present. If it is present, it's a number.
  38 + const index = exports.get(strarr, key);
  39 + if (index !== undefined)
  40 + return index;
  41 + const { array, _indexes: indexes } = strarr;
  42 + return (indexes[key] = array.push(key) - 1);
  43 + };
  44 + exports.pop = (strarr) => {
  45 + const { array, _indexes: indexes } = strarr;
  46 + if (array.length === 0)
  47 + return;
  48 + const last = array.pop();
  49 + indexes[last] = undefined;
  50 + };
  51 + })();
  52 +
  53 + exports.SetArray = SetArray;
  54 +
  55 + Object.defineProperty(exports, '__esModule', { value: true });
  56 +
  57 +}));
  58 +//# sourceMappingURL=set-array.umd.js.map
  1 +{"version":3,"file":"set-array.umd.js","sources":["../src/set-array.ts"],"sourcesContent":["/**\n * Gets the index associated with `key` in the backing array, if it is already present.\n */\nexport let get: (strarr: SetArray, key: string) => number | undefined;\n\n/**\n * Puts `key` into the backing array, if it is not already present. Returns\n * the index of the `key` in the backing array.\n */\nexport let put: (strarr: SetArray, key: string) => number;\n\n/**\n * Pops the last added item out of the SetArray.\n */\nexport let pop: (strarr: SetArray) => void;\n\n/**\n * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the\n * index of the `key` in the backing array.\n *\n * This is designed to allow synchronizing a second array with the contents of the backing array,\n * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,\n * and there are never duplicates.\n */\nexport class SetArray {\n private declare _indexes: { [key: string]: number | undefined };\n declare array: readonly string[];\n\n constructor() {\n this._indexes = { __proto__: null } as any;\n this.array = [];\n }\n\n static {\n get = (strarr, key) => strarr._indexes[key];\n\n put = (strarr, key) => {\n // The key may or may not be present. If it is present, it's a number.\n const index = get(strarr, key);\n if (index !== undefined) return index;\n\n const { array, _indexes: indexes } = strarr;\n\n return (indexes[key] = (array as string[]).push(key) - 1);\n };\n\n pop = (strarr) => {\n const { array, _indexes: indexes } = strarr;\n if (array.length === 0) return;\n\n const last = (array as string[]).pop()!;\n indexes[last] = undefined;\n };\n }\n}\n"],"names":["get","put","pop"],"mappings":";;;;;;IAAA;;;AAGWA,yBAA2D;IAEtE;;;;AAIWC,yBAA+C;IAE1D;;;AAGWC,yBAAgC;IAE3C;;;;;;;;UAQa,QAAQ;QAInB;YACE,IAAI,CAAC,QAAQ,GAAG,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC;YAC3C,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACjB;KAuBF;IArBC;QACEF,WAAG,GAAG,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAE5CC,WAAG,GAAG,CAAC,MAAM,EAAE,GAAG;;YAEhB,MAAM,KAAK,GAAGD,WAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;YAEtC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YAE5C,QAAQ,OAAO,CAAC,GAAG,CAAC,GAAI,KAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;SAC3D,CAAC;QAEFE,WAAG,GAAG,CAAC,MAAM;YACX,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO;YAE/B,MAAM,IAAI,GAAI,KAAkB,CAAC,GAAG,EAAG,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;SAC3B,CAAC;IACJ,CAAC,GAAA;;;;;;;;;;"}
  1 +/**
  2 + * Gets the index associated with `key` in the backing array, if it is already present.
  3 + */
  4 +export declare let get: (strarr: SetArray, key: string) => number | undefined;
  5 +/**
  6 + * Puts `key` into the backing array, if it is not already present. Returns
  7 + * the index of the `key` in the backing array.
  8 + */
  9 +export declare let put: (strarr: SetArray, key: string) => number;
  10 +/**
  11 + * Pops the last added item out of the SetArray.
  12 + */
  13 +export declare let pop: (strarr: SetArray) => void;
  14 +/**
  15 + * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
  16 + * index of the `key` in the backing array.
  17 + *
  18 + * This is designed to allow synchronizing a second array with the contents of the backing array,
  19 + * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
  20 + * and there are never duplicates.
  21 + */
  22 +export declare class SetArray {
  23 + private _indexes;
  24 + array: readonly string[];
  25 + constructor();
  26 +}
  1 +{
  2 + "name": "@jridgewell/set-array",
  3 + "version": "1.1.2",
  4 + "description": "Like a Set, but provides the index of the `key` in the backing array",
  5 + "keywords": [],
  6 + "author": "Justin Ridgewell <justin@ridgewell.name>",
  7 + "license": "MIT",
  8 + "repository": "https://github.com/jridgewell/set-array",
  9 + "main": "dist/set-array.umd.js",
  10 + "module": "dist/set-array.mjs",
  11 + "typings": "dist/types/set-array.d.ts",
  12 + "exports": {
  13 + ".": [
  14 + {
  15 + "types": "./dist/types/set-array.d.ts",
  16 + "browser": "./dist/set-array.umd.js",
  17 + "require": "./dist/set-array.umd.js",
  18 + "import": "./dist/set-array.mjs"
  19 + },
  20 + "./dist/set-array.umd.js"
  21 + ],
  22 + "./package.json": "./package.json"
  23 + },
  24 + "files": [
  25 + "dist",
  26 + "src"
  27 + ],
  28 + "engines": {
  29 + "node": ">=6.0.0"
  30 + },
  31 + "scripts": {
  32 + "prebuild": "rm -rf dist",
  33 + "build": "run-s -n build:*",
  34 + "build:rollup": "rollup -c rollup.config.js",
  35 + "build:ts": "tsc --project tsconfig.build.json",
  36 + "lint": "run-s -n lint:*",
  37 + "lint:prettier": "npm run test:lint:prettier -- --write",
  38 + "lint:ts": "npm run test:lint:ts -- --fix",
  39 + "pretest": "run-s build:rollup",
  40 + "test": "run-s -n test:lint test:only",
  41 + "test:debug": "mocha --inspect-brk",
  42 + "test:lint": "run-s -n test:lint:*",
  43 + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
  44 + "test:lint:ts": "eslint '{src,test}/**/*.ts'",
  45 + "test:only": "mocha",
  46 + "test:coverage": "c8 mocha",
  47 + "test:watch": "mocha --watch",
  48 + "prepublishOnly": "npm run preversion",
  49 + "preversion": "run-s test build"
  50 + },
  51 + "devDependencies": {
  52 + "@rollup/plugin-typescript": "8.3.0",
  53 + "@types/mocha": "9.1.1",
  54 + "@types/node": "17.0.29",
  55 + "@typescript-eslint/eslint-plugin": "5.10.0",
  56 + "@typescript-eslint/parser": "5.10.0",
  57 + "c8": "7.11.0",
  58 + "eslint": "8.7.0",
  59 + "eslint-config-prettier": "8.3.0",
  60 + "mocha": "9.2.0",
  61 + "npm-run-all": "4.1.5",
  62 + "prettier": "2.5.1",
  63 + "rollup": "2.66.0",
  64 + "typescript": "4.5.5"
  65 + }
  66 +}
  1 +/**
  2 + * Gets the index associated with `key` in the backing array, if it is already present.
  3 + */
  4 +export let get: (strarr: SetArray, key: string) => number | undefined;
  5 +
  6 +/**
  7 + * Puts `key` into the backing array, if it is not already present. Returns
  8 + * the index of the `key` in the backing array.
  9 + */
  10 +export let put: (strarr: SetArray, key: string) => number;
  11 +
  12 +/**
  13 + * Pops the last added item out of the SetArray.
  14 + */
  15 +export let pop: (strarr: SetArray) => void;
  16 +
  17 +/**
  18 + * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
  19 + * index of the `key` in the backing array.
  20 + *
  21 + * This is designed to allow synchronizing a second array with the contents of the backing array,
  22 + * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
  23 + * and there are never duplicates.
  24 + */
  25 +export class SetArray {
  26 + private declare _indexes: { [key: string]: number | undefined };
  27 + declare array: readonly string[];
  28 +
  29 + constructor() {
  30 + this._indexes = { __proto__: null } as any;
  31 + this.array = [];
  32 + }
  33 +
  34 + static {
  35 + get = (strarr, key) => strarr._indexes[key];
  36 +
  37 + put = (strarr, key) => {
  38 + // The key may or may not be present. If it is present, it's a number.
  39 + const index = get(strarr, key);
  40 + if (index !== undefined) return index;
  41 +
  42 + const { array, _indexes: indexes } = strarr;
  43 +
  44 + return (indexes[key] = (array as string[]).push(key) - 1);
  45 + };
  46 +
  47 + pop = (strarr) => {
  48 + const { array, _indexes: indexes } = strarr;
  49 + if (array.length === 0) return;
  50 +
  51 + const last = (array as string[]).pop()!;
  52 + indexes[last] = undefined;
  53 + };
  54 + }
  55 +}
  1 +Copyright 2019 Justin Ridgewell <jridgewell@google.com>
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is
  8 +furnished to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in
  11 +all copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19 +SOFTWARE.
  1 +# @jridgewell/source-map
  2 +
  3 +> Packages `@jridgewell/trace-mapping` and `@jridgewell/gen-mapping` into the familiar source-map API
  4 +
  5 +This isn't the full API, but it's the core functionality. This wraps
  6 +[@jridgewell/trace-mapping][trace-mapping] and [@jridgewell/gen-mapping][gen-mapping]
  7 +implementations.
  8 +
  9 +## Installation
  10 +
  11 +```sh
  12 +npm install @jridgewell/source-map
  13 +```
  14 +
  15 +## Usage
  16 +
  17 +TODO
  18 +
  19 +### SourceMapConsumer
  20 +
  21 +```typescript
  22 +import { SourceMapConsumer } from '@jridgewell/source-map';
  23 +const smc = new SourceMapConsumer({
  24 + version: 3,
  25 + names: ['foo'],
  26 + sources: ['input.js'],
  27 + mappings: 'AAAAA',
  28 +});
  29 +```
  30 +
  31 +#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
  32 +
  33 +```typescript
  34 +const smc = new SourceMapConsumer(map);
  35 +smc.originalPositionFor({ line: 1, column: 0 });
  36 +```
  37 +
  38 +### SourceMapGenerator
  39 +
  40 +```typescript
  41 +import { SourceMapGenerator } from '@jridgewell/source-map';
  42 +const smg = new SourceMapGenerator({
  43 + file: 'output.js',
  44 + sourceRoot: 'https://example.com/',
  45 +});
  46 +```
  47 +
  48 +#### SourceMapGenerator.prototype.addMapping(mapping)
  49 +
  50 +```typescript
  51 +const smg = new SourceMapGenerator();
  52 +smg.addMapping({
  53 + generated: { line: 1, column: 0 },
  54 + source: 'input.js',
  55 + original: { line: 1, column: 0 },
  56 + name: 'foo',
  57 +});
  58 +```
  59 +
  60 +#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
  61 +
  62 +```typescript
  63 +const smg = new SourceMapGenerator();
  64 +smg.setSourceContent('input.js', 'foobar');
  65 +```
  66 +
  67 +#### SourceMapGenerator.prototype.toJSON()
  68 +
  69 +```typescript
  70 +const smg = new SourceMapGenerator();
  71 +smg.toJSON(); // { version: 3, names: [], sources: [], mappings: '' }
  72 +```
  73 +
  74 +#### SourceMapGenerator.prototype.toDecodedMap()
  75 +
  76 +```typescript
  77 +const smg = new SourceMapGenerator();
  78 +smg.toDecodedMap(); // { version: 3, names: [], sources: [], mappings: [] }
  79 +```
  80 +
  81 +[trace-mapping]: https://github.com/jridgewell/trace-mapping/
  82 +[gen-mapping]: https://github.com/jridgewell/gen-mapping/