Skip to content

Commit

Permalink
Merge pull request #1784 from vstefanovic97/main
Browse files Browse the repository at this point in the history
Bump content-tag and add inline_source_map option for rollup and vite
  • Loading branch information
NullVoxPopuli authored Feb 1, 2024
2 parents f361b71 + e43f5d5 commit b10d4db
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/addon-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@embroider/core": "workspace:^",
"@rollup/pluginutils": "^4.1.1",
"content-tag": "^1.1.2",
"content-tag": "^2.0.1",
"fs-extra": "^10.0.0",
"minimatch": "^3.0.4",
"rollup-plugin-copy-assets": "^2.0.3",
Expand Down
9 changes: 7 additions & 2 deletions packages/addon-dev/src/rollup-gjs-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const PLUGIN_NAME = 'rollup-gjs-plugin';
const processor = new Preprocessor();
// import { parse as pathParse } from 'path';

export default function rollupGjsPlugin(): Plugin {
export default function rollupGjsPlugin(
{ inline_source_map } = { inline_source_map: false }
): Plugin {
return {
name: PLUGIN_NAME,

Expand All @@ -17,7 +19,10 @@ export default function rollupGjsPlugin(): Plugin {
return null;
}
let input = readFileSync(id, 'utf8');
let code = processor.process(input, id);
let code = processor.process(input, {
filename: id,
inline_source_map,
});
return {
code,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@embroider/macros": "workspace:*",
"@rollup/pluginutils": "^4.1.1",
"assert-never": "^1.2.1",
"content-tag": "^1.1.2",
"content-tag": "^2.0.1",
"debug": "^4.3.2",
"esbuild": "^0.17.19",
"fs-extra": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/esbuild-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function esBuildResolver(root = process.cwd()): EsBuildPlugin {
build.onLoad({ filter: /\.g[jt]s$/ }, async ({ path: filename }) => {
const code = readFileSync(filename, 'utf8');

const result = transform(preprocessor.process(code, filename), {
const result = transform(preprocessor.process(code, { filename }), {
configFile: join(process.cwd(), 'babel.config.js'),
filename,
});
Expand Down
7 changes: 5 additions & 2 deletions packages/vite/src/template-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Preprocessor } from 'content-tag';

const gjsFilter = createFilter('**/*.{gjs,gts}?(\\?)*');

export function templateTag(): Plugin {
export function templateTag({ inline_source_map } = { inline_source_map: false }): Plugin {
let preprocessor = new Preprocessor();

function candidates(id: string) {
Expand Down Expand Up @@ -43,7 +43,10 @@ export function templateTag(): Plugin {
if (!gjsFilter(id)) {
return null;
}
return preprocessor.process(code, id);
return preprocessor.process(code, {
filename: id,
inline_source_map: inline_source_map,
});
},
};
}
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b10d4db

Please sign in to comment.