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 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 JSON.stringify('This is a text file content!');
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 = JSON.stringify(transform(code, id));
9
+ const content = transform(code, id).replaceAll('`', '`');
10
10
  return {
11
- code: `export default ${JSON.stringify(content)};`,
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,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;gBACpD,OAAO;oBACL,IAAI,EAAE,kBAAkB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG;oBAClD,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup-plugin-string-import",
3
- "version": "1.1.3",
3
+ "version": "1.2.3",
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-import.git",