ember-repl 2.0.62 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +31 -0
  2. package/addon-main.cjs +5 -0
  3. package/dist/browser/cjs/eval.d.ts +10 -0
  4. package/dist/browser/cjs/eval.d.ts.map +1 -0
  5. package/dist/browser/cjs/eval.js +22 -0
  6. package/dist/browser/cjs/eval.js.map +1 -0
  7. package/dist/browser/cjs/index.d.ts +7 -0
  8. package/dist/browser/cjs/index.js +43 -0
  9. package/dist/browser/cjs/index.js.map +1 -0
  10. package/dist/browser/esm/index.d.ts +8 -0
  11. package/dist/browser/esm/index.js +67 -0
  12. package/dist/browser/esm/index.js.map +1 -0
  13. package/dist/browser/eti/babel-plugin.d.ts +54 -0
  14. package/dist/browser/eti/babel-plugin.js +95 -0
  15. package/dist/browser/eti/babel-plugin.js.map +1 -0
  16. package/dist/browser/eti/debug.d.ts +2 -0
  17. package/dist/browser/eti/debug.js +9 -0
  18. package/dist/browser/eti/debug.js.map +1 -0
  19. package/dist/browser/eti/parse-templates.d.ts +56 -0
  20. package/dist/browser/eti/parse-templates.js +181 -0
  21. package/dist/browser/eti/parse-templates.js.map +1 -0
  22. package/dist/browser/eti/preprocess.d.ts +57 -0
  23. package/dist/browser/eti/preprocess.js +271 -0
  24. package/dist/browser/eti/preprocess.js.map +1 -0
  25. package/dist/browser/eti/template-tag-transform.d.ts +15 -0
  26. package/dist/browser/eti/template-tag-transform.js +46 -0
  27. package/dist/browser/eti/template-tag-transform.js.map +1 -0
  28. package/dist/browser/eti/util.d.ts +14 -0
  29. package/dist/browser/eti/util.js +39 -0
  30. package/dist/browser/eti/util.js.map +1 -0
  31. package/dist/browser/gjs.d.ts +4 -0
  32. package/dist/browser/gjs.js +40 -0
  33. package/dist/browser/gjs.js.map +1 -0
  34. package/{hbs.d.ts → dist/browser/hbs.d.ts} +3 -6
  35. package/dist/browser/hbs.js +94 -0
  36. package/dist/browser/hbs.js.map +1 -0
  37. package/dist/browser/index.d.ts +5 -0
  38. package/dist/browser/index.js +5 -0
  39. package/dist/browser/index.js.map +1 -0
  40. package/{js.d.ts → dist/browser/js.d.ts} +3 -6
  41. package/dist/browser/js.js +38 -0
  42. package/dist/browser/js.js.map +1 -0
  43. package/{known-modules.d.ts → dist/browser/known-modules.d.ts} +6 -3
  44. package/dist/browser/known-modules.js +48 -0
  45. package/dist/browser/known-modules.js.map +1 -0
  46. package/dist/browser/types.d.ts +17 -0
  47. package/dist/browser/types.js +2 -0
  48. package/dist/browser/types.js.map +1 -0
  49. package/{utils.d.ts → dist/browser/utils.d.ts} +8 -3
  50. package/dist/browser/utils.js +46 -0
  51. package/dist/browser/utils.js.map +1 -0
  52. package/dist/build/ember-cli.cjs +36 -0
  53. package/package.json +98 -125
  54. package/{addon → src/browser}/cjs/eval.ts +9 -5
  55. package/src/browser/cjs/index.ts +44 -0
  56. package/src/browser/esm/index.ts +80 -0
  57. package/src/browser/eti/babel-plugin.ts +105 -0
  58. package/src/browser/eti/debug.ts +7 -0
  59. package/src/browser/eti/parse-templates.ts +284 -0
  60. package/src/browser/eti/preprocess.ts +187 -0
  61. package/src/browser/eti/template-tag-transform.ts +100 -0
  62. package/src/browser/eti/util.ts +72 -0
  63. package/src/browser/gjs.ts +59 -0
  64. package/{addon → src/browser}/hbs.ts +18 -6
  65. package/{addon → src/browser}/js.ts +6 -2
  66. package/{addon → src/browser}/known-modules.ts +4 -0
  67. package/{addon → src/browser}/types.ts +2 -1
  68. package/{addon → src/browser}/utils.ts +6 -2
  69. package/src/build/ember-cli.cjs +36 -0
  70. package/.github/renovate.json5 +0 -93
  71. package/.github/workflows/ci.yml +0 -120
  72. package/.github/workflows/lint.yml +0 -88
  73. package/.github/workflows/types.yml +0 -30
  74. package/CHANGELOG.md +0 -738
  75. package/addon/cjs/index.ts +0 -100
  76. package/addon/esm/index.ts +0 -131
  77. package/cjs/eval.d.ts +0 -8
  78. package/cjs/index.d.ts +0 -10
  79. package/config/environment.js +0 -5
  80. package/esm/index.d.ts +0 -11
  81. package/index.d.ts +0 -5
  82. package/index.js +0 -105
  83. package/tsconfig.json +0 -56
  84. package/types/dummy/index.d.ts +0 -1
  85. package/types/global.d.ts +0 -43
  86. package/types/overrides.d.ts +0 -18
  87. package/types.d.ts +0 -15
  88. /package/{addon → src/browser}/index.ts +0 -0
