Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3de2ce4
Add new fixture file
NullVoxPopuli Jun 6, 2025
13686db
unskip typescript tests
NullVoxPopuli Jun 6, 2025
e3ea6ea
Fix helper usage
NullVoxPopuli Jun 6, 2025
2755fc0
Delete the files from the typescript fixture that are no longer suppo…
NullVoxPopuli Jun 6, 2025
2bda45e
Fix paths
NullVoxPopuli Jun 6, 2025
aafffb4
Add and differentiate between tsconfig.publish and tsconfig
NullVoxPopuli Jun 6, 2025
dc1ebc6
Don't import from ember-cli-htmlbars
NullVoxPopuli Jun 6, 2025
3414f2f
Add @types/qunit
NullVoxPopuli Jun 6, 2025
a5827d5
Make the typescript tests more similar to the default tests
NullVoxPopuli Jun 6, 2025
73974ca
Fix dist assertions
NullVoxPopuli Jun 6, 2025
3cc821b
Assert that we don't pollute the src dir during declaration build
NullVoxPopuli Jun 6, 2025
93a2d47
Remove accidental extar types from copy-paste from nullui
NullVoxPopuli Jun 7, 2025
eefe3de
Everything now passes
NullVoxPopuli Jun 7, 2025
6e0d2a6
NPM doesn't support using tags as versions
NullVoxPopuli Jun 7, 2025
a1ce714
Revert "NPM doesn't support using tags as versions"
NullVoxPopuli Jun 7, 2025
0dcbfa2
We need the __ext__ on the test-helper.js/ts
NullVoxPopuli Jun 7, 2025
5187b05
Add @glint/tsserver-plugin for non-VSCode users
NullVoxPopuli Jun 7, 2025
adc57b2
Bump TS to 5.8
NullVoxPopuli Jun 7, 2025
86296ab
NPM needs a '--' to signify args should be passed to the underlying c…
NullVoxPopuli Jun 7, 2025
7772395
Actually use the typescript fixture. oops
NullVoxPopuli Jun 7, 2025
fdff098
Do all file diffs at once for clarity
NullVoxPopuli Jun 7, 2025
2d1cbe1
Check all generated files
NullVoxPopuli Jun 7, 2025
8d9416c
Change from unstable to alpha
NullVoxPopuli Jun 16, 2025
dd3a0bd
Alpha 0
NullVoxPopuli Jun 16, 2025
7378a8a
Bump glint versions
NullVoxPopuli Jun 17, 2025
43aa024
Add comments explaining publish vs not for babel/tsconfig
NullVoxPopuli Jun 18, 2025
30291c6
De-object the config files
NullVoxPopuli Jun 18, 2025
30540e6
Use npx for invoking glint, rather than pnpm/npm directly (simplifies…
NullVoxPopuli Jun 18, 2025
4cf6fd1
Switch to inline snapshot for the files list
NullVoxPopuli Jun 18, 2025
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
18 changes: 13 additions & 5 deletions files/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* This babel.config is not used for publishing.
* It's only for the local editing experience
* (and linting)
*/
const { buildMacros } = require('@embroider/macros/babel');

const {
Expand All @@ -12,11 +17,14 @@ const isCompat = Boolean(process.env.ENABLE_COMPAT_BUILD);

module.exports = {
plugins: [<% if (typescript) { %>
['@babel/plugin-transform-typescript', {
allExtensions: true,
allowDeclareFields: true,
onlyRemoveTypeImports: true,
}],<% } %>
[
'@babel/plugin-transform-typescript',
{
allExtensions: true,
allowDeclareFields: true,
onlyRemoveTypeImports: true,
},
],<% } %>
[
'babel-plugin-ember-template-compilation',
{
Expand Down
5 changes: 5 additions & 0 deletions files/babel.publish.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* This babel.config is only used for publishing.
*
* For local dev experience, see the babel.config
*/
module.exports = {
plugins: [<% if (typescript) { %>
[
Expand Down
17 changes: 10 additions & 7 deletions files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@
"@babel/plugin-transform-typescript": "^7.25.2",<% } %>
"@babel/runtime": "^7.25.6",
"@ember/test-helpers": "^5.2.1",
"@embroider/addon-dev": "^8.0.1",
"@embroider/addon-dev": "^8.1.0",
Comment thread
mansona marked this conversation as resolved.
"@embroider/core": "^4.1.0",
"@embroider/compat": "^4.1.0",
"@embroider/macros": "^1.18.0",
"@embroider/vite": "^1.1.5",
"@eslint/js": "^9.17.0",
"@glimmer/component": "^2.0.0",<% if (typescript) { %>
"@glint/core": "^1.4.0",
"@glint/environment-ember-loose": "^1.4.0",
"@glint/environment-ember-template-imports": "^1.4.0",
"@glint/template": "^1.4.0",
"@glint/core": "^2.0.0-alpha.2",
"@glint/environment-ember-loose": "^2.0.0-alpha.2",
"@glint/environment-ember-template-imports": "^2.0.0-alpha.2",
"@glint/tsserver-plugin": "^2.0.0-alpha.2",
"@glint/template": "^1.6.0-alpha.1",
"@ember/app-tsconfig": "^1.0.0",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used for the main tsconfig / test app

library tsconfig is now only for publish

"@ember/library-tsconfig": "^1.0.0",<% } %>
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-babel": "^6.0.4",<% if (typescript) { %>
"@types/qunit": "^2.19.12",<% } %>
"babel-plugin-ember-template-compilation": "^2.2.5",
"concurrently": "^9.0.1",
"ember-qunit": "^9.0.2",
Expand All @@ -70,7 +73,7 @@
"rollup": "^4.22.5",
"testem": "^3.15.1",<% if (typescript) { %>
"typescript-eslint": "^8.19.1",
"typescript": "~5.6.0",<% } %>
"typescript": "~5.8.3",<% } %>
"vite": "^6.2.4"
},
"ember": {
Expand Down
14 changes: 9 additions & 5 deletions files/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const addon = new Addon({
destDir: 'dist',
});

const rootDirectory = dirname(fileURLToPath(import.meta.url));
Comment thread
mansona marked this conversation as resolved.
const babelConfig = resolve(rootDirectory, './babel.publish.config.cjs');<% if (typescript) { %>
const tsConfig = resolve(rootDirectory, './tsconfig.publish.json');<% } %>

export default {
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
Expand Down Expand Up @@ -47,10 +51,7 @@ export default {
babel({
extensions: ['.js', '.gjs'<% if (typescript) { %>, '.ts', '.gts'<% } %>],
babelHelpers: 'bundled',
configFile: resolve(
dirname(fileURLToPath(import.meta.url)),
'./babel.publish.config.cjs',
),
configFile: babelConfig,
}),

// Ensure that standalone .hbs files are properly integrated as Javascript.
Expand All @@ -60,7 +61,10 @@ export default {
addon.gjs(),<% if (typescript) { %>

// Emit .d.ts declaration files
addon.declarations('declarations'),<% } %>
addon.declarations(
'declarations',
`npx glint --declaration --project ${tsConfig}`,
),<% } %>

// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
Expand Down
File renamed without changes.
27 changes: 9 additions & 18 deletions files/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
/**
* This tsconfig is not used for publishing.
Comment thread
mansona marked this conversation as resolved.
* It's only for the local editing experience
* (and linting)
*/
{
"extends": "@ember/library-tsconfig",
"include": ["src/**/*", "unpublished-development-types/**/*"],
"extends": "@ember/app-tsconfig",
"glint": {
"environment": ["ember-loose", "ember-template-imports"]
},
"include": ["src/**/*", "tests/**/*", "unpublished-development-types/**/*"],
"compilerOptions": {
"allowJs": true,
"declarationDir": "declarations",

/**
https://www.typescriptlang.org/tsconfig#rootDir
"Default: The longest common path of all non-declaration input files."

Because we want our declarations' structure to match our rollup output,
we need this "rootDir" to match the "srcDir" in the rollup.config.mjs.

This way, we can have simpler `package.json#exports` that matches
imports to files on disk
*/
"rootDir": "./src",

"types": ["ember-source/types"]
"rootDir": ".",
"types": ["ember-source/types", "vite/client", "@embroider/core/virtual"]
}
}
30 changes: 30 additions & 0 deletions files/tsconfig.publish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* This tsconfig is only used for publishing.
*
* For local dev experience, see the tsconfig.json
*/
{
Comment thread
NullVoxPopuli marked this conversation as resolved.
"extends": "@ember/library-tsconfig",
"include": ["./src/**/*", "./unpublished-development-types/**/*"],
"glint": {
"environment": ["ember-loose", "ember-template-imports"]
},
"compilerOptions": {
"allowJs": true,
"declarationDir": "declarations",

/**
https://www.typescriptlang.org/tsconfig#rootDir
"Default: The longest common path of all non-declaration input files."

Because we want our declarations' structure to match our rollup output,
we need this "rootDir" to match the "srcDir" in the rollup.config.mjs.

This way, we can have simpler `package.json#exports` that matches
imports to files on disk
*/
"rootDir": "./src",

"types": ["ember-source/types"]
}
}
40 changes: 40 additions & 0 deletions pnpm-lock.yaml

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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Component from '@glimmer/component';
import TemplateOnly from './template-only.ts';
import AnotherGts from './another-gts.gts'; // N.B. relative imports inside a v2 addon should have explicit file extensions (this is consistent with how node treats ES modules)
import { on } from '@ember/modifier';
import { action } from '@ember/object';
Expand All @@ -15,9 +14,9 @@ interface Signature {
export default class TemplateImport extends Component<Signature> {
<template>
<div ...attributes>
Hello from a GTS file but also <TemplateOnly /> and <AnotherGts />
Hello from a GTS file but also <AnotherGts />

<button {{on "click" (fn this.saySomething @saying)}}></button>
<button {{on "click" (fn this.saySomething @saying)}} type="button"></button>
</div>
</template>

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

import TemplateImport from '#src/components/template-import.gts';

module('Rendering | template-import', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
await render(hbs`<TemplateImport @saying="what" />`);
await render(<template><TemplateImport @saying="what" /></template>);

assert.dom().hasText('Hello from a GTS file but also Hello from a template-only component and Hello from another GTS file!');
assert.dom().hasText('Hello from a GTS file but also Hello from another GTS file!');
})
});
Loading