Skip to content

Commit 0efed6b

Browse files
committed
Merge branch 'v2-preview' of github.com:aws-amplify/docs into bump-amplify
2 parents 3096b75 + e5c7b55 commit 0efed6b

File tree

123 files changed

+2368
-2705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+2368
-2705
lines changed

capi/src/__tests__/absolute-references/absolute-references.ts

+50-42
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,35 @@ test("absolute md references", async () => {
3434
[
3535
"div",
3636
null,
37-
["p", null, "fragment start"],
38-
"\n",
39-
["h1", {id: "im-a-fragment"}, "I’m a fragment"],
40-
"\n",
4137
[
42-
"p",
43-
null,
44-
["docs-internal-link", {href: "/product"}, "link to subpage"],
45-
],
46-
"\n",
47-
[
48-
"p",
49-
null,
38+
"div",
39+
{slot: "content"},
40+
["p", null, "fragment start"],
41+
"\n",
42+
["h1", {id: "im-a-fragment"}, "I’m a fragment"],
43+
"\n",
44+
[
45+
"p",
46+
null,
47+
["docs-internal-link", {href: "/product"}, "link to subpage"],
48+
],
49+
"\n",
5050
[
51-
"img",
52-
{
53-
src: "/product/some-image.png",
54-
alt: "Some Image",
55-
title: "Some Image",
56-
},
51+
"p",
52+
null,
53+
[
54+
"img",
55+
{
56+
src: "/product/some-image.png",
57+
alt: "Some Image",
58+
title: "Some Image",
59+
},
60+
],
5761
],
62+
"\n",
63+
["p", null, "fragment end"],
64+
"\n",
5865
],
59-
"\n",
60-
["p", null, "fragment end"],
61-
"\n",
6266
],
6367
],
6468
"\n",
@@ -94,31 +98,35 @@ test("absolute md references", async () => {
9498
[
9599
"div",
96100
null,
97-
["p", null, "fragment start"],
98-
"\n",
99-
["h1", {id: "im-a-fragment"}, "I’m a fragment"],
100-
"\n",
101101
[
102-
"p",
103-
null,
104-
["docs-internal-link", {href: "/product"}, "link to subpage"],
105-
],
106-
"\n",
107-
[
108-
"p",
109-
null,
102+
"div",
103+
{slot: "content"},
104+
["p", null, "fragment start"],
105+
"\n",
106+
["h1", {id: "im-a-fragment"}, "I’m a fragment"],
107+
"\n",
108+
[
109+
"p",
110+
null,
111+
["docs-internal-link", {href: "/product"}, "link to subpage"],
112+
],
113+
"\n",
110114
[
111-
"img",
112-
{
113-
src: "/product/some-image.png",
114-
alt: "Some Image",
115-
title: "Some Image",
116-
},
115+
"p",
116+
null,
117+
[
118+
"img",
119+
{
120+
src: "/product/some-image.png",
121+
alt: "Some Image",
122+
title: "Some Image",
123+
},
124+
],
117125
],
126+
"\n",
127+
["p", null, "fragment end"],
128+
"\n",
118129
],
119-
"\n",
120-
["p", null, "fragment end"],
121-
"\n",
122130
],
123131
],
124132
"\n",

capi/src/__tests__/filter-metadata-generation/filter-metadata-generation.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,36 @@ test("filter metadata generation", async () => {
1515
// eslint-disable-next-line
1616
// @ts-ignore
1717
expect((await import("./api/product/product")).versions).toEqual({
18-
android: "/product?platform=android",
19-
ios: "/product?platform=ios",
20-
js: "/product?platform=js",
18+
android: "/product/q/platform/android",
19+
ios: "/product/q/platform/ios",
20+
js: "/product/q/platform/js",
2121
});
2222

2323
// eslint-disable-next-line
2424
// @ts-ignore
2525
expect((await import("./api/product/a/all-three")).versions).toEqual({
26-
android: "/product/a/all-three?platform=android",
27-
ios: "/product/a/all-three?platform=ios",
28-
js: "/product/a/all-three?platform=js",
26+
android: "/product/a/all-three/q/platform/android",
27+
ios: "/product/a/all-three/q/platform/ios",
28+
js: "/product/a/all-three/q/platform/js",
2929
});
3030

3131
expect(
3232
// eslint-disable-next-line
3333
// @ts-ignore
3434
(await import("./api/product/a/just-one")).versions,
3535
).toEqual({
36-
android: "/product?platform=android",
37-
ios: "/product?platform=ios",
38-
js: "/product/a/just-one?platform=js",
36+
android: "/product/q/platform/android",
37+
ios: "/product/q/platform/ios",
38+
js: "/product/a/just-one/q/platform/js",
3939
});
4040

4141
expect(
4242
// eslint-disable-next-line
4343
// @ts-ignore
4444
(await import("./api/product/a/one-but-agnostic")).versions,
4545
).toEqual({
46-
android: "/product/a/one-but-agnostic?platform=android",
47-
ios: "/product/a/one-but-agnostic?platform=ios",
48-
js: "/product/a/one-but-agnostic?platform=js",
46+
android: "/product/a/one-but-agnostic/q/platform/android",
47+
ios: "/product/a/one-but-agnostic/q/platform/ios",
48+
js: "/product/a/one-but-agnostic/q/platform/js",
4949
});
5050
});

capi/src/__tests__/inlining-filterable-fragments/inlining-filterable-fragments.ts

+56-36
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ test("inlining-filterable-fragments", async () => {
2222
"docs-filter-target",
2323
{filters: {platform: "ios"}},
2424
[
25-
"docs-in-page-link",
26-
{targetId: "im-an-ios-specific-fragment"},
25+
"div",
26+
{slot: "content"},
2727
[
28-
"h2",
29-
{id: "im-an-ios-specific-fragment"},
30-
"I’m an iOS-specific fragment",
28+
"docs-in-page-link",
29+
{targetId: "im-an-ios-specific-fragment"},
30+
[
31+
"h2",
32+
{id: "im-an-ios-specific-fragment"},
33+
"I’m an iOS-specific fragment",
34+
],
3135
],
36+
"\n",
3237
],
33-
"\n",
3438
],
3539
],
3640
"\n",
@@ -41,15 +45,19 @@ test("inlining-filterable-fragments", async () => {
4145
"docs-filter-target",
4246
{filters: {platform: "android"}},
4347
[
44-
"docs-in-page-link",
45-
{targetId: "im-an-android-specific-fragment"},
48+
"div",
49+
{slot: "content"},
4650
[
47-
"h2",
48-
{id: "im-an-android-specific-fragment"},
49-
"I’m an Android-specific fragment",
51+
"docs-in-page-link",
52+
{targetId: "im-an-android-specific-fragment"},
53+
[
54+
"h2",
55+
{id: "im-an-android-specific-fragment"},
56+
"I’m an Android-specific fragment",
57+
],
5058
],
59+
"\n",
5160
],
52-
"\n",
5361
],
5462
],
5563
"\n",
@@ -58,9 +66,9 @@ test("inlining-filterable-fragments", async () => {
5866
// eslint-disable-next-line
5967
// @ts-ignore
6068
expect((await import("./api/product/a/aa")).versions).toEqual({
61-
android: "/product/a/aa?platform=android",
62-
ios: "/product/a/aa?platform=ios",
63-
js: "/product?platform=js",
69+
android: "/product/a/aa/q/platform/android",
70+
ios: "/product/a/aa/q/platform/ios",
71+
js: "/product/q/platform/js",
6472
});
6573

6674
// eslint-disable-next-line
@@ -73,15 +81,19 @@ test("inlining-filterable-fragments", async () => {
7381
"docs-filter-target",
7482
{filters: {platform: "ios"}},
7583
[
76-
"docs-in-page-link",
77-
{targetId: "im-an-ios-specific-fragment"},
84+
"div",
85+
{slot: "content"},
7886
[
79-
"h2",
80-
{id: "im-an-ios-specific-fragment"},
81-
"I’m an iOS-specific fragment",
87+
"docs-in-page-link",
88+
{targetId: "im-an-ios-specific-fragment"},
89+
[
90+
"h2",
91+
{id: "im-an-ios-specific-fragment"},
92+
"I’m an iOS-specific fragment",
93+
],
8294
],
95+
"\n",
8396
],
84-
"\n",
8597
],
8698
],
8799
"\n",
@@ -92,15 +104,19 @@ test("inlining-filterable-fragments", async () => {
92104
"docs-filter-target",
93105
{filters: {platform: "android"}},
94106
[
95-
"docs-in-page-link",
96-
{targetId: "im-an-android-specific-fragment"},
107+
"div",
108+
{slot: "content"},
97109
[
98-
"h2",
99-
{id: "im-an-android-specific-fragment"},
100-
"I’m an Android-specific fragment",
110+
"docs-in-page-link",
111+
{targetId: "im-an-android-specific-fragment"},
112+
[
113+
"h2",
114+
{id: "im-an-android-specific-fragment"},
115+
"I’m an Android-specific fragment",
116+
],
101117
],
118+
"\n",
102119
],
103-
"\n",
104120
],
105121
],
106122
"\n",
@@ -111,15 +127,19 @@ test("inlining-filterable-fragments", async () => {
111127
"docs-filter-target",
112128
{filters: {platform: "js"}},
113129
[
114-
"docs-in-page-link",
115-
{targetId: "im-a-js-specific-fragment"},
130+
"div",
131+
{slot: "content"},
116132
[
117-
"h2",
118-
{id: "im-a-js-specific-fragment"},
119-
"I’m a JS-specific fragment",
133+
"docs-in-page-link",
134+
{targetId: "im-a-js-specific-fragment"},
135+
[
136+
"h2",
137+
{id: "im-a-js-specific-fragment"},
138+
"I’m a JS-specific fragment",
139+
],
120140
],
141+
"\n",
121142
],
122-
"\n",
123143
],
124144
],
125145
"\n",
@@ -128,8 +148,8 @@ test("inlining-filterable-fragments", async () => {
128148
// eslint-disable-next-line
129149
// @ts-ignore
130150
expect((await import("./api/product/a/ab")).versions).toEqual({
131-
android: "/product/a/ab?platform=android",
132-
ios: "/product/a/ab?platform=ios",
133-
js: "/product/a/ab?platform=js",
151+
android: "/product/a/ab/q/platform/android",
152+
ios: "/product/a/ab/q/platform/ios",
153+
js: "/product/a/ab/q/platform/js",
134154
});
135155
});

capi/src/__tests__/inlining-fragments/inlining-fragments.ts

+24-12
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ test("inlining-fragments", async () => {
2424
"div",
2525
null,
2626
[
27-
"docs-in-page-link",
28-
{targetId: "im-a-fragment"},
29-
["h3", {id: "im-a-fragment"}, "I’m a fragment"],
27+
"div",
28+
{slot: "content"},
29+
[
30+
"docs-in-page-link",
31+
{targetId: "im-a-fragment"},
32+
["h3", {id: "im-a-fragment"}, "I’m a fragment"],
33+
],
34+
"\n",
3035
],
31-
"\n",
3236
],
3337
],
3438
"\n",
@@ -48,11 +52,15 @@ test("inlining-fragments", async () => {
4852
"div",
4953
null,
5054
[
51-
"docs-in-page-link",
52-
{targetId: "im-a-fragment"},
53-
["h3", {id: "im-a-fragment"}, "I’m a fragment"],
55+
"div",
56+
{slot: "content"},
57+
[
58+
"docs-in-page-link",
59+
{targetId: "im-a-fragment"},
60+
["h3", {id: "im-a-fragment"}, "I’m a fragment"],
61+
],
62+
"\n",
5463
],
55-
"\n",
5664
],
5765
],
5866
"\n",
@@ -72,11 +80,15 @@ test("inlining-fragments", async () => {
7280
"div",
7381
null,
7482
[
75-
"docs-in-page-link",
76-
{targetId: "im-a-fragment"},
77-
["h3", {id: "im-a-fragment"}, "I’m a fragment"],
83+
"div",
84+
{slot: "content"},
85+
[
86+
"docs-in-page-link",
87+
{targetId: "im-a-fragment"},
88+
["h3", {id: "im-a-fragment"}, "I’m a fragment"],
89+
],
90+
"\n",
7891
],
79-
"\n",
8092
],
8193
],
8294
"\n",

capi/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ export async function API(c: t.Config): Promise<void> {
103103
})) {
104104
// we make the given path deduction available in the `ctx`
105105
const srcPath = chunk.toString();
106+
if (srcPath.includes("/q/")) {
107+
throw new Error(
108+
`Source path "${srcPath}" contains "q" as ancestor directory (invalid)`,
109+
);
110+
}
106111
ctx.srcPaths.push(srcPath);
107112
const pathDeduction = new PathDeduction(srcPath, config);
108113
ctx.pathDeductionBySrcPath.set(srcPath, pathDeduction);

capi/src/init-node/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const highlight = (code: string, language: string): string => {
5656
highlighted = entities.encode(code);
5757
}
5858

59-
const c = `<div class="highlight highlight-source${
59+
const c = `<div slot="content" class="highlight highlight-source${
6060
languageIsSet ? `-${language}` : ""
6161
}">${highlighted}</div>`;
6262

0 commit comments

Comments
 (0)