rollup-plugin-string-import 1.1.3 → 1.2.3
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 +3 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -55,7 +55,9 @@ Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#comma
|
|
55
55
|
In runtime, all matching files will be imported as strings, same as if they were defined in TypeScript files like this:
|
56
56
|
|
57
57
|
```typescript
|
58
|
-
export default
|
58
|
+
export default `This is a
|
59
|
+
text file
|
60
|
+
content!`;
|
59
61
|
```
|
60
62
|
|
61
63
|
Optionally, you can create a `.d.ts` file to let TypeScript know that such imports should be treated as strings:
|
package/dist/index.js
CHANGED
@@ -6,9 +6,9 @@ export function importAsString(options) {
|
|
6
6
|
name: 'importAsString',
|
7
7
|
transform(code, id) {
|
8
8
|
if (filter(id)) {
|
9
|
-
const content =
|
9
|
+
const content = transform(code, id).replaceAll('`', '`');
|
10
10
|
return {
|
11
|
-
code: `export default
|
11
|
+
code: `export default \`${content}\`;`,
|
12
12
|
map: { mappings: '' },
|
13
13
|
};
|
14
14
|
}
|
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;AASnD,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC;IAErE,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASnD,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC;IAErE,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACzD,OAAO;oBACL,IAAI,EAAE,oBAAoB,OAAO,KAAK;oBACtC,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|