-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0552e19
commit e224226
Showing
2 changed files
with
67 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,58 @@ | ||
diff --git a/node_modules/@web/rollup-plugin-import-meta-assets/src/rollup-plugin-import-meta-assets.js b/node_modules/@web/rollup-plugin-import-meta-assets/src/rollup-plugin-import-meta-assets.js | ||
index 1d0280c..f4aeb21 100644 | ||
index 1d0280c..1d2e461 100644 | ||
--- a/node_modules/@web/rollup-plugin-import-meta-assets/src/rollup-plugin-import-meta-assets.js | ||
+++ b/node_modules/@web/rollup-plugin-import-meta-assets/src/rollup-plugin-import-meta-assets.js | ||
@@ -58,10 +58,14 @@ function importMetaAssets({ include, exclude, warnOnError, transform } = {}) { | ||
@@ -58,10 +58,13 @@ function importMetaAssets({ include, exclude, warnOnError, transform } = {}) { | ||
name: 'rollup-plugin-import-meta-assets', | ||
|
||
async transform(code, id) { | ||
+ console.log({ id }); | ||
if (!filter(id)) { | ||
+ console.log('NULL @@@@@', { code }); | ||
return null; | ||
} | ||
|
||
+ console.log('here!?!!?!?!'); | ||
+ console.log('here!?!!?!?!', { id }); | ||
+ | ||
const ast = this.parse(code); | ||
const magicString = new MagicString(code); | ||
let modifiedCode = false; | ||
@@ -74,6 +77,7 @@ function importMetaAssets({ include, exclude, warnOnError, transform } = {}) { | ||
const absoluteAssetPath = path.resolve(absoluteScriptDir, relativeAssetPath); | ||
const assetName = path.basename(absoluteAssetPath); | ||
|
||
+ console.log({ absoluteAssetPath, absoluteScriptDir, relativeAssetPath }); | ||
try { | ||
const assetContents = await fs.promises.readFile(absoluteAssetPath); | ||
const transformedAssetContents = | ||
@@ -83,11 +87,20 @@ function importMetaAssets({ include, exclude, warnOnError, transform } = {}) { | ||
if (transformedAssetContents === null) { | ||
return; | ||
} | ||
+ // https://github.com/rollup/rollup/blob/v2.79.1/docs/05-plugin-development.md#thisemitfile | ||
const ref = this.emitFile({ | ||
- type: 'asset', | ||
+ type: 'chunk', | ||
+ id: absoluteAssetPath, | ||
+ // preserveSignature: 'strict' | ||
name: assetName, | ||
- source: transformedAssetContents, | ||
+ // source: transformedAssetContents, | ||
}); | ||
+ // const ref = this.emitFile({ | ||
+ // type: 'asset', | ||
+ // name: assetName, | ||
+ // source: transformedAssetContents, | ||
+ // }); | ||
+ console.log({ ref }); | ||
magicString.overwrite( | ||
node.arguments[0].start, | ||
node.arguments[0].end, | ||
@@ -105,6 +118,8 @@ function importMetaAssets({ include, exclude, warnOnError, transform } = {}) { | ||
}, | ||
}); | ||
|
||
+ console.log('((((((((((((((((('); | ||
+ | ||
return { | ||
code: magicString.toString(), | ||
map: modifiedCode ? magicString.generateMap({ hires: true }) : null, |