Skip to content

Commit e24cc18

Browse files
committed
WIP
1 parent 9b9b7c7 commit e24cc18

File tree

7 files changed

+102
-54
lines changed

7 files changed

+102
-54
lines changed

.gitignore

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,31 @@
1-
*.bpkg
2-
*.gem
31
*.rbc
42
.DS_Store
53
.bpm
64
.bundle
75
.config
86
.eslintcache
97
.github-upload-token
10-
.yardoc
118
InstalledFiles
12-
_site
13-
_yardoc
14-
assets
15-
assets/bpm_libs.js
16-
assets/bpm_styles.css
9+
/api-report
1710
coverage
1811
dist
1912
/docs
20-
/docs-out
2113
lib/*/tests/all.js
2214
lib/*/tests/qunit*
2315
lib/bundler/man
2416
pkg
25-
rdoc
26-
spade-boot.js
2717
spec/reports
2818
test/tmp
2919
test/version_tmp
3020
test_*.html
3121
/tests/ember-tests.js
22+
tsconfig.tsbuildinfo
3223
tmp
33-
tmp*.gem
34-
tmp.bpm
35-
tmp.spade
36-
temp
3724
tests/source
38-
tsconfig.tsbuildinfo
3925
/types
4026
node_modules
4127
yarn-error.log
42-
bundle/
4328
*~
44-
publish_to_bower/
45-
bower_components/
4629
npm-debug.log
4730
.ember-cli
4831
/DEBUG/

build-docs.js

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const { rollup } = require('rollup');
77
const typescript = require('@rollup/plugin-typescript');
88
const { default: dts } = require('rollup-plugin-dts');
99
const { existsSync } = require('fs');
10-
const { writeFile, mkdir, cp, readFile } = require('fs/promises');
10+
const { writeFile, mkdir, cp } = require('fs/promises');
11+
// const { readFile } = require('fs/promises');
1112

