Comparing version 2.0.3 to 2.0.4
{ | ||
"type": "module", | ||
"name": "bun-repl", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Experimental REPL for Bun", | ||
@@ -6,0 +6,0 @@ "main": "src/module/repl.ts", |
@@ -23,3 +23,3 @@ #!/usr/bin/env bun | ||
const validFlags = [ | ||
'-h', '--help', '-e', '--eval', '-p', '--print', '--debug' | ||
'-h', '--help', '-e', '--eval', '-p', '--print', '--debug', '--sloppy' | ||
] as const; | ||
@@ -46,2 +46,3 @@ if (process.argv.length > 2) { | ||
-e, --eval <...> Evaluates given code and silently exits. | ||
--sloppy Runs the REPL in sloppy mode. | ||
@@ -48,0 +49,0 @@ * Options with <...> as argument must be passed last. |
@@ -6,3 +6,3 @@ import swc from '@swc/core'; | ||
sourceMaps: true, | ||
isModule: true, | ||
isModule: !process.argv.includes('--sloppy'), | ||
minify: false, | ||
@@ -9,0 +9,0 @@ swcrc: false, |
@@ -14,2 +14,3 @@ import swc from '@swc/core'; | ||
const safeUUID = () => StringReplaceAll(randomUUID(), '-', '') as string; | ||
const SLOPPY_MODE = process.argv.includes('--sloppy'); | ||
@@ -52,3 +53,3 @@ export default class Transpiler extends swc.Compiler { | ||
let importsData = [] as ({ requireVar: string, requireStr: string, info: replTranspiledImportInfo, uuid: string })[]; | ||
code = '"use strict";void 0;' + code | ||
code = (SLOPPY_MODE ? '' : '"use strict";void 0;') + code | ||
.replaceAll(/(?:var|let|const) (_.+?) = require\("(.+?)"\);[ \t\n;]*\/\*\$replTranspiledImport:({.+?})\*\//g, | ||
@@ -55,0 +56,0 @@ ($0, requireVar: string, requireStr: string, infoStr: string) => { |
Sorry, the diff of this file is not supported yet
265742
3945