Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export type declaration maps *.d.mts.map #4154

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/govuk-frontend/.npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Ignore diff fixtures
*.html

# Ignore test files
*.test.*

# Ignore config build tools
src/govuk-prototype-kit/*.mjs
1 change: 1 addition & 0 deletions packages/govuk-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"types": "dist/govuk/all.d.mts",
"sass": "dist/govuk/all.scss",
"files": [
"src",
"dist",
"govuk-prototype-kit.config.json",
"package.json",
Expand Down
3 changes: 2 additions & 1 deletion packages/govuk-frontend/tasks/build/package.unit.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ describe('packages/govuk-frontend/dist/', () => {
mapPathTo(['**/*.mjs'], ({ dir: requirePath, name }) => [
join(requirePath, `${name}.mjs`),
join(requirePath, `${name}.mjs.map`), // with source map
join(requirePath, `${name}.d.mts`) // with type declaration
join(requirePath, `${name}.d.mts`), // with type declaration
join(requirePath, `${name}.d.mts.map`) // with type declaration map
])
)

Expand Down
2 changes: 2 additions & 0 deletions packages/govuk-frontend/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"exclude": ["**/*.test.*"],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"lib": ["ESNext", "DOM"],
"noEmit": false,
"outDir": "./dist",
"rootDir": "./src",
"sourceMap": true,
"strict": true,
"target": "ES2015",
"types": ["node", "typed-query-selector"]
Expand Down
3 changes: 2 additions & 1 deletion shared/tasks/scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export async function compileJavaScript([
preserveModulesRoot: relative(basePath, srcPath),

// Enable source maps
sourcemap: true
sourcemap: true,
sourcemapExcludeSources: !!output.preserveModules
})
})
)
Expand Down
4 changes: 3 additions & 1 deletion shared/tasks/styles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export async function compileStylesheet([
*/
map: {
annotation: true,
inline: false
inline: false,
sourcesContent: false
}
}

Expand Down Expand Up @@ -114,6 +115,7 @@ export async function compileStylesheet([
// Pass source maps to PostCSS
if (typeof options.map === 'object') {
options.map.prev = map
options.map.sourcesContent = true
}
}

Expand Down