Skip to content

Commit 6247549

Browse files
Circumvent broken module resolution in v3 api-data d.ts file (#1119)
1 parent 00ebfa0 commit 6247549

File tree

4 files changed

+50
-15
lines changed

4 files changed

+50
-15
lines changed

packages/lit-dev-api/api-data/lit-3/pages.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"v1": "api/lit-element/LitElement/"
77
},
88
"repo": "lit/lit",
9-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
9+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
1010
"items": [
1111
{
1212
"name": "LitElement",
@@ -3116,7 +3116,7 @@
31163116
"v1": "api/lit-element/UpdatingElement/"
31173117
},
31183118
"repo": "lit/lit",
3119-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
3119+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
31203120
"items": [
31213121
{
31223122
"name": "ReactiveElement",
@@ -6265,7 +6265,7 @@
62656265
"v1": "api/lit-html/templates/"
62666266
},
62676267
"repo": "lit/lit",
6268-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
6268+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
62696269
"items": [
62706270
{
62716271
"name": "html",
@@ -6851,7 +6851,7 @@
68516851
"v1": "api/lit-element/styles/"
68526852
},
68536853
"repo": "lit/lit",
6854-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
6854+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
68556855
"items": [
68566856
{
68576857
"name": "adoptStyles",
@@ -7463,7 +7463,7 @@
74637463
"v1": "api/lit-element/decorators/"
74647464
},
74657465
"repo": "lit/lit",
7466-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
7466+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
74677467
"items": [
74687468
{
74697469
"name": "customElement",
@@ -8768,7 +8768,7 @@
87688768
"v1": "api/lit-html/directives/"
87698769
},
87708770
"repo": "lit/lit",
8771-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
8771+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
87728772
"items": [
87738773
{
87748774
"name": "asyncAppend",
@@ -17744,7 +17744,7 @@
1774417744
"v1": "api/lit-html/custom-directives/"
1774517745
},
1774617746
"repo": "lit/lit",
17747-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
17747+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
1774817748
"items": [
1774917749
{
1775017750
"name": "AsyncDirective",
@@ -22711,7 +22711,7 @@
2271122711
"v1": "api/lit-html/templates/"
2271222712
},
2271322713
"repo": "lit/lit",
22714-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
22714+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
2271522715
"items": [
2271622716
{
2271722717
"name": "html",
@@ -23396,7 +23396,7 @@
2339623396
"v1": "api/lit-element/LitElement/"
2339723397
},
2339823398
"repo": "lit/lit",
23399-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
23399+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
2340023400
"items": [
2340123401
{
2340223402
"name": "ReactiveController",
@@ -23851,7 +23851,7 @@
2385123851
"v1": "api/lit-element/LitElement/"
2385223852
},
2385323853
"repo": "lit/lit",
23854-
"commit": "d04a3e30eb3ae3520fb0ac163fb5ddbbf6030620",
23854+
"commit": "12109c25997ef03180d7eefe05c64e0fb20dd2b0",
2385523855
"items": [
2385623856
{
2385723857
"name": "defaultConverter",

packages/lit-dev-tools-cjs/src/api-docs/configs/lit-3.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ export const lit3Config: ApiDocsConfig = {
4242
pathlib.join(srcDir, 'static-html.ts'),
4343
],
4444

45+
extraSetupCommands: [
46+
{
47+
cmd: 'npm',
48+
args: ['run', 'build:ts'],
49+
},
50+
// Apply file patch to fix typedoc errors during docs generation. Because
51+
// `npm run build:ts` is run prior to this, the patch file can always be
52+
// applied unless a change has occurred in the file being patched.
53+
{
54+
cmd: 'patch',
55+
// directive-helpers contains an import of the private `ChildPart` class
56+
// that typedoc cannot resolve. By stripping this import typedoc
57+
// successfully generates API docs without changing the generated docs
58+
// output.
59+
args: [
60+
'packages/lit-html/development/directive-helpers.d.ts',
61+
'-i',
62+
'../../../../../packages/lit-dev-tools-cjs/src/api-docs/lit-3-patches/fix-directive-helpers-declaration.patch',
63+
],
64+
},
65+
],
66+
4567
pages: [
4668
{
4769
slug: 'LitElement',

packages/lit-dev-tools-cjs/src/api-docs/generate.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ import {execFile} from 'child_process';
1111
import {promisify} from 'util';
1212
import {ApiDocsTransformer} from './transformer.js';
1313
import {lit2Config} from './configs/lit-2.js';
14-
15-
// TODO(https://github.com/lit/lit.dev/issues/1112) Fix automatic generation of
16-
// Lit 3.0 docs.
17-
// import {lit3Config} from './configs/lit-3.js';
14+
import {lit3Config} from './configs/lit-3.js';
1815

1916
import type {ApiDocsConfig} from './types.js';
2017

2118
const execFileAsync = promisify(execFile);
2219

2320
// Only generate documentation for most recent Lit versions.
24-
const configs = [lit2Config /* , lit3Config */];
21+
const configs = [lit2Config, lit3Config];
2522

2623
/**
2724
* Check whether the given file path exists.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--- packages/lit-html/development/directive-helpers.d.ts 2023-05-15 17:13:11
2+
+++ packages/lit-html/development/directive-helpers_new.d.ts 2023-05-16 13:31:18
3+
@@ -5,9 +5,9 @@
4+
*/
5+
import { Part, DirectiveParent, TemplateResult } from './lit-html.js';
6+
import { DirectiveResult, DirectiveClass, PartInfo } from './directive.js';
7+
-type Primitive = null | undefined | boolean | number | string | symbol | bigint;
8+
-declare const ChildPart: typeof import("./lit-html.js").ChildPart;
9+
-type ChildPart = InstanceType<typeof ChildPart>;
10+
+type Primitive = null | undefined | boolean | number | string | symbol | bigint;
11+
+type ChildPart = import("./lit-html.js").ChildPart;
12+
+
13+
/**
14+
* Tests if a value is a primitive value.
15+
*
16+
\ No newline at end of file

0 commit comments

Comments
 (0)