@@ -1,14 +1,26 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { precompileJSON } from '@glimmer/compiler';
3
- import { getTemplateLocals } from '@glimmer/syntax';
2
+ // import { precompileJSON } from '@glimmer/compiler';
3
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
+ // @ts-ignore
4
5
  import { setComponentTemplate } from '@ember/component';
5
6
  import templateOnlyComponent from '@ember/component/template-only';
6
7
  import { array, concat, fn, get, hash } from '@ember/helper';
7
8
  import { on } from '@ember/modifier';
9
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
+ // @ts-ignore
8
11
  import { createTemplateFactory } from '@ember/template-factory';
12
+ import { importSync } from '@embroider/macros';
9
13
 
10
14
  import { nameFor } from './utils';
11
15
 
16
+ import type { CompileResult } from './types';
17
+ import type { ComponentLike } from '@glint/template';
18
+
19
+ // These things are pre-bundled in the old system.
20
+ // ember-template-compiler defines them in AMD/requirejs
21
+ const { precompileJSON } = importSync('@glimmer/compiler') as any;
22
+ const { getTemplateLocals } = importSync('@glimmer/syntax') as any;
23
+
12
24
  /**
13
25
  * compile a template with an empty scope
14
26
  * to use components, helpers, etc, you will need to compile with JS
@@ -18,18 +30,18 @@ import { nameFor } from './utils';
18
30
  export function compileHBS(
19
31
  template: string,
20
32
  options: Omit<CompileTemplateOptions, 'moduleName'> = {}
21
- ) {
33
+ ): CompileResult {
22
34
  let name = nameFor(template);
23
- let component: undefined | unknown;
35
+ let component: undefined | ComponentLike;
24
36
  let error: undefined | Error;
25
37
 
26
38
  try {
27
39
  component = setComponentTemplate(
28
40
  compileTemplate(template, { moduleName: name, ...options }),
29
41
  templateOnlyComponent(name)
30
- );
42
+ ) as ComponentLike;
31
43
  } catch (e) {
32
- error = e;
44
+ error = e as Error | undefined;
33
45
  }
34
46
 
35
47
  return { name, component, error };
@@ -1,7 +1,7 @@
1
1
  import { compileJS as compileAMD } from './cjs';
2
2
  import { compileJS as compileESM } from './esm';
3
3
 
4
- import type { ExtraModules, Options } from './types';
4
+ import type { CompileResult, ExtraModules, Options } from './types';
5
5
 
6
6
  /**
7
7
  * @public
@@ -20,7 +20,11 @@ import type { ExtraModules, Options } from './types';
20
20
  * are not provided by extraModules will be searched on npm to see if a package
21
21
  * needs to be downloaded before running the `code` / invoking the component
22
22
  */
