rewrite-imports
Advanced tools
Comparing version 2.0.3 to 3.0.0
{ | ||
"version": "3.0.0", | ||
"name": "rewrite-imports", | ||
"version": "2.0.3", | ||
"repository": "lukeed/rewrite-imports", | ||
"description": "Rewrite `import` statements as `require()`s; via RegExp", | ||
"module": "dist/rewrite.mjs", | ||
"unpkg": "dist/rewrite.min.js", | ||
"main": "dist/rewrite.js", | ||
"description": "A tiny (349B) utility to rewrite `import` statements as `require()`s; via RegExp", | ||
"module": "dist/index.mjs", | ||
"unpkg": "dist/index.min.js", | ||
"main": "dist/index.js", | ||
"types": "index.d.ts", | ||
"license": "MIT", | ||
@@ -13,3 +14,3 @@ "author": { | ||
"email": "luke.edwards05@gmail.com", | ||
"url": "lukeed.com" | ||
"url": "https://lukeed.com" | ||
}, | ||
@@ -19,10 +20,17 @@ "engines": { | ||
}, | ||
"scripts": { | ||
"build": "bundt", | ||
"pretest": "npm run build", | ||
"test": "tape test/*.js | tap-spec" | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"*.d.ts", | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "bundt", | ||
"test": "uvu -r esm test" | ||
}, | ||
"keywords": [ | ||
@@ -38,5 +46,5 @@ "regex", | ||
"bundt": "^0.3.0", | ||
"tap-spec": "^4.1.1", | ||
"tape": "^4.7.0" | ||
"esm": "3.2.25", | ||
"uvu": "0.5.1" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# rewrite-imports [![Build Status](https://travis-ci.org/lukeed/rewrite-imports.svg?branch=master)](https://travis-ci.org/lukeed/rewrite-imports) | ||
# rewrite-imports [![CI](https://github.com/lukeed/rewrite-imports/actions/workflows/ci.yml/badge.svg)](https://github.com/lukeed/rewrite-imports/actions/workflows/ci.yml) | ||
Transforms various `import` statements into `require()` calls, using regular expressions. | ||
A tiny (349B) utility to transform various `import` statements into `require()` calls, using regular expressions. | ||
@@ -38,17 +38,19 @@ > ***Looking for something _more_ backwards compatible?*** <br> | ||
```js | ||
const rImports = require('rewrite-imports'); | ||
import { rewrite } from 'rewrite-imports'; | ||
// or | ||
const { rewrite } = require('rewrite-imports'); | ||
rImports(`import foo from '../bar'`); | ||
rewrite(`import foo from '../bar'`); | ||
//=> const foo = require('../bar'); | ||
rImports(`import { foo } from 'bar'`); | ||
rewrite(`import { foo } from 'bar'`); | ||
//=> const { foo } = require('bar'); | ||
rImports(`import * as path from 'path';`); | ||
rewrite(`import * as path from 'path';`); | ||
//=> const path = require('path'); | ||
rImports(`import { foo as bar, baz as bat, lol } from 'quz';`); | ||
rewrite(`import { foo as bar, baz as bat, lol } from 'quz';`); | ||
//=> const { foo:bar, baz:bat, lol } = require('quz'); | ||
rImports(`import foobar, { foo as FOO, bar } from 'foobar';`); | ||
rewrite(`import foobar, { foo as FOO, bar } from 'foobar';`); | ||
//=> const foobar = require('foobar'); | ||
@@ -61,3 +63,3 @@ //=> const { foo:FOO, bar } = foobar; | ||
### rImports(input, fn) | ||
### rewrite(input, fn) | ||
@@ -64,0 +66,0 @@ #### input |
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
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
7281
7
80
33