Initial commit (by create-cloudflare CLI)

This commit is contained in:
J-onasJones 2023-09-14 18:58:13 +02:00
commit 58a42872a0
1745 changed files with 741893 additions and 0 deletions

125
node_modules/rollup-pluginutils/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,125 @@
# rollup-pluginutils changelog
## 2.8.2
*2019-09-13*
* Handle optional catch parameter in attachScopes ([#70](https://github.com/rollup/rollup-pluginutils/pulls/70))
## 2.8.1
*2019-06-04*
* Support serialization of many edge cases ([#64](https://github.com/rollup/rollup-pluginutils/issues/64))
## 2.8.0
*2019-05-30*
* Bundle updated micromatch dependency ([#60](https://github.com/rollup/rollup-pluginutils/issues/60))
## 2.7.1
*2019-05-17*
* Do not ignore files with a leading "." in createFilter ([#62](https://github.com/rollup/rollup-pluginutils/issues/62))
## 2.7.0
*2019-05-15*
* Add `resolve` option to createFilter ([#59](https://github.com/rollup/rollup-pluginutils/issues/59))
## 2.6.0
*2019-04-04*
* Add `extractAssignedNames` ([#59](https://github.com/rollup/rollup-pluginutils/issues/59))
* Provide dedicated TypeScript typings file ([#58](https://github.com/rollup/rollup-pluginutils/issues/58))
## 2.5.0
*2019-03-18*
* Generalize dataToEsm type ([#55](https://github.com/rollup/rollup-pluginutils/issues/55))
* Handle empty keys in dataToEsm ([#56](https://github.com/rollup/rollup-pluginutils/issues/56))
## 2.4.1
*2019-02-16*
* Remove unnecessary dependency
## 2.4.0
*2019-02-16*
Update dependencies to solve micromatch vulnerability ([#53](https://github.com/rollup/rollup-pluginutils/issues/53))
## 2.3.3
*2018-09-19*
* Revert micromatch update ([#43](https://github.com/rollup/rollup-pluginutils/issues/43))
## 2.3.2
*2018-09-18*
* Bumb micromatch dependency ([#36](https://github.com/rollup/rollup-pluginutils/issues/36))
* Bumb dependencies ([#41](https://github.com/rollup/rollup-pluginutils/issues/41))
* Split up tests ([#40](https://github.com/rollup/rollup-pluginutils/issues/40))
## 2.3.1
*2018-08-06*
* Fixed ObjectPattern scope in attachScopes to recognise { ...rest } syntax ([#37](https://github.com/rollup/rollup-pluginutils/issues/37))
## 2.3.0
*2018-05-21*
* Add option to not generate named exports ([#32](https://github.com/rollup/rollup-pluginutils/issues/32))
## 2.2.1
*2018-05-21*
* Support `null` serialization ([#34](https://github.com/rollup/rollup-pluginutils/issues/34))
## 2.2.0
*2018-05-11*
* Improve white-space handling in `dataToEsm` and add `prepare` script ([#31](https://github.com/rollup/rollup-pluginutils/issues/31))
## 2.1.1
*2018-05-09*
* Update dependencies
## 2.1.0
*2018-05-08*
* Add `dataToEsm` helper to create named exports from objects ([#29](https://github.com/rollup/rollup-pluginutils/issues/29))
* Support literal keys in object patterns ([#27](https://github.com/rollup/rollup-pluginutils/issues/27))
* Support function declarations without id in `attachScopes` ([#28](https://github.com/rollup/rollup-pluginutils/issues/28))
## 2.0.1
*2017-01-03*
* Don't add extension to file with trailing dot ([#14](https://github.com/rollup/rollup-pluginutils/issues/14))
## 2.0.0
*2017-01-03*
* Use `micromatch` instead of `minimatch` ([#19](https://github.com/rollup/rollup-pluginutils/issues/19))
* Allow `createFilter` to take regexes ([#5](https://github.com/rollup/rollup-pluginutils/issues/5))
## 1.5.2
*2016-08-29*
* Treat `arguments` as a reserved word ([#10](https://github.com/rollup/rollup-pluginutils/issues/10))
## 1.5.1
*2016-06-24*
* Add all declarators in a var declaration to scope, not just the first
## 1.5.0
*2016-06-07*
* Exclude IDs with null character (`\0`)
## 1.4.0
*2016-06-07*
* Workaround minimatch issue ([#6](https://github.com/rollup/rollup-pluginutils/pull/6))
* Exclude non-string IDs in `createFilter`
## 1.3.1
*2015-12-16*
* Build with Rollup directly, rather than via Gobble
## 1.3.0
*2015-12-16*
* Use correct path separator on Windows
## 1.2.0
*2015-11-02*
* Add `attachScopes` and `makeLegalIdentifier`
## 1.1.0
2015-10-24*
* Add `addExtension` function
## 1.0.1
*2015-10-24*
* Include dist files in package
## 1.0.0
*2015-10-24*
* First release

169
node_modules/rollup-pluginutils/README.md generated vendored Normal file
View file

@ -0,0 +1,169 @@
# rollup-pluginutils
A set of functions commonly used by Rollup plugins.
## Installation
```bash
npm install --save rollup-pluginutils
```
## Usage
### addExtension
```js
import { addExtension } from 'rollup-pluginutils';
export default function myPlugin ( options = {} ) {
return {
resolveId ( code, id ) {
// only adds an extension if there isn't one already
id = addExtension( id ); // `foo` -> `foo.js`, `foo.js -> foo.js`
id = addExtension( id, '.myext' ); // `foo` -> `foo.myext`, `foo.js -> `foo.js`
}
};
}
```
### attachScopes
This function attaches `Scope` objects to the relevant nodes of an AST. Each `Scope` object has a `scope.contains(name)` method that returns `true` if a given name is defined in the current scope or a parent scope.
See [rollup-plugin-inject](https://github.com/rollup/rollup-plugin-inject) or [rollup-plugin-commonjs](https://github.com/rollup/rollup-plugin-commonjs) for an example of usage.
```js
import { attachScopes } from 'rollup-pluginutils';
import { walk } from 'estree-walker';
export default function myPlugin ( options = {} ) {
return {
transform ( code ) {
const ast = this.parse( code );
let scope = attachScopes( ast, 'scope' );
walk( ast, {
enter ( node ) {
if ( node.scope ) scope = node.scope;
if ( !scope.contains( 'foo' ) ) {
// `foo` is not defined, so if we encounter it,
// we assume it's a global
}
},
leave ( node ) {
if ( node.scope ) scope = scope.parent;
}
});
}
};
}
```
### createFilter
```js
import { createFilter } from 'rollup-pluginutils';
export default function myPlugin ( options = {} ) {
// `options.include` and `options.exclude` can each be a minimatch
// pattern, or an array of minimatch patterns, relative to process.cwd()
var filter = createFilter( options.include, options.exclude );
return {
transform ( code, id ) {
// if `options.include` is omitted or has zero length, filter
// will return `true` by default. Otherwise, an ID must match
// one or more of the minimatch patterns, and must not match
// any of the `options.exclude` patterns.
if ( !filter( id ) ) return;
// proceed with the transformation...
}
};
}
```
If you want to resolve the patterns against a directory other than
`process.cwd()`, you can additionally pass a `resolve` option:
```js
var filter = createFilter( options.include, options.exclude, {resolve: '/my/base/dir'} )
```
If `resolve` is a string, then this value will be used as the base directory.
Relative paths will be resolved against `process.cwd()` first. If `resolve` is
`false`, then the patterns will not be resolved against any directory. This can
be useful if you want to create a filter for virtual module names.
### makeLegalIdentifier
```js
import { makeLegalIdentifier } from 'rollup-pluginutils';
makeLegalIdentifier( 'foo-bar' ); // 'foo_bar'
makeLegalIdentifier( 'typeof' ); // '_typeof'
```
### dataToEsm
Helper for treeshakable data imports
```js
import { dataToEsm } from 'rollup-pluginutils';
const esModuleSource = dataToEsm({
custom: 'data',
to: ['treeshake']
}, {
compact: false,
indent: '\t',
preferConst: false,
objectShorthand: false,
namedExports: true
});
/*
Outputs the string ES module source:
export const custom = 'data';
export const to = ['treeshake'];
export default { custom, to };
*/
```
### extractAssignedNames
Extract the names of all assignment targets from patterns.
```js
import { extractAssignedNames } from 'rollup-pluginutils';
import { walk } from 'estree-walker';
export default function myPlugin ( options = {} ) {
return {
transform ( code ) {
const ast = this.parse( code );
walk( ast, {
enter ( node ) {
if ( node.type === 'VariableDeclarator' ) {
const declaredNames = extractAssignedNames(node.id);
// do something with the declared names
// e.g. for `const {x, y: z} = ... => declaredNames = ['x', 'z']
}
}
});
}
};
}
```
## License
MIT

3292
node_modules/rollup-pluginutils/dist/pluginutils.cjs.js generated vendored Normal file

File diff suppressed because it is too large Load diff

39
node_modules/rollup-pluginutils/dist/pluginutils.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
import { Node } from 'estree-walker';
export interface AttachedScope {
parent?: AttachedScope;
isBlockScope: boolean;
declarations: { [key: string]: boolean };
addDeclaration(node: Node, isBlockDeclaration: boolean, isVar: boolean): void;
contains(name: string): boolean;
}
export interface DataToEsmOptions {
compact?: boolean;
indent?: string;
namedExports?: boolean;
objectShorthand?: boolean;
preferConst?: boolean;
}
export type AddExtension = (filename: string, ext?: string) => string;
export const addExtension: AddExtension;
export type AttachScopes = (ast: Node, propertyName?: string) => AttachedScope;
export const attachScopes: AttachScopes;
export type CreateFilter = (
include?: Array<string | RegExp> | string | RegExp | null,
exclude?: Array<string | RegExp> | string | RegExp | null,
options?: { resolve?: string | false | null }
) => (id: string | any) => boolean;
export const createFilter: CreateFilter;
export type MakeLegalIdentifier = (str: string) => string;
export const makeLegalIdentifier: MakeLegalIdentifier;
export type DataToEsm = (data: any, options?: DataToEsmOptions) => string;
export const dataToEsm: DataToEsm;
export type ExtractAssignedNames = (param: Node) => Array<string>;
export const extractAssignedNames: ExtractAssignedNames;

3280
node_modules/rollup-pluginutils/dist/pluginutils.es.js generated vendored Normal file

File diff suppressed because it is too large Load diff

57
node_modules/rollup-pluginutils/package.json generated vendored Normal file
View file

@ -0,0 +1,57 @@
{
"name": "rollup-pluginutils",
"description": "Functionality commonly needed by Rollup plugins",
"version": "2.8.2",
"main": "dist/pluginutils.cjs.js",
"module": "dist/pluginutils.es.js",
"jsnext:main": "dist/pluginutils.es.js",
"typings": "dist/pluginutils.d.ts",
"files": [
"src",
"dist",
"README.md"
],
"devDependencies": {
"@types/estree": "0.0.39",
"@types/jest": "^24.0.13",
"@types/micromatch": "^3.1.0",
"@types/node": "^12.0.4",
"husky": "^3.0.5",
"jest": "^24.8.0",
"lint-staged": "^9.2.5",
"micromatch": "^4.0.2",
"prettier": "^1.17.1",
"rollup": "^1.13.1",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-node-resolve": "^5.0.1",
"rollup-plugin-typescript": "^1.0.1",
"shx": "^0.3.2",
"ts-jest": "^24.0.2",
"tslint": "^5.17.0",
"typescript": "^3.5.1",
"typescript-eslint-parser": "^22.0.0"
},
"scripts": {
"test": "jest",
"build": "rollup -c && shx cp src/pluginutils.d.ts dist/pluginutils.d.ts",
"lint": "npm run lint:nofix -- --fix",
"lint:nofix": "tslint --project .",
"pretest": "npm run build",
"prepublishOnly": "npm test",
"prepare": "npm run build"
},
"dependencies": {
"estree-walker": "^0.6.1"
},
"repository": "rollup/rollup-pluginutils",
"keywords": [
"rollup",
"utils"
],
"author": "Rich Harris <richard.a.harris@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/rollup/rollup-pluginutils/issues"
},
"homepage": "https://github.com/rollup/rollup-pluginutils#readme"
}

9
node_modules/rollup-pluginutils/src/addExtension.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
import { extname } from 'path';
import { AddExtension } from './pluginutils';
const addExtension: AddExtension = function addExtension(filename, ext = '.js') {
if (!extname(filename)) filename += ext;
return filename;
};
export { addExtension as default };

125
node_modules/rollup-pluginutils/src/attachScopes.ts generated vendored Normal file
View file

@ -0,0 +1,125 @@
import { Node, walk } from 'estree-walker';
import extractAssignedNames from './extractAssignedNames';
import { AttachedScope, AttachScopes } from './pluginutils';
const blockDeclarations = {
const: true,
let: true
};
interface ScopeOptions {
parent?: AttachedScope;
block?: boolean;
params?: Array<Node>;
}
class Scope implements AttachedScope {
parent?: AttachedScope;
isBlockScope: boolean;
declarations: { [key: string]: boolean };
constructor(options: ScopeOptions = {}) {
this.parent = options.parent;
this.isBlockScope = !!options.block;
this.declarations = Object.create(null);
if (options.params) {
options.params.forEach(param => {
extractAssignedNames(param).forEach(name => {
this.declarations[name] = true;
});
});
}
}
addDeclaration(node: Node, isBlockDeclaration: boolean, isVar: boolean): void {
if (!isBlockDeclaration && this.isBlockScope) {
// it's a `var` or function node, and this
// is a block scope, so we need to go up
this.parent!.addDeclaration(node, isBlockDeclaration, isVar);
} else if (node.id) {
extractAssignedNames(node.id).forEach(name => {
this.declarations[name] = true;
});
}
}
contains(name: string): boolean {
return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
}
}
const attachScopes: AttachScopes = function attachScopes(ast, propertyName = 'scope') {
let scope = new Scope();
walk(ast, {
enter(node, parent) {
// function foo () {...}
// class Foo {...}
if (/(Function|Class)Declaration/.test(node.type)) {
scope.addDeclaration(node, false, false);
}
// var foo = 1
if (node.type === 'VariableDeclaration') {
const kind: keyof typeof blockDeclarations = node.kind;
const isBlockDeclaration = blockDeclarations[kind];
node.declarations.forEach((declaration: Node) => {
scope.addDeclaration(declaration, isBlockDeclaration, true);
});
}
let newScope: AttachedScope | undefined;
// create new function scope
if (/Function/.test(node.type)) {
newScope = new Scope({
parent: scope,
block: false,
params: node.params
});
// named function expressions - the name is considered
// part of the function's scope
if (node.type === 'FunctionExpression' && node.id) {
newScope.addDeclaration(node, false, false);
}
}
// create new block scope
if (node.type === 'BlockStatement' && !/Function/.test(parent!.type)) {
newScope = new Scope({
parent: scope,
block: true
});
}
// catch clause has its own block scope
if (node.type === 'CatchClause') {
newScope = new Scope({
parent: scope,
params: node.param ? [node.param] : [],
block: true
});
}
if (newScope) {
Object.defineProperty(node, propertyName, {
value: newScope,
configurable: true
});
scope = newScope;
}
},
leave(node) {
if (node[propertyName]) scope = scope.parent!;
}
});
return scope;
};
export { attachScopes as default };

52
node_modules/rollup-pluginutils/src/createFilter.ts generated vendored Normal file
View file

@ -0,0 +1,52 @@
import mm from 'micromatch';
import { resolve, sep } from 'path';
import { CreateFilter } from './pluginutils';
import ensureArray from './utils/ensureArray';
function getMatcherString(id: string, resolutionBase: string | false | null | undefined) {
if (resolutionBase === false) {
return id;
}
return resolve(...(typeof resolutionBase === 'string' ? [resolutionBase, id] : [id]));
}
const createFilter: CreateFilter = function createFilter(include?, exclude?, options?) {
const resolutionBase = options && options.resolve;
const getMatcher = (id: string | RegExp) => {
return id instanceof RegExp
? id
: {
test: mm.matcher(
getMatcherString(id, resolutionBase)
.split(sep)
.join('/'),
{ dot: true }
)
};
};
const includeMatchers = ensureArray(include).map(getMatcher);
const excludeMatchers = ensureArray(exclude).map(getMatcher);
return function(id: string | any): boolean {
if (typeof id !== 'string') return false;
if (/\0/.test(id)) return false;
id = id.split(sep).join('/');
for (let i = 0; i < excludeMatchers.length; ++i) {
const matcher = excludeMatchers[i];
if (matcher.test(id)) return false;
}
for (let i = 0; i < includeMatchers.length; ++i) {
const matcher = includeMatchers[i];
if (matcher.test(id)) return true;
}
return !includeMatchers.length;
};
};
export { createFilter as default };

92
node_modules/rollup-pluginutils/src/dataToEsm.ts generated vendored Normal file
View file

@ -0,0 +1,92 @@
import makeLegalIdentifier from './makeLegalIdentifier';
import { DataToEsm } from './pluginutils';
export type Indent = string | null | undefined;
function stringify(obj: any): string {
return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, char => `\\u${('000' + char.charCodeAt(0).toString(16)).slice(-4)}`);
}
function serializeArray<T>(arr: Array<T>, indent: Indent, baseIndent: string): string {
let output = '[';
const separator = indent ? '\n' + baseIndent + indent : '';
for (let i = 0; i < arr.length; i++) {
const key = arr[i];
output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`;
}
return output + `${indent ? '\n' + baseIndent : ''}]`;
}
function serializeObject<T>(obj: { [key: string]: T }, indent: Indent, baseIndent: string): string {
let output = '{';
const separator = indent ? '\n' + baseIndent + indent : '';
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key);
output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(
obj[key],
indent,
baseIndent + indent
)}`;
}
return output + `${indent ? '\n' + baseIndent : ''}}`;
}
function serialize(obj: any, indent: Indent, baseIndent: string): string {
if (obj === Infinity) return 'Infinity';
if (obj === -Infinity) return '-Infinity';
if (obj === 0 && 1/obj === -Infinity) return '-0';
if (obj instanceof Date) return 'new Date(' + obj.getTime() + ')';
if (obj instanceof RegExp) return obj.toString();
if (obj !== obj) return 'NaN';
if (Array.isArray(obj)) return serializeArray(obj, indent, baseIndent);
if (obj === null) return 'null';
if (typeof obj === 'object') return serializeObject(obj, indent, baseIndent);
return stringify(obj);
}
const dataToEsm: DataToEsm = function dataToEsm(data, options = {}) {
const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
const _ = options.compact ? '' : ' ';
const n = options.compact ? '' : '\n';
const declarationType = options.preferConst ? 'const' : 'var';
if (
options.namedExports === false ||
typeof data !== 'object' ||
Array.isArray(data) ||
data instanceof Date ||
data instanceof RegExp ||
data === null
) {
const code = serialize(data, options.compact ? null : t, '');
const __ = _ || (/^[{[\-\/]/.test(code) ? '' : ' ');
return `export default${__}${code};`;
}
let namedExportCode = '';
const defaultExportRows = [];
const dataKeys = Object.keys(data);
for (let i = 0; i < dataKeys.length; i++) {
const key = dataKeys[i];
if (key === makeLegalIdentifier(key)) {
if (options.objectShorthand) defaultExportRows.push(key);
else defaultExportRows.push(`${key}:${_}${key}`);
namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(
data[key],
options.compact ? null : t,
''
)};${n}`;
} else {
defaultExportRows.push(
`${stringify(key)}:${_}${serialize(data[key], options.compact ? null : t, '')}`
);
}
}
return (
namedExportCode + `export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`
);
};
export { dataToEsm as default };

View file

@ -0,0 +1,46 @@
import { Node } from 'estree-walker';
interface Extractors {
[key: string]: (names: Array<string>, param: Node) => void;
}
const extractors: Extractors = {
ArrayPattern(names: Array<string>, param: Node) {
for (const element of param.elements) {
if (element) extractors[element.type](names, element);
}
},
AssignmentPattern(names: Array<string>, param: Node) {
extractors[param.left.type](names, param.left);
},
Identifier(names: Array<string>, param: Node) {
names.push(param.name);
},
MemberExpression() {},
ObjectPattern(names: Array<string>, param: Node) {
for (const prop of param.properties) {
if (prop.type === 'RestElement') {
extractors.RestElement(names, prop);
} else {
extractors[prop.value.type](names, prop.value);
}
}
},
RestElement(names: Array<string>, param: Node) {
extractors[param.argument.type](names, param.argument);
}
};
const extractAssignedNames = function extractAssignedNames(param: Node): Array<string> {
const names: Array<string> = [];
extractors[param.type](names, param);
return names;
};
export { extractAssignedNames as default };

6
node_modules/rollup-pluginutils/src/index.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
export { default as addExtension } from './addExtension';
export { default as attachScopes } from './attachScopes';
export { default as createFilter } from './createFilter';
export { default as makeLegalIdentifier } from './makeLegalIdentifier';
export { default as dataToEsm } from './dataToEsm';
export { default as extractAssignedNames } from './extractAssignedNames';

View file

@ -0,0 +1,21 @@
import { MakeLegalIdentifier } from './pluginutils';
const reservedWords =
'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
const builtins =
'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
const forbiddenIdentifiers = new Set<string>(`${reservedWords} ${builtins}`.split(' '));
forbiddenIdentifiers.add('');
export const makeLegalIdentifier: MakeLegalIdentifier = function makeLegalIdentifier(str) {
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, '_');
if (/\d/.test(str[0]) || forbiddenIdentifiers.has(str)) {
str = `_${str}`;
}
return str || '_';
};
export { makeLegalIdentifier as default };

39
node_modules/rollup-pluginutils/src/pluginutils.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
import { Node } from 'estree-walker';
export interface AttachedScope {
parent?: AttachedScope;
isBlockScope: boolean;
declarations: { [key: string]: boolean };
addDeclaration(node: Node, isBlockDeclaration: boolean, isVar: boolean): void;
contains(name: string): boolean;
}
export interface DataToEsmOptions {
compact?: boolean;
indent?: string;
namedExports?: boolean;
objectShorthand?: boolean;
preferConst?: boolean;
}
export type AddExtension = (filename: string, ext?: string) => string;
export const addExtension: AddExtension;
export type AttachScopes = (ast: Node, propertyName?: string) => AttachedScope;
export const attachScopes: AttachScopes;
export type CreateFilter = (
include?: Array<string | RegExp> | string | RegExp | null,
exclude?: Array<string | RegExp> | string | RegExp | null,
options?: { resolve?: string | false | null }
) => (id: string | any) => boolean;
export const createFilter: CreateFilter;
export type MakeLegalIdentifier = (str: string) => string;
export const makeLegalIdentifier: MakeLegalIdentifier;
export type DataToEsm = (data: any, options?: DataToEsmOptions) => string;
export const dataToEsm: DataToEsm;
export type ExtractAssignedNames = (param: Node) => Array<string>;
export const extractAssignedNames: ExtractAssignedNames;

View file

@ -0,0 +1,5 @@
export default function ensureArray<T>(thing: Array<T> | T | undefined | null): Array<T> {
if (Array.isArray(thing)) return thing;
if (thing == undefined) return [];
return [thing];
}