@tinacms/cli 2.4.2 → 2.4.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Collection, TinaField, ContentFrontmatterFormat } from '@tinacms/schema-tools';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { stringifyLabel, stringifyLabelWithField } from './util/naming';
|
|
3
|
+
export { stringifyLabel, stringifyLabelWithField };
|
|
4
4
|
export declare const generateAllTemplates: ({ pathToForestryConfig, }: {
|
|
5
5
|
pathToForestryConfig: string;
|
|
6
6
|
}) => Promise<Map<string, {
|
|
@@ -3,9 +3,9 @@ import { TinaField } from '@tinacms/schema-tools';
|
|
|
3
3
|
* This function is used to replace the internal code with the actual code
|
|
4
4
|
*
|
|
5
5
|
* EX:
|
|
6
|
-
*
|
|
6
|
+
* <marker>...fields()<marker> => ...fields()
|
|
7
7
|
*
|
|
8
|
-
* or
|
|
8
|
+
* or <marker>fields()<marker> => fields()
|
|
9
9
|
*/
|
|
10
10
|
export declare const addVariablesToCode: (codeWithTinaPrefix: string) => {
|
|
11
11
|
code: string;
|
|
@@ -11,8 +11,8 @@ export declare const stringifyTemplateName: (name: string, template: string) =>
|
|
|
11
11
|
declare const forestryFieldWithoutField: z.ZodObject<{
|
|
12
12
|
type: z.ZodUnion<[z.ZodLiteral<"text">, z.ZodLiteral<"datetime">, z.ZodLiteral<"list">, z.ZodLiteral<"file">, z.ZodLiteral<"image_gallery">, z.ZodLiteral<"textarea">, z.ZodLiteral<"tag_list">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"field_group">, z.ZodLiteral<"field_group_list">, z.ZodLiteral<"select">, z.ZodLiteral<"include">, z.ZodLiteral<"blocks">, z.ZodLiteral<"color">]>;
|
|
13
13
|
template_types: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
14
|
-
name: z.ZodString
|
|
15
|
-
label: z.ZodString
|
|
14
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
15
|
+
label: z.ZodEffects<z.ZodString, string, string>;
|
|
16
16
|
default: z.ZodOptional<z.ZodAny>;
|
|
17
17
|
template: z.ZodOptional<z.ZodString>;
|
|
18
18
|
config: z.ZodOptional<z.ZodObject<{
|
|
@@ -104,7 +104,7 @@ interface ForestryFieldType extends ForestryFieldWithoutFieldType {
|
|
|
104
104
|
fields?: ForestryFieldType[];
|
|
105
105
|
}
|
|
106
106
|
declare const FrontmatterTemplateSchema: z.ZodObject<{
|
|
107
|
-
label: z.ZodString
|
|
107
|
+
label: z.ZodEffects<z.ZodString, string, string>;
|
|
108
108
|
hide_body: z.ZodOptional<z.ZodBoolean>;
|
|
109
109
|
fields: z.ZodOptional<z.ZodArray<z.ZodType<ForestryFieldType, z.ZodTypeDef, ForestryFieldType>, "many">>;
|
|
110
110
|
}, "strip", z.ZodTypeAny, {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Cli, Builtins } from "clipanion";
|
|
3
3
|
|
|
4
4
|
// package.json
|
|
5
|
-
var version = "2.4.
|
|
5
|
+
var version = "2.4.4";
|
|
6
6
|
|
|
7
7
|
// src/next/commands/dev-command/index.ts
|
|
8
8
|
import path10 from "path";
|
|
@@ -5106,14 +5106,26 @@ var ErrorSingleton = class _ErrorSingleton {
|
|
|
5106
5106
|
}
|
|
5107
5107
|
};
|
|
5108
5108
|
|
|
5109
|
+
// src/cmds/forestry-migrate/util/naming.ts
|
|
5110
|
+
var stringifyLabel = (label) => {
|
|
5111
|
+
return label.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
|
|
5112
|
+
};
|
|
5113
|
+
var stringifyLabelWithField = (label) => {
|
|
5114
|
+
const labelString = stringifyLabel(label);
|
|
5115
|
+
return `${labelString}Fields`;
|
|
5116
|
+
};
|
|
5117
|
+
var isForestrySafeString = (value) => !/[\x00\r\n]/.test(value);
|
|
5118
|
+
|
|
5109
5119
|
// src/cmds/forestry-migrate/util/codeTransformer.ts
|
|
5120
|
+
import crypto3 from "crypto";
|
|
5110
5121
|
import { format } from "prettier";
|
|
5111
5122
|
import TsParser from "prettier/parser-typescript.js";
|
|
5123
|
+
var INTERNAL_NONCE = crypto3.randomBytes(16).toString("hex");
|
|
5124
|
+
var MARKER_OPEN = `__TINA_INTERNAL_${INTERNAL_NONCE}__:::`;
|
|
5125
|
+
var MARKER_CLOSE = `:::__TINA_INTERNAL_${INTERNAL_NONCE}__`;
|
|
5126
|
+
var MARKER_REGEX = new RegExp(`"${MARKER_OPEN}(.*?)${MARKER_CLOSE}"`, "g");
|
|
5112
5127
|
var addVariablesToCode = (codeWithTinaPrefix) => {
|
|
5113
|
-
const code = codeWithTinaPrefix.replace(
|
|
5114
|
-
/"__TINA_INTERNAL__:::(.*?):::"/g,
|
|
5115
|
-
"$1"
|
|
5116
|
-
);
|
|
5128
|
+
const code = codeWithTinaPrefix.replace(MARKER_REGEX, "$1");
|
|
5117
5129
|
return { code };
|
|
5118
5130
|
};
|
|
5119
5131
|
var makeFieldsWithInternalCode = ({
|
|
@@ -5123,10 +5135,10 @@ var makeFieldsWithInternalCode = ({
|
|
|
5123
5135
|
spread
|
|
5124
5136
|
}) => {
|
|
5125
5137
|
if (hasBody) {
|
|
5126
|
-
return [bodyField,
|
|
5138
|
+
return [bodyField, `${MARKER_OPEN}...${field}()${MARKER_CLOSE}`];
|
|
5127
5139
|
} else {
|
|
5128
|
-
if (spread) return
|
|
5129
|
-
return
|
|
5140
|
+
if (spread) return `${MARKER_OPEN}...${field}()${MARKER_CLOSE}`;
|
|
5141
|
+
return `${MARKER_OPEN}${field}()${MARKER_CLOSE}`;
|
|
5130
5142
|
}
|
|
5131
5143
|
};
|
|
5132
5144
|
var makeTemplateFile = async ({
|
|
@@ -5187,6 +5199,9 @@ var stringifyTemplateName = (name2, template) => {
|
|
|
5187
5199
|
return newName;
|
|
5188
5200
|
}
|
|
5189
5201
|
};
|
|
5202
|
+
var forestrySafeString = z2.string().refine(isForestrySafeString, {
|
|
5203
|
+
message: "Forestry name/label contains an unexpected control character"
|
|
5204
|
+
});
|
|
5190
5205
|
var forestryConfigSchema = z2.object({
|
|
5191
5206
|
sections: z2.array(
|
|
5192
5207
|
z2.object({
|
|
@@ -5228,8 +5243,8 @@ var forestryFieldWithoutField = z2.object({
|
|
|
5228
5243
|
z2.literal("color")
|
|
5229
5244
|
]),
|
|
5230
5245
|
template_types: z2.array(z2.string()).optional().nullable(),
|
|
5231
|
-
name:
|
|
5232
|
-
label:
|
|
5246
|
+
name: forestrySafeString,
|
|
5247
|
+
label: forestrySafeString,
|
|
5233
5248
|
default: z2.any().optional(),
|
|
5234
5249
|
template: z2.string().optional(),
|
|
5235
5250
|
config: z2.object({
|
|
@@ -5260,7 +5275,7 @@ var forestryField = z2.lazy(
|
|
|
5260
5275
|
})
|
|
5261
5276
|
);
|
|
5262
5277
|
var FrontmatterTemplateSchema = z2.object({
|
|
5263
|
-
label:
|
|
5278
|
+
label: forestrySafeString,
|
|
5264
5279
|
hide_body: z2.boolean().optional(),
|
|
5265
5280
|
fields: z2.array(forestryField).optional()
|
|
5266
5281
|
});
|
|
@@ -5531,13 +5546,6 @@ var BODY_FIELD = {
|
|
|
5531
5546
|
description: "This is the markdown body",
|
|
5532
5547
|
isBody: true
|
|
5533
5548
|
};
|
|
5534
|
-
var stringifyLabel = (label) => {
|
|
5535
|
-
return label.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
|
|
5536
|
-
};
|
|
5537
|
-
var stringifyLabelWithField = (label) => {
|
|
5538
|
-
const labelString = stringifyLabel(label);
|
|
5539
|
-
return `${labelString}Fields`;
|
|
5540
|
-
};
|
|
5541
5549
|
var transformForestryMatchToTinaMatch = (match) => {
|
|
5542
5550
|
const newMatch = match.replace(" ", "").replace(/\.?(mdx|md|json|yaml|yml|toml)/g, "")?.replace(/\..*$/g, "")?.replace("{}", "");
|
|
5543
5551
|
if (match !== newMatch) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.4",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"vite": "^4.5.9",
|
|
93
93
|
"yup": "^1.6.1",
|
|
94
94
|
"zod": "^3.24.2",
|
|
95
|
-
"@tinacms/app": "2.5.
|
|
95
|
+
"@tinacms/app": "2.5.4",
|
|
96
96
|
"@tinacms/graphql": "2.4.3",
|
|
97
|
-
"@tinacms/search": "1.2.17",
|
|
98
|
-
"tinacms": "3.8.4",
|
|
99
97
|
"@tinacms/metrics": "2.1.0",
|
|
100
|
-
"@tinacms/schema-tools": "2.8.1"
|
|
98
|
+
"@tinacms/schema-tools": "2.8.1",
|
|
99
|
+
"tinacms": "3.9.1",
|
|
100
|
+
"@tinacms/search": "1.2.17"
|
|
101
101
|
},
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"registry": "https://registry.npmjs.org"
|