diff --git a/src/modules/commands/bundling.ts b/src/modules/commands/bundling.ts index 066d47d..61a5363 100644 --- a/src/modules/commands/bundling.ts +++ b/src/modules/commands/bundling.ts @@ -192,7 +192,7 @@ export async function bundling(buildOptions: TCommandBuildOptions, bundleOption: const inlineDeclarationsRendered = await TemplateContainer.evaluate( CE_TEMPLATE_NAME.DECLARATION_FILE_TEMPLATE, { - options: { quote: bundleOption.quote }, + options: { quote: bundleOption.quote, useSemicolon: bundleOption.useSemicolon }, declarations: getInlineDeclarationRenderData(inlineDeclarations, bundleOption), }, ); diff --git a/src/templates/modules/__tests__/get.inline.declaration.render.data.test.ts b/src/templates/modules/__tests__/get.inline.declaration.render.data.test.ts index a726ef2..6054ba3 100644 --- a/src/templates/modules/__tests__/get.inline.declaration.render.data.test.ts +++ b/src/templates/modules/__tests__/get.inline.declaration.render.data.test.ts @@ -43,7 +43,7 @@ describe('getInlineDeclarationRenderData', () => { tag: '@ctix-declaration', pos: { line: 0, column: 0, start: 0 }, workspaces: undefined, - relativePath: '../c/d/a', + importPath: '../c/d/a', extname: { origin: '.ts', render: '.js' }, }, { @@ -52,7 +52,7 @@ describe('getInlineDeclarationRenderData', () => { tag: '@ctix-declaration', pos: { line: 0, column: 0, start: 0 }, workspaces: undefined, - relativePath: '../c/e/b', + importPath: '../c/e/b', extname: { origin: '.ts', render: '.js' }, }, ]); @@ -95,7 +95,7 @@ describe('getInlineDeclarationRenderData', () => { tag: '@ctix-declaration', pos: { line: 0, column: 0, start: 0 }, workspaces: undefined, - relativePath: `./${pathe.join(process.cwd(), '/a/b/c/d/a')}`, + importPath: `./${pathe.join(process.cwd(), '/a/b/c/d/a')}`, extname: { origin: '.ts', render: '.js' }, }, { @@ -104,7 +104,7 @@ describe('getInlineDeclarationRenderData', () => { tag: '@ctix-declaration', pos: { line: 0, column: 0, start: 0 }, workspaces: undefined, - relativePath: `./${pathe.join(process.cwd(), '/a/b/c/e/b')}`, + importPath: `./${pathe.join(process.cwd(), '/a/b/c/e/b')}`, extname: { origin: '.ts', render: '.js' }, }, ]); diff --git a/src/templates/modules/getInlineDeclarationRenderData.ts b/src/templates/modules/getInlineDeclarationRenderData.ts index 91f5b2d..d996557 100644 --- a/src/templates/modules/getInlineDeclarationRenderData.ts +++ b/src/templates/modules/getInlineDeclarationRenderData.ts @@ -19,14 +19,14 @@ export function getInlineDeclarationRenderData( const dirname = pathe.dirname(declaration.filePath); const basename = pathe.basename(declaration.filePath, extname); - const relativePath = + const importPath = options.output != null ? addCurrentDirPrefix(posixRelative(options.output, pathe.join(dirname, basename))) : replaceSepToPosix(`.${path.posix.sep}${pathe.join(dirname, basename)}`); return { ...declaration, - relativePath, + importPath, extname: { origin: extname, render: renderExtname, diff --git a/src/templates/templates/declarationFileTemplate.ts b/src/templates/templates/declarationFileTemplate.ts index 25b444d..6614d93 100644 --- a/src/templates/templates/declarationFileTemplate.ts +++ b/src/templates/templates/declarationFileTemplate.ts @@ -1,6 +1,5 @@ export const declarationFileTemplate = ` <%- it.declarations.forEach((declaration) => { -%> -import <%-= it.options.quote %><%= declaration.relativePath %><%= declaration.extname.render %><%= it.options.quote -%> - +import <%-= it.options.quote %><%= declaration.importPath %><%= declaration.extname.render %><%= it.options.quote -%><%- if (it.options.useSemicolon) { -%><%-= ";" -%><%- } -%><%= "\\n" %> <%- }) %> `;