rollup-plugin-string-import 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -126
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -142
- package/.vscode/extensions.json +0 -7
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/index.ts +0 -24
- package/tsconfig.json +0 -25
package/README.md
CHANGED
@@ -1,33 +1,15 @@
|
|
1
|
-
[npm]: https://img.shields.io/npm/v
|
2
|
-
[npm-url]: https://www.npmjs.com/package
|
3
|
-
[size]: https://packagephobia.now.sh/badge?p
|
4
|
-
[size-url]: https://packagephobia.now.sh/result?p
|
1
|
+
[npm]: https://img.shields.io/npm/v/rollup-plugin-string-import
|
2
|
+
[npm-url]: https://www.npmjs.com/package/rollup-plugin-string-import
|
3
|
+
[size]: https://packagephobia.now.sh/badge?p=rollup-plugin-string-import
|
4
|
+
[size-url]: https://packagephobia.now.sh/result?p=rollup-plugin-string-import
|
5
5
|
|
6
6
|
[![npm][npm]][npm-url]
|
7
7
|
[![size][size]][size-url]
|
8
8
|
[](https://liberamanifesto.com)
|
9
9
|
|
10
|
-
#
|
10
|
+
# rollup-plugin-string-import
|
11
11
|
|
12
|
-
🍣 A Rollup plugin
|
13
|
-
|
14
|
-
## Alias 101
|
15
|
-
|
16
|
-
Suppose we have the following `import` defined in a hypothetical file:
|
17
|
-
|
18
|
-
```javascript
|
19
|
-
import batman from '../../../batman';
|
20
|
-
```
|
21
|
-
|
22
|
-
This probably doesn't look too bad on its own. But consider that may not be the only instance in your codebase, and that after a refactor this might be incorrect. With this plugin in place, you can alias `../../../batman` with `batman` for readability and maintainability. In the case of a refactor, only the alias would need to be changed, rather than navigating through the codebase and changing all imports.
|
23
|
-
|
24
|
-
```javascript
|
25
|
-
import batman from 'batman';
|
26
|
-
```
|
27
|
-
|
28
|
-
If this seems familiar to Webpack users, it should. This is plugin mimics the `resolve.extensions` and `resolve.alias` functionality in Webpack.
|
29
|
-
|
30
|
-
This plugin will work for any file type that Rollup natively supports, or those which are [supported by third-party plugins](https://github.com/rollup/awesome#other-file-imports).
|
12
|
+
🍣 A Rollup plugin to import any file as a string with proper TypeScript support
|
31
13
|
|
32
14
|
## Requirements
|
33
15
|
|
@@ -35,12 +17,16 @@ This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v
|
|
35
17
|
|
36
18
|
## Install
|
37
19
|
|
38
|
-
Using npm
|
20
|
+
Using `npm`:
|
21
|
+
|
22
|
+
```bash
|
23
|
+
npm install -D rollup-plugin-string-import
|
24
|
+
```
|
25
|
+
|
26
|
+
or `yarn`
|
39
27
|
|
40
|
-
```
|
41
|
-
|
42
|
-
# or
|
43
|
-
yarn add -D @rollup/plugin-alias
|
28
|
+
```bash
|
29
|
+
yarn add -D rollup-plugin-string-import
|
44
30
|
```
|
45
31
|
|
46
32
|
## Usage
|
@@ -48,7 +34,7 @@ yarn add -D @rollup/plugin-alias
|
|
48
34
|
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:
|
49
35
|
|
50
36
|
```js
|
51
|
-
import
|
37
|
+
import { importAsString } from 'rollup-plugin-string-import';
|
52
38
|
|
53
39
|
export default {
|
54
40
|
input: 'src/index.js',
|
@@ -57,122 +43,57 @@ export default {
|
|
57
43
|
format: 'cjs',
|
58
44
|
},
|
59
45
|
plugins: [
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' },
|
64
|
-
],
|
46
|
+
importAsString({
|
47
|
+
include: ['**/*.txt', '**/*.frag', '**/*.vert'],
|
48
|
+
exclude: ['**/*.test.*'],
|
65
49
|
}),
|
66
50
|
],
|
67
51
|
};
|
68
52
|
```
|
69
53
|
|
70
|
-
Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).
|
71
|
-
|
72
|
-
## Options
|
73
|
-
|
74
|
-
### `customResolver`
|
75
|
-
|
76
|
-
Type: `Function | Object`<br>
|
77
|
-
Default: `null`
|
78
|
-
|
79
|
-
Instructs the plugin to use an alternative resolving algorithm, rather than the Rollup's resolver. Please refer to the [Rollup documentation](https://rollupjs.org/guide/en/#resolveid) for more information about the `resolveId` hook. For a detailed example, see: [Custom Resolvers](#custom-resolvers).
|
80
|
-
|
81
|
-
### `entries`
|
82
|
-
|
83
|
-
Type: `Object | Array[...Object]`<br>
|
84
|
-
Default: `null`
|
85
|
-
|
86
|
-
Specifies an `Object`, or an `Array` of `Object`, which defines aliases used to replace values in `import` or `require` statements. With either format, the order of the entries is important, in that the first defined rules are applied first. This option also supports [Regular Expression Alias](#regular-expression-aliases) matching.
|
87
|
-
|
88
|
-
_Note: Entry targets (the object key in the Object Format, or the `find` property value in the Array Format below) should not end with a trailing slash in most cases. If strange behavior is observed, double check the entries being passed in options._
|
89
|
-
|
90
|
-
#### `Object` Format
|
91
|
-
|
92
|
-
The `Object` format allows specifying aliases as a key, and the corresponding value as the actual `import` value. For example:
|
93
|
-
|
94
|
-
```js
|
95
|
-
alias({
|
96
|
-
entries: {
|
97
|
-
utils: '../../../utils',
|
98
|
-
'batman-1.0.0': './joker-1.5.0',
|
99
|
-
},
|
100
|
-
});
|
101
|
-
```
|
102
|
-
|
103
|
-
#### `Array[...Object]` Format
|
104
|
-
|
105
|
-
The `Array[...Object]` format allows specifying aliases as objects, which can be useful for complex key/value pairs.
|
54
|
+
Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).
|
55
|
+
In runtime, all matching files will be imported as strings, same as if they were defined in TypeScript files like this:
|
106
56
|
|
107
|
-
```
|
108
|
-
|
109
|
-
{ find: 'utils', replacement: '../../../utils' },
|
110
|
-
{ find: 'batman-1.0.0', replacement: './joker-1.5.0' },
|
111
|
-
];
|
57
|
+
```typescript
|
58
|
+
export default JSON.stringify('This is a text file content!');
|
112
59
|
```
|
113
60
|
|
114
|
-
|
115
|
-
|
116
|
-
Regular Expressions can be used to search in a more distinct and complex manner. e.g. To perform partial replacements via sub-pattern matching.
|
117
|
-
|
118
|
-
To remove something in front of an import and append an extension, use a pattern such as:
|
61
|
+
Optionally, you can create a `.d.ts` file to let TypeScript know that such imports should be treated as strings:
|
119
62
|
|
120
|
-
```
|
121
|
-
|
122
|
-
```
|
63
|
+
```typescript
|
64
|
+
// string-import.d.ts
|
123
65
|
|
124
|
-
|
66
|
+
declare module '*.txt' {
|
67
|
+
const file: string;
|
68
|
+
export default file;
|
69
|
+
}
|
125
70
|
|
126
|
-
|
71
|
+
declare module '*.vert' {
|
72
|
+
const file: string;
|
73
|
+
export default file;
|
74
|
+
}
|
127
75
|
|
128
|
-
|
129
|
-
|
76
|
+
declare module '*.frag' {
|
77
|
+
const file: string;
|
78
|
+
export default file;
|
79
|
+
}
|
130
80
|
```
|
131
81
|
|
132
|
-
|
133
|
-
|
134
|
-
## Resolving algorithm
|
82
|
+
## Options
|
135
83
|
|
136
|
-
|
84
|
+
### `include`
|
137
85
|
|
138
|
-
|
86
|
+
Type: `String` | `Array[...String]`<br>
|
139
87
|
|
140
|
-
|
88
|
+
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should operate on.
|
141
89
|
|
142
|
-
|
90
|
+
### `exclude`
|
143
91
|
|
144
|
-
|
145
|
-
|
146
|
-
import alias from '@rollup/plugin-alias';
|
147
|
-
import resolve from '@rollup/plugin-node-resolve';
|
92
|
+
Type: `String` | `Array[...String]`<br>
|
93
|
+
Default: `undefined`
|
148
94
|
|
149
|
-
|
150
|
-
extensions: ['.mjs', '.js', '.jsx', '.json', '.sass', '.scss'],
|
151
|
-
});
|
152
|
-
const projectRootDir = path.resolve(__dirname);
|
153
|
-
|
154
|
-
export default {
|
155
|
-
// ...
|
156
|
-
plugins: [
|
157
|
-
alias({
|
158
|
-
entries: [
|
159
|
-
{
|
160
|
-
find: 'src',
|
161
|
-
replacement: path.resolve(projectRootDir, 'src'),
|
162
|
-
// OR place `customResolver` here. See explanation below.
|
163
|
-
},
|
164
|
-
],
|
165
|
-
customResolver,
|
166
|
-
}),
|
167
|
-
resolve(),
|
168
|
-
],
|
169
|
-
};
|
170
|
-
```
|
171
|
-
|
172
|
-
In the example above the alias `src` is used, which uses the `node-resolve` algorithm for files _aliased_ with `src`, by passing the `customResolver` option. The `resolve()` plugin is kept separate in the plugins list for other files which are not _aliased_ with `src`. The `customResolver` option can be passed inside each `entries` item for granular control over resolving allowing each alias a preferred resolver.
|
95
|
+
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.
|
173
96
|
|
174
97
|
## Meta
|
175
98
|
|
176
|
-
|
177
|
-
|
178
|
-
[LICENSE (MIT)](/LICENSE)
|
99
|
+
Licensed under the GPL version 3.0 or higher
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9D,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACf,OAAO;oBACL,IAAI,EAAE,kBAAkB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;oBAC/C,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9D,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACf,OAAO;oBACL,IAAI,EAAE,kBAAkB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;oBAC/C,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rollup-plugin-string-import",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.1",
|
4
4
|
"description": "Import any file as a string",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"repository": "git@github.com:ExposedCat/rollup-plugin-string.git",
|
@@ -44,5 +44,8 @@
|
|
44
44
|
},
|
45
45
|
"peerDependencies": {
|
46
46
|
"rollup": "4.20.0"
|
47
|
-
}
|
47
|
+
},
|
48
|
+
"files": [
|
49
|
+
"dist/*"
|
50
|
+
]
|
48
51
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"root": true,
|
3
|
-
"env": { "browser": true, "es2020": true, "es6": true },
|
4
|
-
"parser": "@typescript-eslint/parser",
|
5
|
-
"plugins": [
|
6
|
-
"prettier",
|
7
|
-
"import",
|
8
|
-
"@typescript-eslint",
|
9
|
-
"github",
|
10
|
-
"functional",
|
11
|
-
"@stylistic"
|
12
|
-
],
|
13
|
-
"extends": [
|
14
|
-
"prettier",
|
15
|
-
"plugin:prettier/recommended",
|
16
|
-
"eslint:recommended",
|
17
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
18
|
-
"plugin:@typescript-eslint/recommended",
|
19
|
-
"plugin:import/errors",
|
20
|
-
"plugin:import/warnings",
|
21
|
-
"plugin:import/typescript",
|
22
|
-
"plugin:github/recommended"
|
23
|
-
],
|
24
|
-
"parserOptions": {
|
25
|
-
"sourceType": "module",
|
26
|
-
"ecmaVersion": "latest",
|
27
|
-
"ecmaFeatures": {
|
28
|
-
"jsx": true
|
29
|
-
},
|
30
|
-
"project": ["./tsconfig.json"]
|
31
|
-
},
|
32
|
-
"rules": {
|
33
|
-
"prettier/prettier": [
|
34
|
-
"error",
|
35
|
-
{
|
36
|
-
"arrowParens": "avoid",
|
37
|
-
"bracketSpacing": true,
|
38
|
-
"bracketSameLine": false,
|
39
|
-
"printWidth": 120,
|
40
|
-
"proseWrap": "preserve",
|
41
|
-
"requirePragma": false,
|
42
|
-
"semi": true,
|
43
|
-
"singleQuote": true,
|
44
|
-
"quoteProps": "preserve",
|
45
|
-
"tabWidth": 2,
|
46
|
-
"trailingComma": "all",
|
47
|
-
"useTabs": false,
|
48
|
-
"overrides": [
|
49
|
-
{
|
50
|
-
"files": "*.json",
|
51
|
-
"options": {
|
52
|
-
"printWidth": 200
|
53
|
-
}
|
54
|
-
}
|
55
|
-
]
|
56
|
-
},
|
57
|
-
{
|
58
|
-
"usePrettierrc": false
|
59
|
-
}
|
60
|
-
],
|
61
|
-
// ESLINT
|
62
|
-
"quote-props": ["error", "consistent"],
|
63
|
-
"filenames/match-regex": "off",
|
64
|
-
"eslint-comments/no-use": "off",
|
65
|
-
"eslint-comments/no-restricted-disable": "off",
|
66
|
-
"no-restricted-imports": "off",
|
67
|
-
"no-shadow": "off",
|
68
|
-
"camelcase": "off",
|
69
|
-
"no-restricted-globals": [
|
70
|
-
"error",
|
71
|
-
{
|
72
|
-
"name": "log",
|
73
|
-
"message": "Usage of global `log` is forbidden"
|
74
|
-
}
|
75
|
-
],
|
76
|
-
"i18n-text/no-en": "off",
|
77
|
-
"prefer-const": ["error"],
|
78
|
-
"no-undef": "off",
|
79
|
-
"no-unused-vars": "off",
|
80
|
-
"no-redeclare": "off",
|
81
|
-
"no-param-reassign": ["error"],
|
82
|
-
"no-warning-comments": ["warn", { "terms": ["todo", "fixme"] }],
|
83
|
-
"no-return-await": "off",
|
84
|
-
"no-invalid-this": "off",
|
85
|
-
"no-console": "off",
|
86
|
-
// TYPESCRIPT
|
87
|
-
"@typescript-eslint/no-floating-promises": "error",
|
88
|
-
"@typescript-eslint/ban-types": "error",
|
89
|
-
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
90
|
-
"@typescript-eslint/no-explicit-any": "off",
|
91
|
-
"@typescript-eslint/prefer-readonly": "off",
|
92
|
-
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
93
|
-
"@typescript-eslint/switch-exhaustiveness-check": "warn",
|
94
|
-
"@typescript-eslint/consistent-type-imports": "warn",
|
95
|
-
"@typescript-eslint/method-signature-style": ["warn", "property"],
|
96
|
-
"@typescript-eslint/no-invalid-this": "warn",
|
97
|
-
"@typescript-eslint/no-unused-vars": [
|
98
|
-
"error",
|
99
|
-
{
|
100
|
-
"vars": "all",
|
101
|
-
"args": "after-used",
|
102
|
-
"ignoreRestSiblings": true,
|
103
|
-
"argsIgnorePattern": "^_",
|
104
|
-
"varsIgnorePattern": "^_",
|
105
|
-
"caughtErrorsIgnorePattern": "^_"
|
106
|
-
}
|
107
|
-
],
|
108
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
109
|
-
"@typescript-eslint/no-shadow": "warn",
|
110
|
-
// IMPORT
|
111
|
-
"import/order": [
|
112
|
-
"error",
|
113
|
-
{
|
114
|
-
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
115
|
-
"pathGroups": [
|
116
|
-
{ "pattern": "./**", "group": "parent" },
|
117
|
-
{ "pattern": "~/**", "group": "parent" }
|
118
|
-
],
|
119
|
-
"newlines-between": "always",
|
120
|
-
"alphabetize": {
|
121
|
-
"order": "desc",
|
122
|
-
"orderImportKind": "desc",
|
123
|
-
"caseInsensitive": false
|
124
|
-
}
|
125
|
-
}
|
126
|
-
],
|
127
|
-
"import/extensions": "off",
|
128
|
-
"import/no-cycle": ["error"],
|
129
|
-
"import/no-unresolved": "off",
|
130
|
-
"import/default": "off",
|
131
|
-
"import/named": "off",
|
132
|
-
"import/no-deprecated": "warn",
|
133
|
-
"import/no-namespace": "off",
|
134
|
-
"import/no-named-as-default-member": "off"
|
135
|
-
},
|
136
|
-
"settings": {
|
137
|
-
"import/extensions": [".js", ".jsx"],
|
138
|
-
"import/parsers": {
|
139
|
-
"@typescript-eslint/parser": [".ts", ".tsx"]
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
package/.vscode/extensions.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2023.d.ts","../node_modules/typescript/lib/lib.esnext.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.es2023.array.d.ts","../node_modules/typescript/lib/lib.es2023.collection.d.ts","../node_modules/typescript/lib/lib.es2023.intl.d.ts","../node_modules/typescript/lib/lib.esnext.array.d.ts","../node_modules/typescript/lib/lib.esnext.collection.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../node_modules/typescript/lib/lib.esnext.string.d.ts","../node_modules/typescript/lib/lib.esnext.promise.d.ts","../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../node_modules/typescript/lib/lib.esnext.object.d.ts","../node_modules/typescript/lib/lib.esnext.regexp.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/tslib/tslib.d.ts","../node_modules/tslib/modules/index.d.ts","../node_modules/@types/estree/index.d.ts","../node_modules/rollup/dist/rollup.d.ts","../node_modules/@rollup/pluginutils/types/index.d.ts","../src/index.ts","../node_modules/@types/eslint/helpers.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/eslint/index.d.ts","../node_modules/@types/json5/index.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","17edc026abf73c5c2dd508652d63f68ec4efd9d4856e3469890d27598209feb5",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true},{"version":"0b11f3ca66aa33124202c80b70cd203219c3d4460cfc165e0707aa9ec710fc53","affectsGlobalScope":true},{"version":"6a3f5a0129cc80cf439ab71164334d649b47059a4f5afca90282362407d0c87f","affectsGlobalScope":true},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"4a882ffbb4ed09d9b7734f784aebb1dfe488d63725c40759165c5d9c657ca029","31973b272be35eab5ecf20a38ea54bec84cdc0317117590cb813c72fe0ef75b3","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea",{"version":"f443c4d2c86bd53c02107d3fa421c364b644c249ec06f962983239e8a8416475","affectsGlobalScope":true},"77b55f8bfab90aa408704132d98b72f8762e2fe955eeda093ace44120d6adc1a",{"version":"2652cc630110f4896acc61a1dfdc395cd4d1afc45a762f146a0c750767fc226c","signature":"8c66305fe80b7da1255236a414319d3705e2a47c7d4f7d90a7676e227d2c4563"},{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538"],"root":[79],"options":{"allowJs":true,"declaration":true,"downlevelIteration":true,"esModuleInterop":true,"importHelpers":true,"importsNotUsedAsValues":0,"jsx":4,"module":99,"outDir":"./","skipLibCheck":true,"sourceMap":true,"strict":true,"target":99},"fileIdsList":[[76,77],[76,77,80,81],[74],[75,77,78]],"referencedMap":[[78,1],[82,2],[77,1],[75,3],[79,4]]},"version":"5.5.2"}
|
package/src/index.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import type { Plugin } from 'rollup';
|
2
|
-
import { createFilter } from '@rollup/pluginutils';
|
3
|
-
import type { FilterPattern } from '@rollup/pluginutils';
|
4
|
-
|
5
|
-
export type ImportAsStringOptions = {
|
6
|
-
include: FilterPattern;
|
7
|
-
exclude?: FilterPattern;
|
8
|
-
};
|
9
|
-
|
10
|
-
export function importAsString(options: ImportAsStringOptions): Plugin {
|
11
|
-
const filter = createFilter(options.include, options.exclude);
|
12
|
-
|
13
|
-
return {
|
14
|
-
name: 'importAsString',
|
15
|
-
transform(code, id) {
|
16
|
-
if (filter(id)) {
|
17
|
-
return {
|
18
|
-
code: `export default ${JSON.stringify(code)};`,
|
19
|
-
map: { mappings: '' },
|
20
|
-
};
|
21
|
-
}
|
22
|
-
},
|
23
|
-
};
|
24
|
-
}
|
package/tsconfig.json
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
4
|
-
"isolatedModules": true,
|
5
|
-
"esModuleInterop": true,
|
6
|
-
"moduleResolution": "Bundler",
|
7
|
-
"resolveJsonModule": true,
|
8
|
-
"importsNotUsedAsValues": "remove",
|
9
|
-
"target": "ESNext",
|
10
|
-
"module": "ESNext",
|
11
|
-
"strict": true,
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
13
|
-
"sourceMap": true,
|
14
|
-
"incremental": true,
|
15
|
-
"allowJs": true,
|
16
|
-
"skipLibCheck": true,
|
17
|
-
"downlevelIteration": true,
|
18
|
-
"importHelpers": true,
|
19
|
-
"maxNodeModuleJsDepth": 2,
|
20
|
-
"declaration": true,
|
21
|
-
"jsx": "react-jsx",
|
22
|
-
"outDir": "./dist",
|
23
|
-
},
|
24
|
-
"include": ["src/**/*"]
|
25
|
-
}
|