rollup-plugin-external-assets
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -0,1 +1,8 @@ | ||
## [2.2.1](https://github.com/soufyakoub/rollup-plugin-external-assets/compare/v2.2.0...v2.2.1) (2021-03-13) | ||
### Bug Fixes | ||
* correct export assignments in declaration files ([8fed136](https://github.com/soufyakoub/rollup-plugin-external-assets/commit/8fed136fd9a9e64a50b946ea53066f5a5ad14d73)) | ||
# [2.2.0](https://github.com/soufyakoub/rollup-plugin-external-assets/compare/v2.1.1...v2.2.0) (2021-03-08) | ||
@@ -2,0 +9,0 @@ |
@@ -9,3 +9,2 @@ import { Plugin } from "rollup"; | ||
declare function externalAssets(pattern: FilterPattern): Plugin; | ||
export { externalAssets as default }; | ||
export = externalAssets; |
@@ -163,9 +163,9 @@ 'use strict'; | ||
ecmaVersion: "latest", | ||
locations: true, // Needed by `recast` to preserve code formatting. | ||
locations: true | ||
}); | ||
}, | ||
} | ||
}; | ||
ast = recast.parse(code, { | ||
sourceFileName: chunk_basename, | ||
parser: customParser, | ||
parser: customParser | ||
}); | ||
@@ -188,3 +188,3 @@ recast.visit(ast, { | ||
source: fs__default['default'].readFileSync(target_id), | ||
name: path__default['default'].basename(target_id), | ||
name: path__default['default'].basename(target_id) | ||
}); | ||
@@ -201,3 +201,3 @@ // Get a relative path from this chunk to the emitted asset. | ||
this.traverse(nodePath); | ||
}, | ||
} | ||
}); | ||
@@ -207,7 +207,7 @@ result = recast.print(ast, { sourceMapName: chunk_basename + ".map" }); | ||
code: result.code, | ||
map: result.map, | ||
map: result.map | ||
}]; | ||
}); | ||
}); | ||
}, | ||
} | ||
}; | ||
@@ -214,0 +214,0 @@ } |
@@ -10,2 +10,1 @@ import { Plugin } from "rollup"; | ||
export { externalAssets as default }; | ||
export = externalAssets; |
@@ -155,9 +155,9 @@ import fs from 'fs'; | ||
ecmaVersion: "latest", | ||
locations: true, // Needed by `recast` to preserve code formatting. | ||
locations: true | ||
}); | ||
}, | ||
} | ||
}; | ||
ast = parse(code, { | ||
sourceFileName: chunk_basename, | ||
parser: customParser, | ||
parser: customParser | ||
}); | ||
@@ -180,3 +180,3 @@ visit(ast, { | ||
source: fs.readFileSync(target_id), | ||
name: path.basename(target_id), | ||
name: path.basename(target_id) | ||
}); | ||
@@ -193,3 +193,3 @@ // Get a relative path from this chunk to the emitted asset. | ||
this.traverse(nodePath); | ||
}, | ||
} | ||
}); | ||
@@ -199,7 +199,7 @@ result = print(ast, { sourceMapName: chunk_basename + ".map" }); | ||
code: result.code, | ||
map: result.map, | ||
map: result.map | ||
}]; | ||
}); | ||
}); | ||
}, | ||
} | ||
}; | ||
@@ -206,0 +206,0 @@ } |
{ | ||
"name": "rollup-plugin-external-assets", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A rollup plugin to make assets external but include them in the output.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -10,2 +10,4 @@ [](https://www.npmjs.com/package/rollup-plugin-external-assets) | ||
:memo: Since library bundling is the primary use of this plugin, dynamic imports are not supported. Use at your own risk. | ||
## Installation | ||
@@ -58,6 +60,8 @@ | ||
```javascript | ||
// Process imports that reference images in the <working dir>/assets directory. | ||
// Operate on images located in the ./assets directory. | ||
externalAssets("assets/**/*.jpg"); | ||
// Process imports that reference images in the <working dir>/assets directory, and all stylesheet files. | ||
externalAssets(["assets/**/*.{jpg,png}", /\.(css|scss)$/]) | ||
// Operate on images located in the ./assets directory. | ||
// and all stylesheet files. | ||
externalAssets(["assets/**/*.{jpg,png}", /\.(css|scss)$/]); | ||
``` | ||
@@ -93,5 +97,2 @@ | ||
:memo: You might want to redirect snapshot diffs somewhere else instead of `stdout`. | ||
Checkout this [issue][7] for the package that produces the diffs. | ||
Note that rollup may emit warnings for unspecified options, or for some other reasons. | ||
@@ -98,0 +99,0 @@ I made sure they are ignored with the `no-rollup-warnings` flag in the npm test script. |
81281
135
419