1213
class Package {
1314
constructor(filePath) {
@@ -23,8 +24,8 @@ class Package {
2324
this.outPath.name === 'index' ? this.outPath.dir : `${this.outPath.dir}/${this.outPath.name}`;
2425

2526
this.rollup = {
26-
dir: `docs-out/${this.outPath.dir}`,
27-
name: `rollup.${this.name.replace('/', '.')}`,
27+
dir: `tmp/rollup-types/${this.outPath.dir}`,
28+
name: this.outPath.name,
2829
ext: '.d.ts',
2930
};
3031
}
@@ -49,9 +50,9 @@ class Package {
4950
}
5051
}
5152

52-
async function build(package) {
53+
async function build(path) {
5354
let bundle = await rollup({
54-
input: package.absolutePath,
55+
input: path,
5556
plugins: [
5657
typescript({
5758
tsconfig: './tsconfig.json',
@@ -61,16 +62,16 @@ async function build(package) {
6162
declarationMap: true,
6263
sourceMap: true,
6364
incremental: true,
64-
outDir: `temp`,
65-
declarationDir: `temp`,
65+
outDir: 'tmp/build-types',
66+
declarationDir: 'tmp/build-types',
6667
},
6768
}),
6869
],
6970
});
7071

7172
await bundle.write({
7273
output: {
73-
dir: 'temp',
74+
dir: 'tmp/build-types',
7475
format: 'es',
7576
sourcemap: true,
7677
},
@@ -86,14 +87,14 @@ async function rollupTypes(package) {
8687
try {
8788
const bundle = await rollup({
8889
input: path.format({
89-
dir: `${__dirname}/temp/${package.outPath.dir}`,
90+
dir: `${__dirname}/tmp/build-types/${package.outPath.dir}`,
9091
name: package.outPath.name,
9192
ext: '.d.ts',
9293
}),
9394
plugins: [
9495
dts({
9596
compilerOptions: {
96-
baseUrl: `temp/${package.outPath.dir}`,
97+
baseUrl: `tmp/build-types/${package.outPath.dir}`,
9798
paths: {
9899
[`${package.outPath.dir}/*`]: ['*'],
99100
'@ember/-internals/*': [`${relativeTemp}/@ember/-internals/*`],
@@ -114,27 +115,23 @@ async function rollupTypes(package) {
114115
}
115116
}
116117

117-
function docs(package) {
118-
console.log('DOCS', package.absolutePath);
118+
function extract(package) {
119+
console.log('EXTRACT', package.absolutePath);
119120
try {
120121
const config = ExtractorConfig.prepare({
121122
configObject: {
122123
mainEntryPointFilePath: `<projectFolder>/${path.format(package.rollup)}`,
123124
apiReport: {
124125
enabled: true,
125126
reportFileName: `${package.fileSafeName}.api.md`,
126-
reportFolder: 'docs-out',
127-
reportTempFolder: 'docs-out',
128-
},
129-
docModel: {
130-
enabled: true,
131-
apiJsonFilePath: `<projectFolder>/docs-out/${package.fileSafeName}.api.json`,
127+
reportFolder: 'api-report',
128+
reportTempFolder: 'api-report',
132129
},
133130
dtsRollup: {
134131
enabled: true,
135-
untrimmedFilePath: `<projectFolder>/types/${package.fileSafeName}.untrimmed.d.ts`,
136-
betaTrimmedFilePath: `<projectFolder>/types/${package.fileSafeName}.beta.d.ts`,
137-
publicTrimmedFilePath: `<projectFolder>/types/${package.fileSafeName}.release.d.ts`,
132+
untrimmedFilePath: `<projectFolder>/tmp/trimmed-types/${package.fileSafeName}.untrimmed.d.ts`,
133+
betaTrimmedFilePath: `<projectFolder>/tmp/trimmed-types/${package.fileSafeName}.beta.d.ts`,
134+
publicTrimmedFilePath: `<projectFolder>/tmp/trimmed-types/${package.fileSafeName}.release.d.ts`,
138135
},
139136
compiler: {
140137
tsconfigFilePath: '<projectFolder>/tsconfig.json',
@@ -212,7 +209,7 @@ async function run() {
212209
// '@ember/runloop',
213210
// '@ember/service',
214211
// '@ember/template',
215-
// '@ember/utils',
212+
'@ember/utils',
216213
// '@ember/version',
217214
// 'ember',
218215
].map((p) => {
@@ -222,23 +219,23 @@ async function run() {
222219
return new Package(path);
223220
});
224221

225-
await mkdir('temp');
222+
await mkdir('tmp/build-types', { recursive: true });
226223
await writeFile(
227-
'temp/index.ts',
224+
'tmp/build-types/index.ts',
228225
packages.map((p, idx) => `import _PKG${idx} from '${p.name}';`).join('\n')
229226
);
230227

231-
await build(new Package('temp/index.ts'));
228+
await build('tmp/build-types/index.ts');
232229

230+
// Copy over all pre-existing .d.ts paths
233231
for await (const item of klaw(path.join(__dirname, 'packages'))) {
234232
if (item.stats.isFile()) {
235233
if (
236234
item.path.endsWith('.d.ts') &&
237235
!item.path.includes('/tests/') &&
238236
!item.path.includes('/type-tests/')
239237
) {
240-
let dest = `temp/${path.relative(`${__dirname}/packages`, item.path)}`;
241-
// await mkdirp(path.dirname(dest));
238+
let dest = `tmp/build-types/${path.relative(`${__dirname}/packages`, item.path)}`;
242239
await cp(item.path, dest);
243240
}
244241
}
@@ -250,16 +247,26 @@ async function run() {
250247

251248
// Ideally we'd parallelize this. My first go didn't work.
252249
for (let pkg of packages) {
253-
await docs(pkg);
250+
await extract(pkg);
254251
}
255252

256-
// https://github.com/microsoft/rushstack/issues/2895
257-
for await (const item of klaw(path.join(__dirname, 'docs-out'))) {
258-
if (item.stats.isFile()) {
259-
let data = await readFile(item.path);
260-
await writeFile(item.path, data.toString().replace(/_2/g, ''));
253+
for (let pkg of packages) {
254+
for (let r of ['beta', 'release', 'untrimmed']) {
255+
await mkdir(`types/${r}/${pkg.outPath.dir}`, { recursive: true });
256+
await cp(
257+
`tmp/trimmed-types/${pkg.fileSafeName}.${r}.d.ts`,
258+
`types/${r}/${pkg.outPath.dir}/${pkg.outPath.name}.d.ts`
259+
);
261260
}
262261
}
262+
263+
// // https://github.com/microsoft/rushstack/issues/2895
264+
// for await (const item of klaw(path.join(__dirname, 'docs-out'))) {
265+
// if (item.stats.isFile()) {
266+
// let data = await readFile(item.path);
267+
// await writeFile(item.path, data.toString().replace(/_2/g, ''));
268+
// }
269+
// }
263270
}
264271

265272
run();

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"testem": "^3.6.0",
162162
"testem-failure-only-reporter": "^1.0.0",
163163
"tslib": "^2.3.1",
164+
"typedoc": "^0.22.12",
164165
"typescript": "~4.5.4"
165166
},
166167
"engines": {

packages/@ember/-internals/runtime/lib/system/core_object.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { Owner } from '@ember/-internals/owner';
1414
/** @internal */
1515
export type EmberClassConstructor<T> = new (owner: Owner) => T;
1616

17-
/** @internal */
1817
export type MergeArray<Arr extends any[]> = Arr extends [infer T, ...infer Rest]
1918
? T & MergeArray<Rest>
2019
: unknown; // TODO: Is this correct?

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@
1515
"strict": true,
1616
"noImplicitReturns": true,
1717
"allowUnreachableCode": false,
18-
"suppressImplicitAnyIndexErrors": true,
1918
"noPropertyAccessFromIndexSignature": true,
2019
"noUnusedLocals": true,
2120
"noUncheckedIndexedAccess": true,
2221
"noUnusedParameters": true,
2322
"esModuleInterop": false,
2423
"allowSyntheticDefaultImports": false,
2524

25+
// FIXME: Remove this
26+
"suppressImplicitAnyIndexErrors": true,
27+
2628
"newLine": "LF",
2729
"noEmit": true,
2830

tsconfig.typedoc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "node",
4+
"baseUrl": ".",
5+
"paths": {
6+
"@ember/object": ["packages/@ember/object"],
7+
"*": ["types/untrimmed/*", "packages/*"]
8+
}
9+
},
10+
"include": ["types/**/*.ts"]
11+
}

yarn.lock

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6801,6 +6801,11 @@ json5@^2.1.2:
68016801
dependencies:
68026802
minimist "^1.2.5"
68036803

6804+
jsonc-parser@^3.0.0:
6805+
version "3.0.0"
6806+
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22"
6807+
integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==
6808+
68046809
jsonfile@^2.1.0:
68056810
version "2.4.0"
68066811
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
@@ -7436,6 +7441,11 @@ lru-cache@^6.0.0:
74367441
dependencies:
74377442
yallist "^4.0.0"
74387443

7444+
lunr@^2.3.9:
7445+
version "2.3.9"
7446+
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
7447+
integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
7448+
74397449
magic-string@^0.24.0:
74407450
version "0.24.0"
74417451
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.24.0.tgz#1b396d26406188f1fa3730a68229562d36a1c2f2"
@@ -7542,6 +7552,11 @@ markdown-it@^8.3.1:
75427552
mdurl "^1.0.1"
75437553
uc.micro "^1.0.5"
75447554

7555+
marked@^4.0.10:
7556+
version "4.0.12"
7557+
resolved "https://registry.yarnpkg.com/marked/-/marked-4.0.12.tgz#2262a4e6fd1afd2f13557726238b69a48b982f7d"
7558+
integrity sha512-hgibXWrEDNBWgGiK18j/4lkS6ihTe9sxtV4Q1OQppb/0zzyPSzoFANBa5MfsG/zgsWklmNnhm0XACZOH/0HBiQ==
7559+
75457560
matcher-collection@^1.0.0, matcher-collection@^1.1.1:
75467561
version "1.1.2"
75477562
resolved "https://registry.yarnpkg.com/matcher-collection/-/matcher-collection-1.1.2.tgz#1076f506f10ca85897b53d14ef54f90a5c426838"
@@ -9543,6 +9558,15 @@ shellwords@^0.1.1:
95439558
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
95449559
integrity "sha1-1rkYHBpI05cyTISHHvvPxz/AZUs= sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww=="
95459560

9561+
shiki@^0.10.0:
9562+
version "0.10.1"
9563+
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.10.1.tgz#6f9a16205a823b56c072d0f1a0bcd0f2646bef14"
9564+
integrity sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==
9565+
dependencies:
9566+
jsonc-parser "^3.0.0"
9567+
vscode-oniguruma "^1.6.1"
9568+
vscode-textmate "5.2.0"
9569+
95469570
side-channel@^1.0.4:
95479571
version "1.0.4"
95489572
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
@@ -10454,6 +10478,17 @@ typedarray-to-buffer@^3.1.5:
1045410478
dependencies:
1045510479
is-typedarray "^1.0.0"
1045610480

10481+
typedoc@^0.22.12:
10482+
version "0.22.12"
10483+
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.12.tgz#52a8bb0e77458dcbab35fb89e24b80160ba6558d"
10484+
integrity sha512-FcyC+YuaOpr3rB9QwA1IHOi9KnU2m50sPJW5vcNRPCIdecp+3bFkh7Rq5hBU1Fyn29UR2h4h/H7twZHWDhL0sw==
10485+
dependencies:
10486+
glob "^7.2.0"
10487+
lunr "^2.3.9"
10488+
marked "^4.0.10"
10489+
minimatch "^3.0.4"
10490+
shiki "^0.10.0"
10491+
1045710492
typescript-memoize@^1.0.0-alpha.3, typescript-memoize@^1.0.1:
1045810493
version "1.1.0"
1045910494
resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.1.0.tgz#4a8f512d06fc995167c703a3592219901db8bc79"
@@ -10722,6 +10757,16 @@ vow@^0.4.17, vow@^0.4.7:
1072210757
resolved "https://registry.yarnpkg.com/vow/-/vow-0.4.18.tgz#18a77994ce30790ccd22d57a3a25cf5e131d8d1b"
1072310758
integrity "sha1-GKd5lM4weQzNItV6OiXPXhMdjRs= sha512-7QGozxlOhour77BCQbbyW5XFP8ioIz/DPK67IyO3DnJtF0WXrXueMwqrYFM9yqyfgENcyxL+vktz2oJeZfdWtw=="
1072410759

10760+
vscode-oniguruma@^1.6.1:
10761+
version "1.6.2"
10762+
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz#aeb9771a2f1dbfc9083c8a7fdd9cccaa3f386607"
10763+
integrity sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==
10764+
10765+
vscode-textmate@5.2.0:
10766+
version "5.2.0"
10767+
resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.2.0.tgz#01f01760a391e8222fe4f33fbccbd1ad71aed74e"
10768+
integrity sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==
10769+
1072510770
walk-sync@^0.2.0:
1072610771
version "0.2.7"
1072710772
resolved "https://registry.yarnpkg.com/walk-sync/-/walk-sync-0.2.7.tgz#b49be4ee6867657aeb736978b56a29d10fa39969"

0 commit comments

Comments
 (0)