gutterpress 0.11.21 → 0.11.22-alpha.1
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.
- package/README.md +11 -0
- package/dist/api/index.d.ts +5 -1
- package/dist/api/index.js +67 -46
- package/dist/{build-0neyk5h6.js → build-se85j9ec.js} +16 -10
- package/dist/cli-5553w972.js +75 -0
- package/dist/{cli-b57adna7.js → cli-8hccw62p.js} +9 -201
- package/dist/cli-9vy4b6ec.js +2089 -0
- package/dist/{cli-sqkccnm7.js → cli-d8xjns66.js} +1 -102
- package/dist/{cli-j0drzb6f.js → cli-fbwqv7p4.js} +720 -5428
- package/dist/cli-gc9av5hs.js +103 -0
- package/dist/cli-gmm3bdeq.js +196 -0
- package/dist/cli-h3phdstf.js +200 -0
- package/dist/{index-qf7y4d85.js → cli-habkc5ng.js} +12 -258
- package/dist/cli-pfrg1r9x.js +3073 -0
- package/dist/{cli-j79451n6.js → cli-yejbb9f8.js} +5 -76
- package/dist/cli.js +15 -13
- package/dist/{doctor-fptq8tvn.js → doctor-bv2t82zd.js} +7 -4
- package/dist/{engine-x07q927h.js → engine-h4ehmrvf.js} +4 -3
- package/dist/{engine-0b8bt05n.js → engine-qwkyhrej.js} +3 -2
- package/dist/{ext-gp624t5c.js → ext-a8ndp142.js} +21 -14
- package/dist/extension-restore-926mv2qk.js +16 -0
- package/dist/extension-restore-q1f7njec.js +20 -0
- package/dist/index-38e18a7j.js +3244 -0
- package/dist/{index-mr72vt8n.js → index-5h9a38jn.js} +1 -213
- package/dist/{cli-5qr3z0qa.js → index-93pqkvty.js} +63 -207
- package/dist/index-dhknsvfz.js +213 -0
- package/dist/index-dm7hx46j.js +2208 -0
- package/dist/{index-t7r8g75c.js → index-gmfh6n05.js} +4 -2
- package/dist/index-r7jcsk6h.js +200 -0
- package/dist/{index-mr7zs8mv.js → index-tkjvs1gf.js} +4774 -9354
- package/dist/index.js +70 -49
- package/dist/lib/extension-manifest.d.ts +22 -1
- package/dist/lib/markdown/plugins.d.ts +20 -0
- package/dist/lib/markdown/two-versions.d.ts +32 -0
- package/dist/lib/publish/plugin-provider.d.ts +16 -0
- package/dist/lib/publish/run-publish.d.ts +13 -5
- package/dist/lib/publish/types.d.ts +34 -2
- package/dist/lib/text-diff.d.ts +43 -0
- package/dist/lib/two-versions-markers.d.ts +26 -0
- package/dist/lib/version-changes.d.ts +87 -0
- package/dist/{new-dre6aw05.js → new-nadp2hvb.js} +23 -16
- package/dist/plugins-gy4q9vaa.js +26 -0
- package/dist/plugins-yeh4shd7.js +24 -0
- package/dist/{preflight-1k1zkg1p.js → preflight-c6q25xqa.js} +18 -11
- package/dist/{preview-dtrksvxf.js → preview-y8chv4cb.js} +19 -13
- package/dist/{publish-g1ytnrmr.js → publish-3qwvxsxa.js} +40 -23
- package/dist/render.js +120 -0
- package/dist/{source-provider-pzmz0br9.js → source-provider-2r74a7wp.js} +2 -1
- package/dist/{source-provider-qbthnmqw.js → source-provider-qbfknhyy.js} +2 -1
- package/dist/{validate-yrrq8639.js → validate-w108kk87.js} +16 -10
- package/package.json +1 -1
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILT_IN_TEMPLATE_IDS,
|
|
3
3
|
EXTENSION_KINDS,
|
|
4
|
-
PRESETS,
|
|
5
|
-
PRESET_IDS,
|
|
6
|
-
TARGETS,
|
|
7
|
-
TARGET_IDS,
|
|
8
4
|
scaffoldExtension,
|
|
9
5
|
scaffoldProject
|
|
10
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-fbwqv7p4.js";
|
|
11
7
|
import {
|
|
12
8
|
resolveGhostscript
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import {
|
|
15
|
-
UsageError,
|
|
16
|
-
rejectExtraPositionals,
|
|
17
|
-
rejectUnknownFlags
|
|
18
|
-
} from "./cli-sqkccnm7.js";
|
|
9
|
+
} from "./cli-yejbb9f8.js";
|
|
19
10
|
import"./cli-ht1bcqdd.js";
|
|
20
|
-
import"./cli-
|
|
21
|
-
import {
|
|
22
|
-
EXIT_CODES
|
|
23
|
-
} from "./cli-46ycxe6r.js";
|
|
11
|
+
import"./cli-8hccw62p.js";
|
|
24
12
|
import"./cli-sth219v1.js";
|
|
25
13
|
import"./cli-eyyggect.js";
|
|
26
14
|
import {
|
|
27
15
|
isToolAvailable
|
|
28
16
|
} from "./cli-asap4t1z.js";
|
|
29
|
-
import"./cli-
|
|
17
|
+
import"./cli-habkc5ng.js";
|
|
30
18
|
import"./cli-v5mp7a6q.js";
|
|
19
|
+
import {
|
|
20
|
+
PRESETS,
|
|
21
|
+
PRESET_IDS,
|
|
22
|
+
TARGETS,
|
|
23
|
+
TARGET_IDS
|
|
24
|
+
} from "./cli-9vy4b6ec.js";
|
|
25
|
+
import"./cli-pfrg1r9x.js";
|
|
26
|
+
import"./cli-5553w972.js";
|
|
27
|
+
import {
|
|
28
|
+
UsageError,
|
|
29
|
+
rejectExtraPositionals,
|
|
30
|
+
rejectUnknownFlags
|
|
31
|
+
} from "./cli-d8xjns66.js";
|
|
32
|
+
import"./cli-gc9av5hs.js";
|
|
33
|
+
import"./cli-gmm3bdeq.js";
|
|
34
|
+
import {
|
|
35
|
+
EXIT_CODES
|
|
36
|
+
} from "./cli-46ycxe6r.js";
|
|
37
|
+
import"./cli-h3phdstf.js";
|
|
31
38
|
import"./cli-37x76zdn.js";
|
|
32
39
|
|
|
33
40
|
// src/commands/new.ts
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__resetPathPluginCacheForTests,
|
|
3
|
+
applyPlugins,
|
|
4
|
+
collectPluginCss,
|
|
5
|
+
collectPluginStyleGroups,
|
|
6
|
+
collectPluginStylePaths,
|
|
7
|
+
loadPlugin,
|
|
8
|
+
loadPlugins,
|
|
9
|
+
loadPluginsWithCss,
|
|
10
|
+
loadPublishFunction
|
|
11
|
+
} from "./cli-pfrg1r9x.js";
|
|
12
|
+
import"./cli-5553w972.js";
|
|
13
|
+
import"./cli-gc9av5hs.js";
|
|
14
|
+
import"./cli-h3phdstf.js";
|
|
15
|
+
import"./cli-37x76zdn.js";
|
|
16
|
+
export {
|
|
17
|
+
loadPublishFunction,
|
|
18
|
+
loadPluginsWithCss,
|
|
19
|
+
loadPlugins,
|
|
20
|
+
loadPlugin,
|
|
21
|
+
collectPluginStylePaths,
|
|
22
|
+
collectPluginStyleGroups,
|
|
23
|
+
collectPluginCss,
|
|
24
|
+
applyPlugins,
|
|
25
|
+
__resetPathPluginCacheForTests
|
|
26
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__resetPathPluginCacheForTests,
|
|
3
|
+
applyPlugins,
|
|
4
|
+
collectPluginCss,
|
|
5
|
+
collectPluginStyleGroups,
|
|
6
|
+
collectPluginStylePaths,
|
|
7
|
+
loadPlugin,
|
|
8
|
+
loadPlugins,
|
|
9
|
+
loadPluginsWithCss,
|
|
10
|
+
loadPublishFunction
|
|
11
|
+
} from "./index-38e18a7j.js";
|
|
12
|
+
import"./index-r7jcsk6h.js";
|
|
13
|
+
import"./index-37x76zdn.js";
|
|
14
|
+
export {
|
|
15
|
+
loadPublishFunction,
|
|
16
|
+
loadPluginsWithCss,
|
|
17
|
+
loadPlugins,
|
|
18
|
+
loadPlugin,
|
|
19
|
+
collectPluginStylePaths,
|
|
20
|
+
collectPluginStyleGroups,
|
|
21
|
+
collectPluginCss,
|
|
22
|
+
applyPlugins,
|
|
23
|
+
__resetPathPluginCacheForTests
|
|
24
|
+
};
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeValidation,
|
|
3
|
-
publishTargetFor,
|
|
4
3
|
reportMissingTools
|
|
5
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-fbwqv7p4.js";
|
|
5
|
+
import"./cli-yejbb9f8.js";
|
|
6
|
+
import"./cli-ht1bcqdd.js";
|
|
7
|
+
import"./cli-8hccw62p.js";
|
|
8
|
+
import"./cli-sth219v1.js";
|
|
9
|
+
import"./cli-eyyggect.js";
|
|
10
|
+
import"./cli-asap4t1z.js";
|
|
11
|
+
import"./cli-habkc5ng.js";
|
|
12
|
+
import"./cli-v5mp7a6q.js";
|
|
13
|
+
import {
|
|
14
|
+
publishTargetFor
|
|
15
|
+
} from "./cli-9vy4b6ec.js";
|
|
16
|
+
import"./cli-pfrg1r9x.js";
|
|
6
17
|
import {
|
|
7
18
|
log
|
|
8
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-5553w972.js";
|
|
9
20
|
import {
|
|
10
21
|
UsageError,
|
|
11
22
|
rejectExtraPositionals,
|
|
12
23
|
rejectUnknownFlags
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
24
|
+
} from "./cli-d8xjns66.js";
|
|
25
|
+
import"./cli-gc9av5hs.js";
|
|
26
|
+
import"./cli-gmm3bdeq.js";
|
|
16
27
|
import {
|
|
17
28
|
BuildError,
|
|
18
29
|
EXIT_CODES
|
|
19
30
|
} from "./cli-46ycxe6r.js";
|
|
20
|
-
import"./cli-
|
|
21
|
-
import"./cli-eyyggect.js";
|
|
22
|
-
import"./cli-asap4t1z.js";
|
|
23
|
-
import"./cli-5qr3z0qa.js";
|
|
24
|
-
import"./cli-v5mp7a6q.js";
|
|
31
|
+
import"./cli-h3phdstf.js";
|
|
25
32
|
import"./cli-37x76zdn.js";
|
|
26
33
|
|
|
27
34
|
// src/commands/preflight.ts
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
previewArgs
|
|
3
|
-
} from "./cli-75qkn0k5.js";
|
|
4
1
|
import {
|
|
5
2
|
openPath,
|
|
6
3
|
runBuild,
|
|
7
4
|
splitOutPath,
|
|
8
5
|
startPreviewServer
|
|
9
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-fbwqv7p4.js";
|
|
7
|
+
import"./cli-yejbb9f8.js";
|
|
8
|
+
import {
|
|
9
|
+
previewArgs
|
|
10
|
+
} from "./cli-75qkn0k5.js";
|
|
11
|
+
import"./cli-ht1bcqdd.js";
|
|
12
|
+
import"./cli-8hccw62p.js";
|
|
13
|
+
import"./cli-sth219v1.js";
|
|
14
|
+
import"./cli-eyyggect.js";
|
|
15
|
+
import"./cli-asap4t1z.js";
|
|
16
|
+
import"./cli-habkc5ng.js";
|
|
17
|
+
import"./cli-v5mp7a6q.js";
|
|
18
|
+
import"./cli-9vy4b6ec.js";
|
|
19
|
+
import"./cli-pfrg1r9x.js";
|
|
10
20
|
import {
|
|
11
21
|
log
|
|
12
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-5553w972.js";
|
|
13
23
|
import {
|
|
14
24
|
UsageError,
|
|
15
25
|
parseFormat,
|
|
@@ -17,17 +27,13 @@ import {
|
|
|
17
27
|
rejectExtraPositionals,
|
|
18
28
|
rejectUnknownFlags,
|
|
19
29
|
resolvePort
|
|
20
|
-
} from "./cli-
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-
|
|
30
|
+
} from "./cli-d8xjns66.js";
|
|
31
|
+
import"./cli-gc9av5hs.js";
|
|
32
|
+
import"./cli-gmm3bdeq.js";
|
|
23
33
|
import {
|
|
24
34
|
BuildError
|
|
25
35
|
} from "./cli-46ycxe6r.js";
|
|
26
|
-
import"./cli-
|
|
27
|
-
import"./cli-eyyggect.js";
|
|
28
|
-
import"./cli-asap4t1z.js";
|
|
29
|
-
import"./cli-5qr3z0qa.js";
|
|
30
|
-
import"./cli-v5mp7a6q.js";
|
|
36
|
+
import"./cli-h3phdstf.js";
|
|
31
37
|
import"./cli-37x76zdn.js";
|
|
32
38
|
|
|
33
39
|
// src/commands/preview.ts
|
|
@@ -2,35 +2,44 @@ import {
|
|
|
2
2
|
connectGoogleDrive,
|
|
3
3
|
connectPublishProvider,
|
|
4
4
|
disconnectPublishCredential,
|
|
5
|
+
listBookPublishProviders,
|
|
5
6
|
listPublishAccounts,
|
|
6
|
-
listPublishProviders,
|
|
7
|
-
loadManifestWithPath,
|
|
8
7
|
openPath,
|
|
9
8
|
publishConnectionStatus,
|
|
10
9
|
publishCredentialKey,
|
|
11
|
-
publishProviderFor,
|
|
12
10
|
resolvePublishFormat,
|
|
11
|
+
resolvePublishProvider,
|
|
13
12
|
runPublish
|
|
14
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-fbwqv7p4.js";
|
|
14
|
+
import {
|
|
15
|
+
FileTokenStore
|
|
16
|
+
} from "./cli-yejbb9f8.js";
|
|
17
|
+
import"./cli-ht1bcqdd.js";
|
|
18
|
+
import"./cli-8hccw62p.js";
|
|
19
|
+
import"./cli-sth219v1.js";
|
|
20
|
+
import"./cli-eyyggect.js";
|
|
21
|
+
import"./cli-asap4t1z.js";
|
|
22
|
+
import"./cli-habkc5ng.js";
|
|
23
|
+
import"./cli-v5mp7a6q.js";
|
|
24
|
+
import {
|
|
25
|
+
loadManifestWithPath
|
|
26
|
+
} from "./cli-9vy4b6ec.js";
|
|
27
|
+
import"./cli-pfrg1r9x.js";
|
|
15
28
|
import {
|
|
16
|
-
FileTokenStore,
|
|
17
29
|
log
|
|
18
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-5553w972.js";
|
|
19
31
|
import {
|
|
20
32
|
UsageError,
|
|
21
33
|
rejectExtraPositionals,
|
|
22
34
|
rejectUnknownFlags
|
|
23
|
-
} from "./cli-
|
|
24
|
-
import"./cli-
|
|
25
|
-
import"./cli-
|
|
35
|
+
} from "./cli-d8xjns66.js";
|
|
36
|
+
import"./cli-gc9av5hs.js";
|
|
37
|
+
import"./cli-gmm3bdeq.js";
|
|
26
38
|
import {
|
|
39
|
+
BuildError,
|
|
27
40
|
EXIT_CODES
|
|
28
41
|
} from "./cli-46ycxe6r.js";
|
|
29
|
-
import"./cli-
|
|
30
|
-
import"./cli-eyyggect.js";
|
|
31
|
-
import"./cli-asap4t1z.js";
|
|
32
|
-
import"./cli-5qr3z0qa.js";
|
|
33
|
-
import"./cli-v5mp7a6q.js";
|
|
42
|
+
import"./cli-h3phdstf.js";
|
|
34
43
|
import"./cli-37x76zdn.js";
|
|
35
44
|
|
|
36
45
|
// src/commands/publish.ts
|
|
@@ -100,7 +109,7 @@ var commandArgs = {
|
|
|
100
109
|
},
|
|
101
110
|
provider: {
|
|
102
111
|
type: "string",
|
|
103
|
-
description: "Provider id: itch | drivethrurpg | kdp | azure-swa | shopify | gdrive"
|
|
112
|
+
description: "Provider id: itch | drivethrurpg | kdp | azure-swa | shopify | gdrive, or a publishing plugin's package name (experimental)"
|
|
104
113
|
},
|
|
105
114
|
list: { type: "boolean", description: "List providers and connection status" },
|
|
106
115
|
connect: {
|
|
@@ -161,7 +170,10 @@ var publish_default = defineCommand({
|
|
|
161
170
|
});
|
|
162
171
|
publishSettings = manifest.publish ?? {};
|
|
163
172
|
} catch {}
|
|
164
|
-
const providers =
|
|
173
|
+
const providers = await listBookPublishProviders({
|
|
174
|
+
projectDir: projectDir2,
|
|
175
|
+
...manifestArg !== undefined ? { manifestPath: manifestArg } : {}
|
|
176
|
+
});
|
|
165
177
|
const rows = await Promise.all(providers.map(async (p) => {
|
|
166
178
|
const status = await publishConnectionStatus(p, deps);
|
|
167
179
|
const accounts = p.credential.required ? await listPublishAccounts(p, deps) : [];
|
|
@@ -172,7 +184,8 @@ var publish_default = defineCommand({
|
|
|
172
184
|
kind: p.kind,
|
|
173
185
|
format: resolvePublishFormat(p, providerConfig),
|
|
174
186
|
connected: status.connected,
|
|
175
|
-
accounts
|
|
187
|
+
accounts,
|
|
188
|
+
...p.experimental ? { experimental: true } : {}
|
|
176
189
|
};
|
|
177
190
|
}));
|
|
178
191
|
if (json) {
|
|
@@ -180,7 +193,7 @@ var publish_default = defineCommand({
|
|
|
180
193
|
`);
|
|
181
194
|
} else {
|
|
182
195
|
for (const r of rows) {
|
|
183
|
-
const status = r.kind === "guided" ? "no key needed" : r.connected ? "connected" : "not connected";
|
|
196
|
+
const status = r.experimental ? "experimental" : r.kind === "guided" ? "no key needed" : r.connected ? "connected" : "not connected";
|
|
184
197
|
log.info(`${r.id.padEnd(13)} ${r.label.padEnd(22)} ${r.kind.padEnd(6)} ${r.format.padEnd(4)} ${status}`);
|
|
185
198
|
for (const acc of r.accounts) {
|
|
186
199
|
log.info(` • ${acc.account ? acc.account : "(default)"}`);
|
|
@@ -191,17 +204,20 @@ var publish_default = defineCommand({
|
|
|
191
204
|
}
|
|
192
205
|
const providerId = typeof args.provider === "string" ? args.provider : "";
|
|
193
206
|
if (!providerId) {
|
|
194
|
-
log.error("Specify a provider: gutterpress publish --provider <itch|drivethrurpg|kdp|azure-swa|shopify|gdrive> (or --list).");
|
|
207
|
+
log.error("Specify a provider: gutterpress publish --provider <itch|drivethrurpg|kdp|azure-swa|shopify|gdrive> " + "or a publishing plugin's package name (or --list).");
|
|
195
208
|
process.exit(EXIT_CODES.USAGE);
|
|
196
209
|
}
|
|
210
|
+
const projectDir = path.resolve(args.project ?? ".");
|
|
197
211
|
let provider;
|
|
198
212
|
try {
|
|
199
|
-
provider =
|
|
213
|
+
provider = await resolvePublishProvider(providerId, {
|
|
214
|
+
projectDir,
|
|
215
|
+
...typeof args.manifest === "string" ? { manifestPath: args.manifest } : {}
|
|
216
|
+
});
|
|
200
217
|
} catch (e) {
|
|
201
218
|
log.error(e instanceof Error ? e.message : String(e));
|
|
202
|
-
process.exit(EXIT_CODES.USAGE);
|
|
219
|
+
process.exit(e instanceof BuildError ? e.exitCode : EXIT_CODES.USAGE);
|
|
203
220
|
}
|
|
204
|
-
const projectDir = path.resolve(args.project ?? ".");
|
|
205
221
|
const account = typeof args.account === "string" ? args.account.trim() : "";
|
|
206
222
|
if (args.disconnect) {
|
|
207
223
|
const key = publishCredentialKey(provider.info.credential.host, account);
|
|
@@ -211,7 +227,7 @@ var publish_default = defineCommand({
|
|
|
211
227
|
}
|
|
212
228
|
if (args.connect) {
|
|
213
229
|
if (!provider.info.credential.required) {
|
|
214
|
-
log.info(`${provider.info.label} is a guided provider — no API key needed. Just run: gutterpress publish --provider ${provider.info.id}`);
|
|
230
|
+
log.info(provider.info.experimental ? `${provider.info.label} is a publishing plugin — it manages its own credentials (see its documentation). Just run: gutterpress publish --provider ${provider.info.id}` : `${provider.info.label} is a guided provider — no API key needed. Just run: gutterpress publish --provider ${provider.info.id}`);
|
|
215
231
|
return;
|
|
216
232
|
}
|
|
217
233
|
if (provider.info.credential.connect === "oauth") {
|
|
@@ -264,6 +280,7 @@ Create one at: ${provider.info.credential.tokenUrl}` : ""));
|
|
|
264
280
|
result = await runPublish({
|
|
265
281
|
projectDir,
|
|
266
282
|
providerId: provider.info.id,
|
|
283
|
+
provider,
|
|
267
284
|
manifestPath: typeof args.manifest === "string" ? args.manifest : undefined,
|
|
268
285
|
artifactPath: typeof args.file === "string" ? args.file : undefined,
|
|
269
286
|
dryRun: !!args["dry-run"]
|
package/dist/render.js
CHANGED
|
@@ -1477,6 +1477,124 @@ var GP_CLASSES = new Set([
|
|
|
1477
1477
|
"gp-continued"
|
|
1478
1478
|
]);
|
|
1479
1479
|
|
|
1480
|
+
// src/lib/two-versions-markers.ts
|
|
1481
|
+
var YOUR_VERSION_LABEL = "your version";
|
|
1482
|
+
var ONLINE_VERSION_LABEL = "online version";
|
|
1483
|
+
var TWO_VERSIONS_OPEN = `<<<<<<< ${YOUR_VERSION_LABEL}`;
|
|
1484
|
+
var TWO_VERSIONS_SEPARATOR = "=======";
|
|
1485
|
+
var TWO_VERSIONS_CLOSE = `>>>>>>> ${ONLINE_VERSION_LABEL}`;
|
|
1486
|
+
|
|
1487
|
+
// src/lib/markdown/two-versions.ts
|
|
1488
|
+
var TWO_VERSIONS_CSS = `
|
|
1489
|
+
.gp-two-versions {
|
|
1490
|
+
margin: 1em 0;
|
|
1491
|
+
border: 2px dashed #b7791f;
|
|
1492
|
+
border-radius: 6px;
|
|
1493
|
+
break-inside: avoid;
|
|
1494
|
+
}
|
|
1495
|
+
.gp-two-versions > .gp-version {
|
|
1496
|
+
padding: 0.5em 0.9em;
|
|
1497
|
+
}
|
|
1498
|
+
.gp-two-versions > .gp-version + .gp-version {
|
|
1499
|
+
border-top: 2px dashed #b7791f;
|
|
1500
|
+
}
|
|
1501
|
+
.gp-two-versions > .gp-version > .gp-version-text {
|
|
1502
|
+
margin: 0;
|
|
1503
|
+
white-space: pre-wrap;
|
|
1504
|
+
overflow-wrap: anywhere;
|
|
1505
|
+
font-size: 0.85em;
|
|
1506
|
+
}
|
|
1507
|
+
.gp-two-versions > .gp-version::before {
|
|
1508
|
+
content: attr(data-label);
|
|
1509
|
+
display: block;
|
|
1510
|
+
margin-bottom: 0.35em;
|
|
1511
|
+
font-family: system-ui, sans-serif;
|
|
1512
|
+
font-size: 0.7em;
|
|
1513
|
+
font-weight: 700;
|
|
1514
|
+
letter-spacing: 0.06em;
|
|
1515
|
+
text-transform: uppercase;
|
|
1516
|
+
color: #b7791f;
|
|
1517
|
+
}
|
|
1518
|
+
`;
|
|
1519
|
+
function lineText(state, line) {
|
|
1520
|
+
return state.src.slice(state.bMarks[line] + state.tShift[line], state.eMarks[line]);
|
|
1521
|
+
}
|
|
1522
|
+
var MARKER_LINE = /^@[a-z]/;
|
|
1523
|
+
function hasMarkerLine(state, from, to) {
|
|
1524
|
+
for (let line = from;line < to; line++) {
|
|
1525
|
+
if (MARKER_LINE.test(lineText(state, line)))
|
|
1526
|
+
return true;
|
|
1527
|
+
}
|
|
1528
|
+
return false;
|
|
1529
|
+
}
|
|
1530
|
+
function pushVerbatim(state, from, to) {
|
|
1531
|
+
const raw = state.getLines(from, to, 0, false);
|
|
1532
|
+
const token = state.push("html_block", "", 0);
|
|
1533
|
+
token.map = [from, to];
|
|
1534
|
+
token.block = true;
|
|
1535
|
+
token.content = `<pre class="gp-version-text">${state.md.utils.escapeHtml(raw)}</pre>
|
|
1536
|
+
`;
|
|
1537
|
+
}
|
|
1538
|
+
function pushVersion(state, which, label, from, to) {
|
|
1539
|
+
const open = state.push("two_version_open", "div", 1);
|
|
1540
|
+
open.attrSet("class", `gp-version gp-version-${which}`);
|
|
1541
|
+
open.attrSet("data-label", label);
|
|
1542
|
+
open.map = [from, to];
|
|
1543
|
+
open.block = true;
|
|
1544
|
+
if (hasMarkerLine(state, from, to)) {
|
|
1545
|
+
pushVerbatim(state, from, to);
|
|
1546
|
+
} else {
|
|
1547
|
+
state.parentType = "container";
|
|
1548
|
+
state.lineMax = to;
|
|
1549
|
+
state.md.block.tokenize(state, from, to);
|
|
1550
|
+
}
|
|
1551
|
+
const close = state.push("two_version_close", "div", -1);
|
|
1552
|
+
close.block = true;
|
|
1553
|
+
}
|
|
1554
|
+
function twoVersions(state, startLine, endLine, silent) {
|
|
1555
|
+
if (state.sCount[startLine] - state.blkIndent >= 4)
|
|
1556
|
+
return false;
|
|
1557
|
+
if (state.src.charCodeAt(state.bMarks[startLine] + state.tShift[startLine]) !== 60)
|
|
1558
|
+
return false;
|
|
1559
|
+
if (lineText(state, startLine) !== TWO_VERSIONS_OPEN)
|
|
1560
|
+
return false;
|
|
1561
|
+
let separator = -1;
|
|
1562
|
+
let closer = -1;
|
|
1563
|
+
for (let line = startLine + 1;line < endLine; line++) {
|
|
1564
|
+
const text = lineText(state, line);
|
|
1565
|
+
if (separator < 0 && text === TWO_VERSIONS_SEPARATOR)
|
|
1566
|
+
separator = line;
|
|
1567
|
+
else if (text === TWO_VERSIONS_CLOSE) {
|
|
1568
|
+
closer = line;
|
|
1569
|
+
break;
|
|
1570
|
+
} else if (text === TWO_VERSIONS_OPEN)
|
|
1571
|
+
return false;
|
|
1572
|
+
}
|
|
1573
|
+
if (separator < 0 || closer < 0)
|
|
1574
|
+
return false;
|
|
1575
|
+
if (silent)
|
|
1576
|
+
return true;
|
|
1577
|
+
const oldParent = state.parentType;
|
|
1578
|
+
const oldLineMax = state.lineMax;
|
|
1579
|
+
const open = state.push("two_versions_open", "div", 1);
|
|
1580
|
+
open.attrSet("class", "gp-two-versions");
|
|
1581
|
+
open.map = [startLine, closer + 1];
|
|
1582
|
+
open.block = true;
|
|
1583
|
+
pushVersion(state, "yours", "Your version", startLine + 1, separator);
|
|
1584
|
+
pushVersion(state, "online", "Online version", separator + 1, closer);
|
|
1585
|
+
const close = state.push("two_versions_close", "div", -1);
|
|
1586
|
+
close.block = true;
|
|
1587
|
+
state.parentType = oldParent;
|
|
1588
|
+
state.lineMax = oldLineMax;
|
|
1589
|
+
state.line = closer + 1;
|
|
1590
|
+
return true;
|
|
1591
|
+
}
|
|
1592
|
+
function gpTwoVersions(md) {
|
|
1593
|
+
md.block.ruler.before("html_block", "two_versions", twoVersions, {
|
|
1594
|
+
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1480
1598
|
// src/lib/markdown/table-align.ts
|
|
1481
1599
|
var ALIGN = /^text-align:(left|center|right)$/;
|
|
1482
1600
|
function gpTableAlign(md) {
|
|
@@ -2352,6 +2470,7 @@ function createMarkdownRenderer(customPlugins) {
|
|
|
2352
2470
|
md.use(gpPinScope);
|
|
2353
2471
|
md.use(gpBlockNames);
|
|
2354
2472
|
md.use(gpTableAlign);
|
|
2473
|
+
md.use(gpTwoVersions);
|
|
2355
2474
|
registerImageRule(md);
|
|
2356
2475
|
if (customPlugins && customPlugins.length > 0) {
|
|
2357
2476
|
applyPlugins(md, customPlugins);
|
|
@@ -2445,6 +2564,7 @@ async function assembleBookHtml(opts) {
|
|
|
2445
2564
|
`/* gutterpress markers */
|
|
2446
2565
|
@layer gp.marker {
|
|
2447
2566
|
${MARKER_CSS.trim()}
|
|
2567
|
+
${TWO_VERSIONS_CSS.trim()}
|
|
2448
2568
|
}`,
|
|
2449
2569
|
`/* gutterpress */
|
|
2450
2570
|
@layer gp.vocab {
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeAndReport
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-fbwqv7p4.js";
|
|
4
|
+
import"./cli-yejbb9f8.js";
|
|
5
|
+
import"./cli-ht1bcqdd.js";
|
|
6
|
+
import"./cli-8hccw62p.js";
|
|
7
|
+
import"./cli-sth219v1.js";
|
|
8
|
+
import"./cli-eyyggect.js";
|
|
9
|
+
import"./cli-asap4t1z.js";
|
|
10
|
+
import"./cli-habkc5ng.js";
|
|
11
|
+
import"./cli-v5mp7a6q.js";
|
|
12
|
+
import"./cli-9vy4b6ec.js";
|
|
13
|
+
import"./cli-pfrg1r9x.js";
|
|
4
14
|
import {
|
|
5
15
|
log
|
|
6
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-5553w972.js";
|
|
7
17
|
import {
|
|
8
18
|
UsageError,
|
|
9
19
|
rejectExtraPositionals,
|
|
10
20
|
rejectUnknownFlags
|
|
11
|
-
} from "./cli-
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
21
|
+
} from "./cli-d8xjns66.js";
|
|
22
|
+
import"./cli-gc9av5hs.js";
|
|
23
|
+
import"./cli-gmm3bdeq.js";
|
|
14
24
|
import {
|
|
15
25
|
BuildError,
|
|
16
26
|
EXIT_CODES
|
|
17
27
|
} from "./cli-46ycxe6r.js";
|
|
18
|
-
import"./cli-
|
|
19
|
-
import"./cli-eyyggect.js";
|
|
20
|
-
import"./cli-asap4t1z.js";
|
|
21
|
-
import"./cli-5qr3z0qa.js";
|
|
22
|
-
import"./cli-v5mp7a6q.js";
|
|
28
|
+
import"./cli-h3phdstf.js";
|
|
23
29
|
import"./cli-37x76zdn.js";
|
|
24
30
|
|
|
25
31
|
// src/commands/validate.ts
|
package/package.json
CHANGED