Skip to content

Commit

Permalink
Update environment packages for ESM + exports
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman committed Nov 8, 2022
1 parent a4ad23e commit cd20907
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 16 deletions.
3 changes: 3 additions & 0 deletions packages/environment-ember-loose/-private/dsl/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export * from './without-function-resolution';

// Exported for `environment-ember-template-imports` to reuse
export type { ComponentKeyword } from '../intrinsics/component';

import { ResolveOrReturn } from '@glint/template/-private/dsl';
import {
DirectInvokable,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlintEnvironmentConfig, PathCandidate } from '@glint/config';
import { GlintEnvironmentConfig, PathCandidate } from '@glint/config/types';

const REGEXES = {
JS_SCRIPT_EXT: /\.js$/,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test, expect } from 'vitest';
import { GlintEnvironment } from '@glint/config/lib/environment';
import { GlintEnvironment } from '@glint/config';

describe('Environments: Ember Loose', () => {
test.each(['ts', 'js'])('finds possible template paths for %s script paths', (ext) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/environment-ember-loose/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.compileroptions.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
NamedArgsMarker,
} from '@glint/environment-ember-loose/-private/dsl';
import Component from '@ember/component';
import { ComponentKeyword } from '@glint/environment-ember-loose/-private/intrinsics/component';
import { ComponentKeyword } from '../../../-private/intrinsics/component';
import { WithBoundArgs, ComponentLike } from '@glint/template';

const componentKeyword = resolve({} as ComponentKeyword<LocalRegistry>);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectTypeOf } from 'expect-type';
import { Globals, NamedArgsMarker, resolve } from '@glint/environment-ember-loose/-private/dsl';
import { Mut } from '@glint/environment-ember-loose/-private/intrinsics/mut';
import { Mut } from '../../../-private/intrinsics/mut';

let fn = resolve(Globals['fn']);
let mut = resolve(Globals['mut']);
Expand Down
8 changes: 7 additions & 1 deletion packages/environment-ember-loose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
"author": "Dan Freeman (https://github.com/dfreeman)",
"glint-environment": "-private/environment/index.js",
"main": "-private/index.js",
"types": "-private/index.d.ts",
"exports": {
".": "./-private/index.js",
"./package.json": "./package.json",
"./registry": "./registry/index.js",
"./-private/dsl": "./-private/dsl/index.js",
"./-private/dsl/without-function-resolution": "./-private/dsl/without-function-resolution.js"
},
"keywords": [
"glint-environment"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentKeyword } from '@glint/environment-ember-loose/-private/intrinsics/component';
import { ComponentKeyword } from '@glint/environment-ember-loose/-private/dsl';
import { Globals as EELGlobals } from '@glint/environment-ember-loose/-private/dsl';

interface Keywords
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlintEnvironmentConfig } from '@glint/config';
import { GlintEnvironmentConfig } from '@glint/config/types';
import { preprocess } from './preprocess';
import { transform } from './transform';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlintExtensionPreprocess } from '@glint/config';
import { GlintExtensionPreprocess } from '@glint/config/types';
import { parseTemplates } from 'ember-template-imports';
import { GLOBAL_TAG, PreprocessData, TemplateLocation } from './common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as ts from 'typescript';
import { GlintExtensionTransform } from '@glint/config';
import { GlintExtensionTransform } from '@glint/config/types';
import { PreprocessData, GLOBAL_TAG, TemplateLocation } from './common';

type TSLib = typeof ts;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ts from 'typescript';
import * as ts from 'typescript';
import { stripIndent } from 'common-tags';
import { describe, test, expect } from 'vitest';
import { preprocess } from '../-private/environment/preprocess';
import { transform } from '../-private/environment/transform';
import { GlintEmitMetadata } from '@glint/config/lib/environment';
import { GlintEmitMetadata } from '@glint/config/types';

describe('Environment: ETI', () => {
describe('preprocess', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../../tsconfig.compileroptions.json",
"compilerOptions": { "rootDir": ".." },
"include": [".", "../-private"]
}
8 changes: 6 additions & 2 deletions packages/environment-ember-template-imports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
"description": "A Glint environment to support ember-template-imports projects",
"license": "MIT",
"author": "Dan Freeman (https://github.com/dfreeman)",
"glint-environment": "-private/environment",
"glint-environment": "-private/environment/index.js",
"main": "-private/index.js",
"types": "-private/index.d.ts",
"exports": {
".": "./-private/index.js",
"./package.json": "./package.json",
"./-private/dsl": "./-private/dsl/index.js"
},
"keywords": [
"glint-environment"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GlintEnvironmentConfig, GlintTagConfig } from '@glint/config';
import { GlintEnvironmentConfig, GlintTagConfig } from '@glint/config/types';

export default function glimmerxEnvironment(
config: Record<string, unknown>
Expand Down
9 changes: 7 additions & 2 deletions packages/environment-glimmerx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
"description": "A Glint environment to support GlimmerX projects",
"license": "MIT",
"author": "Dan Freeman (https://github.com/dfreeman)",
"main": "-private/index.js",
"types": "-private/index.d.ts",
"glint-environment": "-private/environment/index.js",
"main": "./-private/index.js",
"exports": {
".": "./-private/index.js",
"./package.json": "./package.json",
"./globals": "./globals/index.js",
"./-private/dsl": "./-private/dsl/index.js"
},
"keywords": [
"glint-environment"
],
Expand Down

0 comments on commit cd20907

Please sign in to comment.