get-current-line
Advanced tools
Comparing version 6.3.0 to 6.4.0-next.1627423730.9364df5392c89e9540314787493dbe142e8ce99d
/** The combination of location information about the line that was executing at the time */ | ||
export interface Location { | ||
/** the location of the line that was executing at the time */ | ||
line: number | ||
/** the location of the character that was executing at the time */ | ||
char: number | ||
/** the method name that was executing at the time */ | ||
method: string | ||
/** the file path that was executing at the time */ | ||
file: string | ||
/** the location of the line that was executing at the time */ | ||
line: number; | ||
/** the location of the character that was executing at the time */ | ||
char: number; | ||
/** the method name that was executing at the time */ | ||
method: string; | ||
/** the file path that was executing at the time */ | ||
file: string; | ||
} | ||
@@ -24,24 +24,24 @@ /** | ||
export interface Offset { | ||
/** | ||
* if provided, continue until a method containing or matching this string is exited | ||
* if provided alongside a file, will continue until neither the file nor method are found | ||
* this allows file and method to act as fallbacks for each other, such that if one is not found, it doesn't skip everything | ||
*/ | ||
method?: RegExp | string | null | ||
/** | ||
* if provided, continue until a file containing or matching this string is exited | ||
* if provided alongside a method, will continue until neither the file nor method are found | ||
* this allows file and method to act as fallbacks for each other, such that if one is not found, it doesn't skip everything | ||
*/ | ||
file?: RegExp | string | null | ||
/** | ||
* once we have satisfied the found condition, if any, then apply this index offset to the frames | ||
* e.g. 1 would mean next frame, and -1 would mean the previous frame | ||
* Use -1 to go back to the found method or file | ||
*/ | ||
frames?: number | ||
/** | ||
* once we have satisfied the found condition, should we apply the frame offset immediately, or wait until the found condition has exited | ||
*/ | ||
immediate?: boolean | ||
/** | ||
* if provided, continue until a method containing or matching this string is exited | ||
* if provided alongside a file, will continue until neither the file nor method are found | ||
* this allows file and method to act as fallbacks for each other, such that if one is not found, it doesn't skip everything | ||
*/ | ||
method?: RegExp | string | null; | ||
/** | ||
* if provided, continue until a file containing or matching this string is exited | ||
* if provided alongside a method, will continue until neither the file nor method are found | ||
* this allows file and method to act as fallbacks for each other, such that if one is not found, it doesn't skip everything | ||
*/ | ||
file?: RegExp | string | null; | ||
/** | ||
* once we have satisfied the found condition, if any, then apply this index offset to the frames | ||
* e.g. 1 would mean next frame, and -1 would mean the previous frame | ||
* Use -1 to go back to the found method or file | ||
*/ | ||
frames?: number; | ||
/** | ||
* once we have satisfied the found condition, should we apply the frame offset immediately, or wait until the found condition has exited | ||
*/ | ||
immediate?: boolean; | ||
} | ||
@@ -51,9 +51,7 @@ /** | ||
*/ | ||
export declare function getFramesFromError(error: Error): Array<string> | ||
export declare function getFramesFromError(error: Error): Array<string>; | ||
/** | ||
* Get the locations from a list of error stack frames. | ||
*/ | ||
export declare function getLocationsFromFrames( | ||
frames: Array<string> | ||
): Array<Location> | ||
export declare function getLocationsFromFrames(frames: Array<string>): Array<Location>; | ||
/** | ||
@@ -63,6 +61,3 @@ * From a list of locations, get the location that is determined by the offset. | ||
*/ | ||
export declare function getLocationWithOffset( | ||
locations: Array<Location>, | ||
offset: Offset | ||
): Location | ||
export declare function getLocationWithOffset(locations: Array<Location>, offset: Offset): Location; | ||
/** | ||
@@ -72,3 +67,3 @@ * Get the file path that appears in the stack of the passed error. | ||
*/ | ||
export declare function getFileFromError(error: Error, offset?: Offset): string | ||
export declare function getFileFromError(error: Error, offset?: Offset): string; | ||
/** | ||
@@ -78,6 +73,3 @@ * Get first determined location information that appears in the stack of the error. | ||
*/ | ||
export declare function getLocationFromError( | ||
error: Error, | ||
offset?: Offset | ||
): Location | ||
export declare function getLocationFromError(error: Error, offset?: Offset): Location; | ||
/** | ||
@@ -100,3 +92,3 @@ * Get the location information about the line that called this method. | ||
*/ | ||
export default function getCurrentLine(offset?: Offset): Location | ||
//# sourceMappingURL=index.d.ts.map | ||
export default function getCurrentLine(offset?: Offset): Location; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,31 +5,35 @@ /** | ||
export function getFramesFromError(error) { | ||
// Create an error | ||
let stack, frames | ||
// And attempt to retrieve it's stack | ||
// https://github.com/winstonjs/winston/issues/401#issuecomment-61913086 | ||
try { | ||
stack = error.stack | ||
} catch (error1) { | ||
try { | ||
// @ts-ignore | ||
const previous = err.__previous__ || err.__previous | ||
stack = previous && previous.stack | ||
} catch (error2) { | ||
stack = null | ||
} | ||
} | ||
// Handle different stack formats | ||
if (stack) { | ||
if (Array.isArray(stack)) { | ||
frames = Array(stack) | ||
} else { | ||
frames = stack.toString().split('\n') | ||
} | ||
} else { | ||
frames = [] | ||
} | ||
// Parse our frames | ||
return frames | ||
// Create an error | ||
let stack, frames; | ||
// And attempt to retrieve it's stack | ||
// https://github.com/winstonjs/winston/issues/401#issuecomment-61913086 | ||
try { | ||
stack = error.stack; | ||
} | ||
catch (error1) { | ||
try { | ||
// @ts-ignore | ||
const previous = err.__previous__ || err.__previous; | ||
stack = previous && previous.stack; | ||
} | ||
catch (error2) { | ||
stack = null; | ||
} | ||
} | ||
// Handle different stack formats | ||
if (stack) { | ||
if (Array.isArray(stack)) { | ||
frames = Array(stack); | ||
} | ||
else { | ||
frames = stack.toString().split('\n'); | ||
} | ||
} | ||
else { | ||
frames = []; | ||
} | ||
// Parse our frames | ||
return frames; | ||
} | ||
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/ | ||
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/; | ||
/** | ||
@@ -39,26 +43,27 @@ * Get the locations from a list of error stack frames. | ||
export function getLocationsFromFrames(frames) { | ||
// Prepare | ||
const locations = [] | ||
// Cycle through the lines | ||
for (const frame of frames) { | ||
// ensure each line is a string | ||
const line = (frame || '').toString() | ||
// skip empty lines | ||
if (line.length === 0) continue | ||
// Error | ||
// at file:///Users/balupton/Projects/active/get-current-line/asd.js:1:13 | ||
// at ModuleJob.run (internal/modules/esm/module_job.js:140:23) | ||
// at async Loader.import (internal/modules/esm/loader.js:165:24) | ||
// at async Object.loadESM (internal/process/esm_loader.js:68:5) | ||
const match = line.match(lineRegex) | ||
if (match && match.groups) { | ||
locations.push({ | ||
method: match.groups.method || '', | ||
file: match.groups.file || '', | ||
line: Number(match.groups.line), | ||
char: Number(match.groups.char), | ||
}) | ||
} | ||
} | ||
return locations | ||
// Prepare | ||
const locations = []; | ||
// Cycle through the lines | ||
for (const frame of frames) { | ||
// ensure each line is a string | ||
const line = (frame || '').toString(); | ||
// skip empty lines | ||
if (line.length === 0) | ||
continue; | ||
// Error | ||
// at file:///Users/balupton/Projects/active/get-current-line/asd.js:1:13 | ||
// at ModuleJob.run (internal/modules/esm/module_job.js:140:23) | ||
// at async Loader.import (internal/modules/esm/loader.js:165:24) | ||
// at async Object.loadESM (internal/process/esm_loader.js:68:5) | ||
const match = line.match(lineRegex); | ||
if (match && match.groups) { | ||
locations.push({ | ||
method: match.groups.method || '', | ||
file: match.groups.file || '', | ||
line: Number(match.groups.line), | ||
char: Number(match.groups.char), | ||
}); | ||
} | ||
} | ||
return locations; | ||
} | ||
@@ -69,7 +74,7 @@ /** | ||
const failureLocation = { | ||
line: -1, | ||
char: -1, | ||
method: '', | ||
file: '', | ||
} | ||
line: -1, | ||
char: -1, | ||
method: '', | ||
file: '', | ||
}; | ||
/** | ||
@@ -80,48 +85,46 @@ * From a list of locations, get the location that is determined by the offset. | ||
export function getLocationWithOffset(locations, offset) { | ||
// Continue | ||
let found = !offset.file && !offset.method | ||
// use while loop so we can skip ahead | ||
let i = 0 | ||
while (i < locations.length) { | ||
const location = locations[i] | ||
// the current location matches the offset | ||
if ( | ||
(offset.file && | ||
(typeof offset.file === 'string' | ||
? location.file.includes(offset.file) | ||
: offset.file.test(location.file))) || | ||
(offset.method && | ||
(typeof offset.method === 'string' | ||
? location.method.includes(offset.method) | ||
: offset.method.test(location.method))) | ||
) { | ||
// we are found, and we should exit immediatelyg, so return with the frame offset applied | ||
if (offset.immediate) { | ||
// apply frame offset | ||
i += offset.frames || 0 | ||
// and return the result | ||
return locations[i] | ||
} | ||
// otherwise, continue until the found condition has exited | ||
else { | ||
found = true | ||
++i | ||
continue | ||
} | ||
} | ||
// has been found, and the found condition has exited, so return with the frame offset applied | ||
else if (found) { | ||
// apply frame offset | ||
i += offset.frames || 0 | ||
// and return the result | ||
return locations[i] | ||
} | ||
// nothing has been found yet, so continue until we find the offset | ||
else { | ||
++i | ||
continue | ||
} | ||
} | ||
// return failure | ||
return failureLocation | ||
// Continue | ||
let found = !offset.file && !offset.method; | ||
// use while loop so we can skip ahead | ||
let i = 0; | ||
while (i < locations.length) { | ||
const location = locations[i]; | ||
// the current location matches the offset | ||
if ((offset.file && | ||
(typeof offset.file === 'string' | ||
? location.file.includes(offset.file) | ||
: offset.file.test(location.file))) || | ||
(offset.method && | ||
(typeof offset.method === 'string' | ||
? location.method.includes(offset.method) | ||
: offset.method.test(location.method)))) { | ||
// we are found, and we should exit immediatelyg, so return with the frame offset applied | ||
if (offset.immediate) { | ||
// apply frame offset | ||
i += offset.frames || 0; | ||
// and return the result | ||
return locations[i]; | ||
} | ||
// otherwise, continue until the found condition has exited | ||
else { | ||
found = true; | ||
++i; | ||
continue; | ||
} | ||
} | ||
// has been found, and the found condition has exited, so return with the frame offset applied | ||
else if (found) { | ||
// apply frame offset | ||
i += offset.frames || 0; | ||
// and return the result | ||
return locations[i]; | ||
} | ||
// nothing has been found yet, so continue until we find the offset | ||
else { | ||
++i; | ||
continue; | ||
} | ||
} | ||
// return failure | ||
return failureLocation; | ||
} | ||
@@ -132,4 +135,4 @@ /** | ||
function getLocationsFromError(error) { | ||
const frames = getFramesFromError(error) | ||
return getLocationsFromFrames(frames) | ||
const frames = getFramesFromError(error); | ||
return getLocationsFromFrames(frames); | ||
} | ||
@@ -140,11 +143,8 @@ /** | ||
*/ | ||
export function getFileFromError( | ||
error, | ||
offset = { | ||
file: /./, | ||
immediate: true, | ||
} | ||
) { | ||
const locations = getLocationsFromError(error) | ||
return getLocationWithOffset(locations, offset).file | ||
export function getFileFromError(error, offset = { | ||
file: /./, | ||
immediate: true, | ||
}) { | ||
const locations = getLocationsFromError(error); | ||
return getLocationWithOffset(locations, offset).file; | ||
} | ||
@@ -155,10 +155,7 @@ /** | ||
*/ | ||
export function getLocationFromError( | ||
error, | ||
offset = { | ||
immediate: true, | ||
} | ||
) { | ||
const locations = getLocationsFromError(error) | ||
return getLocationWithOffset(locations, offset) | ||
export function getLocationFromError(error, offset = { | ||
immediate: true, | ||
}) { | ||
const locations = getLocationsFromError(error); | ||
return getLocationWithOffset(locations, offset); | ||
} | ||
@@ -182,10 +179,8 @@ /** | ||
*/ | ||
export default function getCurrentLine( | ||
offset = { | ||
method: 'getCurrentLine', | ||
frames: 0, | ||
immediate: false, | ||
} | ||
) { | ||
return getLocationFromError(new Error(), offset) | ||
export default function getCurrentLine(offset = { | ||
method: 'getCurrentLine', | ||
frames: 0, | ||
immediate: false, | ||
}) { | ||
return getLocationFromError(new Error(), offset); | ||
} |
@@ -85,3 +85,4 @@ /** The combination of location information about the line that was executing at the time */ | ||
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/ | ||
const lineRegex = | ||
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/ | ||
@@ -88,0 +89,0 @@ /** |
# History | ||
## v6.4.0 2021 July 28 | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
## v6.3.0 2020 October 29 | ||
@@ -4,0 +8,0 @@ |
@@ -18,3 +18,3 @@ <!-- LICENSEFILE/ --> | ||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
@@ -21,0 +21,0 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "get-current-line", | ||
"version": "6.3.0", | ||
"version": "6.4.0-next.1627423730.9364df5392c89e9540314787493dbe142e8ce99d", | ||
"description": "Get the current line number of the executing file and method", | ||
@@ -11,7 +11,3 @@ "homepage": "https://github.com/bevry/get-current-line", | ||
"debugging", | ||
"deno", | ||
"deno-edition", | ||
"deno-entry", | ||
"denoland", | ||
"esnext", | ||
"es2019", | ||
"export-default", | ||
@@ -35,3 +31,3 @@ "file", | ||
"list": [ | ||
"travisci", | ||
"githubworkflow", | ||
"npmversion", | ||
@@ -53,2 +49,3 @@ "npmdownloads", | ||
"config": { | ||
"githubWorkflow": "bevry", | ||
"githubSponsorsUsername": "balupton", | ||
@@ -63,3 +60,2 @@ "buymeacoffeeUsername": "balupton", | ||
"wishlistURL": "https://bevry.me/wishlist", | ||
"travisTLD": "com", | ||
"githubUsername": "bevry", | ||
@@ -102,3 +98,3 @@ "githubRepository": "get-current-line", | ||
{ | ||
"description": "TypeScript compiled against ES2019 for web browsers with Import for modules", | ||
"description": "TypeScript compiled against ES2020 for web browsers with Import for modules", | ||
"directory": "edition-browsers", | ||
@@ -117,4 +113,4 @@ "entry": "index.js", | ||
{ | ||
"description": "TypeScript compiled against ESNext for Node.js 10 || 12 || 14 || 15 with Require for modules", | ||
"directory": "edition-esnext", | ||
"description": "TypeScript compiled against ES2019 for Node.js 10 || 12 || 14 with Require for modules", | ||
"directory": "edition-es2019", | ||
"entry": "index.js", | ||
@@ -124,7 +120,7 @@ "tags": [ | ||
"javascript", | ||
"esnext", | ||
"es2019", | ||
"require" | ||
], | ||
"engines": { | ||
"node": "10 || 12 || 14 || 15", | ||
"node": "10 || 12 || 14", | ||
"browsers": false | ||
@@ -134,4 +130,4 @@ } | ||
{ | ||
"description": "TypeScript compiled against ESNext for Node.js 12 || 14 || 15 with Import for modules", | ||
"directory": "edition-esnext-esm", | ||
"description": "TypeScript compiled against ES2019 for Node.js 12 || 14 with Import for modules", | ||
"directory": "edition-es2019-esm", | ||
"entry": "index.js", | ||
@@ -141,23 +137,9 @@ "tags": [ | ||
"javascript", | ||
"esnext", | ||
"es2019", | ||
"import" | ||
], | ||
"engines": { | ||
"node": "12 || 14 || 15", | ||
"node": "12 || 14", | ||
"browsers": false | ||
} | ||
}, | ||
{ | ||
"description": "TypeScript source code made to be compatible with Deno", | ||
"directory": "edition-deno", | ||
"entry": "index.ts", | ||
"tags": [ | ||
"typescript", | ||
"import", | ||
"deno" | ||
], | ||
"engines": { | ||
"deno": true, | ||
"browsers": true | ||
} | ||
} | ||
@@ -167,7 +149,7 @@ ], | ||
"type": "module", | ||
"main": "edition-esnext/index.js", | ||
"main": "edition-es2019/index.js", | ||
"exports": { | ||
"node": { | ||
"import": "./edition-esnext-esm/index.js", | ||
"require": "./edition-esnext/index.js" | ||
"import": "./edition-es2019-esm/index.js", | ||
"require": "./edition-es2019/index.js" | ||
}, | ||
@@ -178,31 +160,30 @@ "browser": { | ||
}, | ||
"deno": "edition-deno/index.ts", | ||
"browser": "edition-browsers/index.js", | ||
"module": "edition-browsers/index.js", | ||
"devDependencies": { | ||
"@bevry/update-contributors": "^1.17.0", | ||
"@typescript-eslint/eslint-plugin": "^4.6.0", | ||
"@typescript-eslint/parser": "^4.6.0", | ||
"assert-helpers": "^8.1.0", | ||
"eslint": "^7.12.1", | ||
"@bevry/update-contributors": "^1.18.0", | ||
"@typescript-eslint/eslint-plugin": "^4.28.5", | ||
"@typescript-eslint/parser": "^4.28.5", | ||
"assert-helpers": "^8.2.0", | ||
"eslint": "^7.31.0", | ||
"eslint-config-bevry": "^3.23.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"kava": "^5.12.0", | ||
"make-deno-edition": "^1.2.0", | ||
"prettier": "^2.1.2", | ||
"projectz": "^2.16.0", | ||
"surge": "^0.21.6", | ||
"typedoc": "^0.19.2", | ||
"typescript": "^4.0.5", | ||
"valid-directory": "^3.4.0", | ||
"valid-module": "^1.14.0" | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"kava": "^5.13.0", | ||
"make-deno-edition": "^1.3.0", | ||
"prettier": "^2.3.2", | ||
"projectz": "^2.18.0", | ||
"surge": "^0.23.0", | ||
"typedoc": "^0.21.4", | ||
"typescript": "4.3.5", | ||
"valid-directory": "^3.7.0", | ||
"valid-module": "^1.15.0" | ||
}, | ||
"scripts": { | ||
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next", | ||
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-browsers && npm run our:compile:edition-esnext && npm run our:compile:edition-esnext-esm && npm run our:compile:types", | ||
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-browsers && npm run our:compile:edition-es2019 && npm run our:compile:edition-es2019-esm && npm run our:compile:types", | ||
"our:compile:deno": "make-deno-edition --attempt", | ||
"our:compile:edition-browsers": "tsc --module ESNext --target ES2019 --outDir ./edition-browsers --project tsconfig.json && ( test ! -d edition-browsers/source || ( mv edition-browsers/source edition-temp && rm -Rf edition-browsers && mv edition-temp edition-browsers ) )", | ||
"our:compile:edition-esnext": "tsc --module commonjs --target ESNext --outDir ./edition-esnext --project tsconfig.json && ( test ! -d edition-esnext/source || ( mv edition-esnext/source edition-temp && rm -Rf edition-esnext && mv edition-temp edition-esnext ) ) && echo '{\"type\": \"commonjs\"}' > edition-esnext/package.json", | ||
"our:compile:edition-esnext-esm": "tsc --module ESNext --target ESNext --outDir ./edition-esnext-esm --project tsconfig.json && ( test ! -d edition-esnext-esm/source || ( mv edition-esnext-esm/source edition-temp && rm -Rf edition-esnext-esm && mv edition-temp edition-esnext-esm ) ) && echo '{\"type\": \"module\"}' > edition-esnext-esm/package.json", | ||
"our:compile:edition-browsers": "tsc --module ESNext --target ES2020 --outDir ./edition-browsers --project tsconfig.json && ( test ! -d edition-browsers/source || ( mv edition-browsers/source edition-temp && rm -Rf edition-browsers && mv edition-temp edition-browsers ) )", | ||
"our:compile:edition-es2019": "tsc --module commonjs --target ES2019 --outDir ./edition-es2019 --project tsconfig.json && ( test ! -d edition-es2019/source || ( mv edition-es2019/source edition-temp && rm -Rf edition-es2019 && mv edition-temp edition-es2019 ) ) && echo '{\"type\": \"commonjs\"}' > edition-es2019/package.json", | ||
"our:compile:edition-es2019-esm": "tsc --module ESNext --target ES2019 --outDir ./edition-es2019-esm --project tsconfig.json && ( test ! -d edition-es2019-esm/source || ( mv edition-es2019-esm/source edition-temp && rm -Rf edition-es2019-esm && mv edition-temp edition-es2019-esm ) ) && echo '{\"type\": \"module\"}' > edition-es2019-esm/package.json", | ||
"our:compile:types": "tsc --project tsconfig.json --emitDeclarationOnly --declaration --declarationMap --declarationDir ./compiled-types && ( test ! -d compiled-types/source || ( mv compiled-types/source edition-temp && rm -Rf compiled-types && mv edition-temp compiled-types ) )", | ||
@@ -213,3 +194,3 @@ "our:deploy": "echo no need for this project", | ||
"our:meta:docs": "npm run our:meta:docs:typedoc", | ||
"our:meta:docs:typedoc": "rm -Rf ./docs && typedoc --mode file --exclude '**/+(*test*|node_modules)' --excludeExternals --name \"$npm_package_name\" --readme ./README.md --out ./docs ./source", | ||
"our:meta:docs:typedoc": "rm -Rf ./docs && typedoc --exclude '**/+(*test*|node_modules)' --excludeExternals --out ./docs ./source", | ||
"our:meta:projectz": "projectz compile", | ||
@@ -220,3 +201,3 @@ "our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push", | ||
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta", | ||
"our:release:push": "git push origin master && git push origin --tags", | ||
"our:release:push": "git push origin && git push origin --tags", | ||
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"", | ||
@@ -231,3 +212,3 @@ "our:setup": "npm run our:setup:install", | ||
"our:verify:prettier": "prettier --write .", | ||
"test": "node ./edition-esnext/test.js" | ||
"test": "node ./edition-es2019/test.js" | ||
}, | ||
@@ -234,0 +215,0 @@ "eslintConfig": { |
@@ -10,3 +10,3 @@ <!-- TITLE/ --> | ||
<span class="badge-travisci"><a href="http://travis-ci.com/bevry/get-current-line" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/get-current-line/master.svg" alt="Travis CI Build Status" /></a></span> | ||
<span class="badge-githubworkflow"><a href="https://github.com/bevry/get-current-line/actions?query=workflow%3Abevry" title="View the status of this project's GitHub Workflow: bevry"><img src="https://github.com/bevry/get-current-line/workflows/bevry/badge.svg" alt="Status of the GitHub Workflow: bevry" /></a></span> | ||
<span class="badge-npmversion"><a href="https://npmjs.org/package/get-current-line" title="View this project on NPM"><img src="https://img.shields.io/npm/v/get-current-line.svg" alt="NPM version" /></a></span> | ||
@@ -69,8 +69,2 @@ <span class="badge-npmdownloads"><a href="https://npmjs.org/package/get-current-line" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/get-current-line.svg" alt="NPM downloads" /></a></span> | ||
<a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative for Node.js"><h3>Deno</h3></a> | ||
``` typescript | ||
import pkg from 'https://unpkg.com/get-current-line@^6.3.0/edition-deno/index.ts' | ||
``` | ||
<a href="https://www.skypack.dev" title="Skypack is a JavaScript Delivery Network for modern web apps"><h3>Skypack</h3></a> | ||
@@ -80,3 +74,3 @@ | ||
<script type="module"> | ||
import pkg from '//cdn.skypack.dev/get-current-line@^6.3.0' | ||
import pkg from '//cdn.skypack.dev/get-current-line@^6.4.0' | ||
</script> | ||
@@ -89,3 +83,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//unpkg.com/get-current-line@^6.3.0' | ||
import pkg from '//unpkg.com/get-current-line@^6.4.0' | ||
</script> | ||
@@ -98,3 +92,3 @@ ``` | ||
<script type="module"> | ||
import pkg from '//dev.jspm.io/get-current-line@6.3.0' | ||
import pkg from '//dev.jspm.io/get-current-line@6.4.0' | ||
</script> | ||
@@ -108,7 +102,6 @@ ``` | ||
<ul><li><code>get-current-line/source/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>get-current-line/edition-browsers/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#10th_Edition_-_ECMAScript_2019" title="ECMAScript ES2019">ES2019</a> for web browsers with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>get-current-line</code> aliases <code>get-current-line/edition-esnext/index.js</code></li> | ||
<li><code>get-current-line/edition-esnext/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 10 || 12 || 14 || 15 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li> | ||
<li><code>get-current-line/edition-esnext-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#ES.Next" title="ECMAScript Next">ESNext</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 12 || 14 || 15 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>get-current-line/edition-deno/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code made to be compatible with <a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative to Node.js">Deno</a></li></ul> | ||
<li><code>get-current-line/edition-browsers/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#11th_Edition_–_ECMAScript_2020" title="ECMAScript ES2020">ES2020</a> for web browsers with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>get-current-line</code> aliases <code>get-current-line/edition-es2019/index.js</code></li> | ||
<li><code>get-current-line/edition-es2019/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#10th_Edition_-_ECMAScript_2019" title="ECMAScript ES2019">ES2019</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 10 || 12 || 14 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li> | ||
<li><code>get-current-line/edition-es2019-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against <a href="https://en.wikipedia.org/wiki/ECMAScript#10th_Edition_-_ECMAScript_2019" title="ECMAScript ES2019">ES2019</a> for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 12 || 14 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li></ul> | ||
@@ -115,0 +108,0 @@ <!-- /INSTALL --> |
@@ -85,3 +85,4 @@ /** The combination of location information about the line that was executing at the time */ | ||
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/ | ||
const lineRegex = | ||
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/ | ||
@@ -88,0 +89,0 @@ /** |
@@ -9,4 +9,3 @@ { | ||
"strict": true, | ||
"target": "ESNext", | ||
"lib": ["ESNext"], | ||
"target": "ES2019", | ||
"module": "ESNext" | ||
@@ -13,0 +12,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64127
14
1109
1
171