mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Allow minifiers to get source path of file
This commit is contained in:
@@ -127,8 +127,7 @@ const mergeCss = Profile("mergeCss", async function (css, postcssConfig) {
|
||||
const result = await postcssConfig.postcss(
|
||||
postcssConfig.plugins
|
||||
).process(content, {
|
||||
// TODO: provide a better way to get the file's path
|
||||
from: process.cwd() + file._source.url?.replace('/__cordova', ''),
|
||||
from: file.getSourcePath(),
|
||||
parser: postcssConfig.options.parser
|
||||
});
|
||||
|
||||
|
||||
@@ -1126,11 +1126,17 @@ class Target {
|
||||
return null;
|
||||
}
|
||||
|
||||
let sourcePath;
|
||||
if (resource.data && resource.sourceRoot && resource.sourcePath) {
|
||||
sourcePath = files.pathJoin(resource.sourceRoot, resource.sourcePath);
|
||||
}
|
||||
|
||||
const file = new File({
|
||||
info: 'resource ' + resource.servePath,
|
||||
arch: target.arch,
|
||||
data: resource.data,
|
||||
hash: resource.hash,
|
||||
sourcePath
|
||||
});
|
||||
|
||||
file.setTargetPathFromRelPath(
|
||||
@@ -1279,13 +1285,18 @@ class Target {
|
||||
return;
|
||||
}
|
||||
|
||||
let sourcePath;
|
||||
if (resource.data && resource.sourceRoot && resource.sourcePath) {
|
||||
sourcePath = files.pathJoin(resource.sourceRoot, resource.sourcePath);
|
||||
}
|
||||
const f = new File({
|
||||
info: 'resource ' + resource.servePath,
|
||||
arch: this.arch,
|
||||
data: resource.data,
|
||||
hash: resource.hash,
|
||||
cacheable: false,
|
||||
replaceable: resource.type === 'js' && sourceBatch.hmrAvailable
|
||||
replaceable: resource.type === 'js' && sourceBatch.hmrAvailable,
|
||||
sourcePath
|
||||
});
|
||||
|
||||
const relPath = stripLeadingSlash(resource.servePath);
|
||||
|
||||
@@ -892,6 +892,7 @@ class OutputResource {
|
||||
sourcePath,
|
||||
targetPath,
|
||||
servePath,
|
||||
sourceRoot: resourceSlot.packageSourceBatch.sourceRoot,
|
||||
// Remember the source hash so that changes to the source that
|
||||
// disappear after compilation can still contribute to the hash.
|
||||
// Bypassing SourceResource.hash getter so if the compiler plugin doesn't
|
||||
|
||||
@@ -36,6 +36,9 @@ class InputFile extends buildPluginModule.InputFile {
|
||||
getArch() {
|
||||
return this._arch;
|
||||
}
|
||||
getSourcePath() {
|
||||
return this._source.sourcePath || null;
|
||||
}
|
||||
|
||||
error({message, sourcePath, line, column, func}) {
|
||||
const relPath = this.getPathInBundle();
|
||||
|
||||
Reference in New Issue
Block a user