Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Dec 18, 2023
1 parent a29069b commit 83f87c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const TEMPLATE_START = `[${GLOBAL_TAG}\``;
const TEMPLATE_END = '`]';

// content-tag 1.2.2:
// The current file is a CommonJS module whose imports will produce 'require' calls;
// however, the referenced file is an ECMAScript module and cannot be imported with 'require'.
// The current file is a CommonJS module whose imports will produce 'require' calls;
// however, the referenced file is an ECMAScript module and cannot be imported with 'require'.
// Consider writing a dynamic 'import("content-tag")' call instead.
// To convert this file to an ECMAScript module, change its file extension to '.mts',
// To convert this file to an ECMAScript module, change its file extension to '.mts',
// or add the field `"type": "module"` to 'glint/packages/environment-ember-template-imports/package.json'.ts(1479)
//
// ...Except,
// > the referenced file is an ECMAScript module
// ...Except,
// > the referenced file is an ECMAScript module
//
// package.json#exports does refer to a cjs file if required, so TS should be resolving the `require`
// entries not the `import` entries.
Expand Down Expand Up @@ -56,21 +56,24 @@ export const preprocess: GlintExtensionPreprocess<PreprocessData> = (source, pat
let prefixingSegment = sourceBuffer.slice(sourceOffsetBytes, startTagOffsetBytes);
segments.push(prefixingSegment.toString());
segments.push(TEMPLATE_START);

// For TEMPLATE_START & TEMPLATE_END, characters === bytes
deltaBytes += startTagLengthBytes - TEMPLATE_START.length;

let transformedEnd = endTagOffsetBytes - deltaBytes + TEMPLATE_END.length;

let templateContentSegment = sourceBuffer.slice(startTagOffsetBytes + startTagLengthBytes, endTagOffsetBytes);
let templateContentSegment = sourceBuffer.slice(
startTagOffsetBytes + startTagLengthBytes,
endTagOffsetBytes
);
segments.push(templateContentSegment.toString());
segments.push(TEMPLATE_END);
deltaBytes += endTagLengthBytes - TEMPLATE_END.length;

sourceOffsetBytes = endTagOffsetBytes + endTagLengthBytes;

// TODO: is there a way to convert bytes to chars?
// I think maybe all of this code needs to live in content-tag,
// TODO: is there a way to convert bytes to chars?
// I think maybe all of this code needs to live in content-tag,
// and give us the option to generate this sort of structure
templateLocations.push({
startTagOffset: startTagOffsetBytes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export default interface Globals {
// used to hang any macros off of that are provided by config.additionalGlobals
}
}

0 comments on commit 83f87c7

Please sign in to comment.