23
- export function compileJS(code: string, extraModules?: ExtraModules, options?: Options) {
23
+ export function compileJS(
24
+ code: string,
25
+ extraModules?: ExtraModules,
26
+ options?: Options
27
+ ): Promise<CompileResult> {
24
28
  if (options?.skypack) {
25
29
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
30
  // if (!(window as any).webpackChunkDummy) {
@@ -16,8 +16,11 @@ import * as _object from '@ember/object';
16
16
  import * as _runloop from '@ember/runloop';
17
17
  import * as _service from '@ember/service';
18
18
  import * as _string from '@ember/string';
19
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
+ // @ts-ignore
19
21
  import { createTemplateFactory } from '@ember/template-factory';
20
22
  import * as _utils from '@ember/utils';
23
+ // import * as _owner from '@ember/owner';
21
24
 
22
25
  export const modules = {
23
26
  '@ember/application': _application,
@@ -34,6 +37,7 @@ export const modules = {
34
37
  '@ember/string': _string,
35
38
  '@ember/template-factory': { createTemplateFactory },
36
39
  '@ember/utils': _utils,
40
+ // '@ember/owner': _owner,
37
41
 
38
42
  '@glimmer/component': _GlimmerComponent,
39
43
  '@glimmer/tracking': _tracking,
@@ -1,7 +1,8 @@
1
1
  import type { availablePlugins, availablePresets, transform } from '@babel/standalone';
2
+ import type { ComponentLike } from '@glint/template';
2
3
 
3
4
  export interface CompileResult {
4
- component?: unknown;
5
+ component?: ComponentLike;
5
6
  error?: Error;
6
7
  name: string;
7
8
  }
@@ -1,6 +1,6 @@
1
1
  import { assert } from '@ember/debug';
2
- import { camelize, capitalize } from '@ember/string';
3
2
 
3
+ import { pascalCase } from 'change-case';
4
4
  import { v5 as uuidv5 } from 'uuid';
5
5
 
6
6
  /**
@@ -41,6 +41,10 @@ export function invocationOf(name: string) {
41
41
  return `<${invocationName(name)} />`;
42
42
  }
43
43
 
44
+ /**
45
+ * Core team does not want to support changes to '@ember/string' (v2 addonification, specifically)
46
+ * inflection does not support hyphens
47
+ */
44
48
  export function invocationName(name: string) {
45
- return capitalize(camelize(name));
49
+ return pascalCase(name).replaceAll('_', '');
46
50
  }
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ const { stripIndents } = require('common-tags');
4
+
5
+ /**
6
+ * Builds a file with a single export, COMPONENT_MAP, that
7
+ * is a map of the provided paths *to* all exported identifiers
8
+ * from each of the provided paths.
9
+ *
10
+ * This is helpful for building a map of imports to force to be included
11
+ * in the build - a requirement for builds that tend to tree shake.
12
+ *
13
+ * @param {string[]} paths - list of import paths for each module that you want availableb to the REPL
14
+ */
15
+ module.exports.buildComponentMap = function buildComponentMap(paths) {
16
+ const writeFile = require('broccoli-file-creator');
17
+ const fileContent = stripIndents`
18
+ ${paths
19
+ .map((path, i) => {
20
+ return `import * as ComponentMapPart${i} from '${path}';`;
21
+ })
22
+ .join('\n')}
23
+
24
+ export const COMPONENT_MAP = {
25
+ ${paths
26
+ .map((path, i) => {
27
+ return `'${path}': ComponentMapPart${i},`;
28
+ })
29
+ .join('\n')}
30
+ };
31
+ `;
32
+
33
+ const tree = writeFile('/ember-repl/component-map.js', fileContent);
34
+
35
+ return tree;
36
+ };
@@ -1,93 +0,0 @@
1
- // Docs:
2
- // https://docs.renovatebot.com/configuration-options/
3
- {
4
- "extends": [
5
- "config:base",
6
- ":semanticCommits"
7
- ],
8
- "automerge": true,
9
- "masterIssue": true,
10
- "rangeStrategy": "bump",
11
- // From the docs:
12
- // https://docs.renovatebot.com/configuration-options/#packagerules
13
- // Important to know: Renovate will evaluate all packageRules and not stop once it gets a first match.
14
- // Therefore, you should order your packageRules in order of importance so that later rules can override
15
- // settings from earlier rules if necessary.
16
- //
17
- // (so if something is to be disabled, place that rule last)
18
- "packageRules": [
19
- ////////////////////////////////////////
20
- // Grouping namespaced packages together
21
- //
22
- // This reduces overall PR count
23
- ////////////////////////////////////////
24
- {
25
- "groupName": "Type Definitions",
26
- "packagePatterns": ["^@types\/*"],
27
- "schedule": ["after 9pm on sunday"],
28
- },
29
- {
30
- "groupName": "Lint Dependencies",
31
- "schedule": ["after 9pm on sunday"],
32
- "packageNames": [
33
- "eslint",
34
- "babel-eslint",
35
- "ember-template-lint",
36
- "prettier"
37
- ],
38
- "packagePatterns": [
39
- "eslint-plugin-.*",
40
- "eslint-config-.*",
41
- ".*typescript-eslint.*",
42
- "^@commitlint\/*",
43
- "^remark-*"
44
- ]
45
- },
46
- // These are dependencies that come default when
47
- // generating a new ember addon
48
- {
49
- "groupName": "Framework Dependencies",
50
- "packageNames": [
51
- "@ember/optional-features",
52
- "@glimmer/component",
53
- "@glimmer/tracking",
54
- "ember-disable-prototype-extensions",
55
- "ember-export-application-global",
56
- "ember-load-initializers",
57
- "ember-maybe-import-regenerator",
58
- "ember-resolver",
59
- "ember-source",
60
- "ember-cli-page-title"
61
- ]
62
- },
63
- {
64
- "groupName": "CLI Dependencies",
65
- "packageNames": [
66
- "broccoli-asset-rev",
67
- "ember-cli",
68
- "ember-auto-import",
69
- "ember-cli-dependency-checker",
70
- "ember-cli-inject-live-reload",
71
- "ember-cli-sri",
72
- "ember-cli-terser"
73
- ]
74
- },
75
- {
76
- "groupName": "Testing Dependencies",
77
- "schedule": ["after 9pm on sunday"],
78
- "packageNames": [
79
- "qunit-dom",
80
- "ember-try",
81
- "ember-source-channel-url",
82
- "ember-qunit",
83
- "qunit",
84
- "npm-run-all"
85
- ]
86
- },
87
- {
88
- // changing peerDependencies *at all* is a breaking change
89
- "matchDepTypes": ["peerDependencies"],
90
- "enabled": false
91
- }
92
- ]
93
- }
@@ -1,120 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - main
8
- - master
9
- schedule:
10
- - cron: "0 3 * * 0" # every Sunday at 3am
11
-
12
- env:
13
- CI: true
14
-
15
- jobs:
16
- tests:
17
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
18
- name: Base Tests
19
- timeout-minutes: 5
20
- runs-on: ubuntu-latest
21
- strategy:
22
- matrix:
23
- node:
24
- - "14"
25
- - "16"
26
- steps:
27
- - uses: actions/checkout@v3
28
- - uses: volta-cli/action@v1
29
- with:
30
- node-version: ${{ matrix.node }}
31
-
32
- - run: yarn install --frozen-lockfile
33
-
34
- - name: Test with ${{ matrix.node }}
35
- run: yarn ember test
36
-
37
- floating-dependencies:
38
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
39
- name: Floating Dependencies
40
- timeout-minutes: 5
41
- runs-on: ubuntu-latest
42
- strategy:
43
- matrix:
44
- node:
45
- - "14"
46
- - "16"
47
-
48
- steps:
49
- - uses: actions/checkout@v3
50
- - uses: volta-cli/action@v1
51
- with:
52
- node-version: ${{ matrix.node }}
53
-
54
- - run: yarn install --no-lockfile
55
-
56
- - name: Test with Node ${{ matrix.node }}
57
- run: yarn ember test
58
-
59
- try-scenarios:
60
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
61
- name: "Compatibility"
62
- timeout-minutes: 7
63
- runs-on: ubuntu-latest
64
- needs: tests
65
-
66
- strategy:
67
- fail-fast: true
68
- matrix:
69
- ember-try-scenario:
70
- - ember-3.27
71
- - ember-3.28
72
- - ember-release
73
- - ember-beta
74
- - ember-canary
75
- - embroider-safe
76
- - embroider-optimized
77
- steps:
78
- - uses: actions/checkout@v3
79
- - uses: volta-cli/action@v1
80
- with:
81
- node-version: 14.x
82
- - name: install dependencies
83
- run: yarn install --frozen-lockfile
84
- - name: test
85
- run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup
86
-
87
- ember-cli-update:
88
- if: github.event_name == 'pull_request' && github.event.pusher.name == 'renovate-bot'
89
- runs-on: ubuntu-latest
90
- needs: [tests, try-scenarios, floating-dependencies]
91
-
92
- steps:
93
- - uses: actions/checkout@v3
94
- with:
95
- ref: ${{ github.head_ref }}
96
- token: ${{ secrets.GitHubToken }}
97
- - uses: actions/setup-node@v3
98
- - uses: kellyselden/ember-cli-update-action@v3
99
- with:
100
- autofix_command: yarn lint:fix
101
- ignore_to: true
102
-
103
- publish:
104
- name: Release
105
- runs-on: ubuntu-latest
106
- if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
107
- needs: [tests, try-scenarios, floating-dependencies]
108
-
109
- steps:
110
- - uses: actions/checkout@v3
111
- with:
112
- persist-credentials: false
113
- - uses: volta-cli/action@v1
114
- - run: yarn install
115
-
116
- - name: Release
117
- run: yarn semantic-release
118
- env:
119
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
120
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,88 +0,0 @@
1
- name: Lint
2
-
3
- # based on:
4
- # - https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/blob/master/.github/workflows/lint.yml
5
- # - https://github.com/NullVoxPopuli/ember-autostash-modifier/blob/master/.github/workflows/ci.yml
6
- # - https://github.com/emberjs/ember-test-helpers/blob/master/.github/workflows/ci-build.yml
7
- on:
8
- pull_request:
9
- push:
10
- # filtering branches here prevents duplicate builds from pull_request and push
11
- branches:
12
- - main
13
-
14
- env:
15
- CI: true
16
-
17
- jobs:
18
- source:
19
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
20
- name: Source
21
- runs-on: ubuntu-latest
22
-
23
- steps:
24
- - uses: actions/checkout@v3
25
- - uses: volta-cli/action@v1
26
-
27
- - run: yarn install --frozen-lockfile
28
-
29
- - name: ESLint
30
- run: yarn lint:js
31
-
32
- - name: Templates
33
- run: yarn lint:hbs
34
-
35
- tooling:
36
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
37
- name: Tooling
38
- runs-on: ubuntu-latest
39
-
40
- steps:
41
- - uses: actions/checkout@v3
42
- - uses: volta-cli/action@v1
43
-
44
- - run: yarn install --frozen-lockfile
45
-
46
- - name: Semantic Release
47
- run: yarn semantic-release --dry-run
48
- env:
49
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
50
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
-
52
- # docs:
53
- # if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
54
- # name: Docs
55
- # runs-on: ubuntu-latest
56
-
57
- # steps:
58
- # - uses: actions/checkout@v2
59
- # - uses: volta-cli/action@v1
60
-
61
- # - run: yarn install
62
- # - run: yarn lint:docs
63
-
64
-
65
- # docs-js-code:
66
- # if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
67
- # name: Docs (JS Code Samples)
68
- # runs-on: ubuntu-latest
69
-
70
- # steps:
71
- # - uses: actions/checkout@v2
72
- # - uses: volta-cli/action@v1
73
-
74
- # - run: yarn install
75
- # - run: yarn lint:docs-js
76
-
77
- commits:
78
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
79
- name: Commit Messages
80
- runs-on: ubuntu-latest
81
-
82
- steps:
83
- - uses: actions/checkout@v3
84
- with:
85
- fetch-depth: 0
86
-
87
- - uses: volta-cli/action@v1
88
- - uses: wagoid/commitlint-github-action@v5.0.2
@@ -1,30 +0,0 @@
1
- name: Types
2
-
3
- # based on:
4
- # - https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/blob/master/.github/workflows/lint.yml
5
- # - https://github.com/NullVoxPopuli/ember-autostash-modifier/blob/master/.github/workflows/ci.yml
6
- # - https://github.com/emberjs/ember-test-helpers/blob/master/.github/workflows/ci-build.yml
7
- on:
8
- pull_request:
9
- push:
10
- # filtering branches here prevents duplicate builds from pull_request and push
11
- branches:
12
- - main
13
-
14
- env:
15
- CI: true
16
-
17
- jobs:
18
- types:
19
- if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
20
- name: Type Checking
21
- runs-on: ubuntu-latest
22
-
23
- steps:
24
- - uses: actions/checkout@v3
25
- - uses: volta-cli/action@v1
26
-
27
- - run: yarn install --frozen-lockfile
28
-
29
- - name: Type Checking
30
- run: yarn prepack