Skip to content

Commit f81d4f6

Browse files
authored
Remove rollup-plugin-ts (#203)
* chore: Temporarily committed dist * chore: Removed rollup-plugin-ts * chore: Temporarily committed declarations and dist * bugfix: Removed .hbs from extensions * chore: Committed dist * chore: Reverted committing declarations and dist * bug: Use glint -d * Revert "bug: Use glint -d" This reverts commit ccc9fe0. * bugfix: Generalized scripts and TS configurations (works for both tsc and glint) * Revert "bugfix: Generalized scripts and TS configurations (works for both tsc and glint)" This reverts commit ae9e11e. * Revert "Revert "bug: Use glint -d"" This reverts commit 0ad7200. * bugfix: Removed @glint-ignore comment, which had caused TypeScript to error when noEmitOnError is set to true --------- Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
1 parent bd5d0d1 commit f81d4f6

File tree

10 files changed

+120
-214
lines changed

10 files changed

+120
-214
lines changed

ember-container-query/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/blueprints/*/files/
33

44
# compiled output
5+
/declarations/
56
/dist/
67

78
# misc

ember-container-query/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# compiled output
2+
/declarations/
23
/dist/
34

45
# dependencies

ember-container-query/package.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@
2121
"license": "MIT",
2222
"author": "Isaac J. Lee",
2323
"exports": {
24-
".": "./dist/index.js",
24+
".": {
25+
"types": "./declarations/index.d.ts",
26+
"default": "./dist/index.js"
27+
},
2528
"./*": {
26-
"types": "./dist/*.d.ts",
29+
"types": "./declarations/*.d.ts",
2730
"default": "./dist/*.js"
2831
},
2932
"./addon-main.js": "./addon-main.cjs"
3033
},
3134
"typesVersions": {
3235
"*": {
3336
"*": [
34-
"dist/*"
37+
"declarations/*"
3538
]
3639
}
3740
},
@@ -41,10 +44,13 @@
4144
},
4245
"files": [
4346
"addon-main.cjs",
47+
"declarations",
4448
"dist"
4549
],
4650
"scripts": {
47-
"build": "rollup --config",
51+
"build": "concurrently \"npm:build:*\" --names \"build:\"",
52+
"build:js": "rollup --config",
53+
"build:types": "glint --declaration",
4854
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
4955
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
5056
"lint:hbs": "ember-template-lint .",
@@ -53,7 +59,9 @@
5359
"lint:js:fix": "eslint . --fix",
5460
"lint:types": "glint",
5561
"prepack": "rollup --config",
56-
"start": "rollup --config --watch",
62+
"start": "concurrently \"npm:start:*\" --names \"start:\"",
63+
"start:js": "rollup --config --watch --no-watch.clearScreen",
64+
"start:types": "glint --declaration --watch",
5765
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
5866
},
5967
"dependencies": {
@@ -75,6 +83,8 @@
7583
"@glint/core": "^1.0.2",
7684
"@glint/environment-ember-loose": "^1.0.2",
7785
"@glint/template": "^1.0.2",
86+
"@rollup/plugin-babel": "^6.0.3",
87+
"@rollup/plugin-node-resolve": "^15.1.0",
7888
"@tsconfig/ember": "^2.0.0",
7989
"@types/ember__component": "^4.0.14",
8090
"@types/ember__destroyable": "^4.0.2",
@@ -97,7 +107,6 @@
97107
"prettier": "^2.8.8",
98108
"rollup": "^3.25.1",
99109
"rollup-plugin-copy": "^3.4.0",
100-
"rollup-plugin-ts": "^3.2.0",
101110
"typescript": "^5.1.3"
102111
},
103112
"engines": {

ember-container-query/rollup.config.mjs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { Addon } from '@embroider/addon-dev/rollup';
2+
import { babel } from '@rollup/plugin-babel';
3+
import { nodeResolve } from '@rollup/plugin-node-resolve';
24
import copy from 'rollup-plugin-copy';
3-
import typescript from 'rollup-plugin-ts';
45

56
const addon = new Addon({
67
srcDir: 'src',
78
destDir: 'dist',
89
});
910

11+
// Add extensions here, such as ts, gjs, etc that you may import
12+
const extensions = ['.js', '.ts'];
13+
1014
export default {
1115
// This provides defaults that work well alongside `publicEntrypoints` below.
1216
// You can augment this if you need to.
@@ -41,11 +45,20 @@ export default {
4145
// package names.
4246
addon.dependencies(),
4347

44-
// compile TypeScript to latest JavaScript, including Babel transpilation
45-
typescript({
46-
transpiler: 'babel',
47-
browserslist: false,
48-
transpileOnly: false,
48+
// This babel config should *not* apply presets or compile away ES modules.
49+
// It exists only to provide development niceties for you, like automatic
50+
// template colocation.
51+
//
52+
// By default, this will load the actual babel config from the file
53+
// babel.config.json.
54+
babel({
55+
babelHelpers: 'bundled',
56+
extensions,
57+
}),
58+
59+
// Allows rollup to resolve imports of files with the specified extensions
60+
nodeResolve({
61+
extensions,
4962
}),
5063

5164
// Ensure that standalone .hbs files are properly integrated as Javascript.

ember-container-query/src/components/container-query.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-ignore: ember-element-helper needs to provide Glint signature }}
21
{{#let (element this.tagName) as |Tag|}}
32
<Tag
43
class="container-query"

ember-container-query/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@tsconfig/ember/tsconfig.json",
33
"compilerOptions": {
4+
"declarationDir": "declarations",
45
"skipLibCheck": true
56
},
67
"include": [

ember-container-query/unpublished-development-types/index.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@
33

44
import '@glint/environment-ember-loose';
55

6+
import { ComponentLike, HelperLike } from '@glint/template';
7+
68
import EmberContainerQueryRegistry from '../src/template-registry';
79

10+
interface ElementHelperSignature<T extends string> {
11+
Args: {
12+
Positional: [name: T];
13+
};
14+
Return: ComponentLike<{
15+
Blocks: { default: [] };
16+
Element: T extends keyof HTMLElementTagNameMap
17+
? HTMLElementTagNameMap[T]
18+
: Element;
19+
}>;
20+
}
21+
822
declare module '@glint/environment-ember-loose/registry' {
923
export default interface Registry extends EmberContainerQueryRegistry {
1024
// Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates)
1125
// See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons
26+
element: HelperLike<ElementHelperSignature>;
1227
}
1328
}

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,5 @@
3939
"enhance: documentation": "Documentation",
4040
"user feedback": "User Feedback"
4141
}
42-
},
43-
"pnpm": {
44-
"patchedDependencies": {
45-
"rollup-plugin-ts@3.2.0": "patches/rollup-plugin-ts@3.2.0.patch"
46-
}
4742
}
4843
}

patches/rollup-plugin-ts@3.2.0.patch

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)