@tinacms/cli 0.0.0-ac59522-20251205041248 → 0.0.0-ad128cc-20251219023808

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.
@@ -59,7 +59,6 @@ declare const forestryFieldWithoutField: z.ZodObject<{
59
59
  };
60
60
  }>>;
61
61
  }, "strip", z.ZodTypeAny, {
62
- type?: "number" | "boolean" | "file" | "text" | "color" | "include" | "list" | "datetime" | "select" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks";
63
62
  default?: any;
64
63
  name?: string;
65
64
  config?: {
@@ -76,10 +75,10 @@ declare const forestryFieldWithoutField: z.ZodObject<{
76
75
  };
77
76
  };
78
77
  label?: string;
78
+ type?: "number" | "boolean" | "text" | "color" | "file" | "include" | "list" | "datetime" | "select" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks";
79
79
  template?: string;
80
80
  template_types?: string[];
81
81
  }, {
82
- type?: "number" | "boolean" | "file" | "text" | "color" | "include" | "list" | "datetime" | "select" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks";
83
82
  default?: any;
84
83
  name?: string;
85
84
  config?: {
@@ -96,6 +95,7 @@ declare const forestryFieldWithoutField: z.ZodObject<{
96
95
  };
97
96
  };
98
97
  label?: string;
98
+ type?: "number" | "boolean" | "text" | "color" | "file" | "include" | "list" | "datetime" | "select" | "image_gallery" | "textarea" | "tag_list" | "field_group" | "field_group_list" | "blocks";
99
99
  template?: string;
100
100
  template_types?: string[];
101
101
  }>;
@@ -149,12 +149,12 @@ export declare const parseSections: ({ val }: {
149
149
  val: unknown;
150
150
  }) => {
151
151
  sections?: {
152
- exclude?: string;
153
- type?: "heading" | "document" | "directory" | "jekyll-pages" | "jekyll-posts";
154
152
  match?: string;
155
153
  templates?: string[];
156
154
  label?: string;
157
155
  path?: string;
156
+ type?: "heading" | "document" | "directory" | "jekyll-pages" | "jekyll-posts";
157
+ exclude?: string;
158
158
  create?: "none" | "all" | "documents";
159
159
  new_doc_ext?: string;
160
160
  read_only?: boolean;
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.0.1";
5
+ var version = "2.0.5";
6
6
 
7
7
  // src/next/commands/dev-command/index.ts
8
8
  import path8 from "path";
@@ -28,15 +28,15 @@ function isUnicodeSupported() {
28
28
  }
29
29
 
30
30
  // src/logger/index.ts
31
- import log4js from "log4js";
32
- var logger = log4js.getLogger();
33
- log4js.configure({
34
- appenders: {
35
- out: { type: "stdout", layout: { type: "messagePassThrough" } }
36
- },
37
- categories: { default: { appenders: ["out"], level: "info" } }
38
- });
39
- logger.level = "info";
31
+ var logger = {
32
+ level: "info",
33
+ info: (msg) => process.stdout.write(msg + "\n"),
34
+ warn: (msg) => process.stdout.write(msg + "\n"),
35
+ error: (msg) => process.stderr.write(msg + "\n"),
36
+ debug: (msg) => {
37
+ if (logger.level === "debug") process.stdout.write(msg + "\n");
38
+ }
39
+ };
40
40
  function ansiRegex() {
41
41
  const pattern = [
42
42
  "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
@@ -1115,20 +1115,12 @@ var ConfigManager = class {
1115
1115
  this.generatedFolderPath,
1116
1116
  "config.prebuild.jsx"
1117
1117
  );
1118
- const nativeNodeModulesPlugin = {
1119
- name: "native-node-modules",
1120
- setup(build3) {
1121
- build3.onResolve({ filter: /^node:.*/ }, (args) => {
1122
- return {
1123
- path: args.path,
1124
- external: true
1125
- };
1126
- });
1127
- }
1128
- };
1129
1118
  const outfile = path3.join(tmpdir, "config.build.jsx");
1130
1119
  const outfile2 = path3.join(tmpdir, "config.build.mjs");
1131
1120
  const tempTSConfigFile = path3.join(tmpdir, "tsconfig.json");
1121
+ const esmRequireBanner = {
1122
+ js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
1123
+ };
1132
1124
  fs2.outputFileSync(tempTSConfigFile, "{}");
1133
1125
  const result2 = await esbuild.build({
1134
1126
  entryPoints: [configFilePath],
@@ -1158,12 +1150,12 @@ var ConfigManager = class {
1158
1150
  platform: "node",
1159
1151
  format: "esm",
1160
1152
  outfile,
1161
- loader: loaders
1153
+ loader: loaders,
1154
+ banner: esmRequireBanner
1162
1155
  });
1163
1156
  await esbuild.build({
1164
1157
  entryPoints: [outfile],
1165
1158
  bundle: true,
1166
- // Suppress warning about comparison with -0 from client module
1167
1159
  logLevel: "silent",
1168
1160
  platform: "node",
1169
1161
  target: ["esnext"],
@@ -2187,34 +2179,83 @@ var createSearchIndexRouter = ({
2187
2179
  searchIndex
2188
2180
  }) => {
2189
2181
  const put = async (req, res) => {
2190
- const { docs } = req.body;
2182
+ const docs = req.body?.docs ?? [];
2191
2183
  const result = await searchIndex.PUT(docs);
2192
2184
  res.writeHead(200, { "Content-Type": "application/json" });
2193
2185
  res.end(JSON.stringify({ result }));
2194
2186
  };
2195
2187
  const get = async (req, res) => {
2196
- const requestURL = new URL(req.url, config2.apiURL);
2188
+ const requestURL = new URL(req.url ?? "", config2.apiURL);
2197
2189
  const query = requestURL.searchParams.get("q");
2198
2190
  const optionsParam = requestURL.searchParams.get("options");
2199
- let options = {
2191
+ const fuzzyParam = requestURL.searchParams.get("fuzzy");
2192
+ const fuzzyOptionsParam = requestURL.searchParams.get("fuzzyOptions");
2193
+ let searchIndexOptions = {
2200
2194
  DOCUMENTS: false
2201
2195
  };
2202
2196
  if (optionsParam) {
2203
- options = {
2204
- ...options,
2197
+ searchIndexOptions = {
2198
+ ...searchIndexOptions,
2205
2199
  ...JSON.parse(optionsParam)
2206
2200
  };
2207
2201
  }
2208
2202
  res.writeHead(200, { "Content-Type": "application/json" });
2209
2203
  if (query) {
2210
- const result = await searchIndex.QUERY(JSON.parse(query), options);
2204
+ const queryObj = JSON.parse(query);
2205
+ if (fuzzyParam === "true" && searchIndex.fuzzySearchWrapper) {
2206
+ try {
2207
+ const fuzzyOptions = fuzzyOptionsParam ? JSON.parse(fuzzyOptionsParam) : {};
2208
+ const searchTerms = queryObj.AND ? queryObj.AND.filter(
2209
+ (term) => !term.includes("_collection:")
2210
+ ) : [];
2211
+ const collectionFilter = queryObj.AND?.find(
2212
+ (term) => term.includes("_collection:")
2213
+ );
2214
+ const paginationOptions = {};
2215
+ if (searchIndexOptions.PAGE) {
2216
+ paginationOptions.limit = searchIndexOptions.PAGE.SIZE;
2217
+ paginationOptions.cursor = searchIndexOptions.PAGE.NUMBER.toString();
2218
+ }
2219
+ const searchQuery = collectionFilter ? `${searchTerms.join(" ")} ${collectionFilter}` : searchTerms.join(" ");
2220
+ const result2 = await searchIndex.fuzzySearchWrapper.query(
2221
+ searchQuery,
2222
+ {
2223
+ ...paginationOptions,
2224
+ fuzzy: true,
2225
+ fuzzyOptions
2226
+ }
2227
+ );
2228
+ if (collectionFilter) {
2229
+ const collection = collectionFilter.split(":")[1];
2230
+ result2.results = result2.results.filter(
2231
+ (r) => r._id && r._id.startsWith(`${collection}:`)
2232
+ );
2233
+ }
2234
+ res.end(
2235
+ JSON.stringify({
2236
+ RESULT: result2.results,
2237
+ RESULT_LENGTH: result2.total,
2238
+ NEXT_CURSOR: result2.nextCursor,
2239
+ PREV_CURSOR: result2.prevCursor,
2240
+ FUZZY_MATCHES: result2.fuzzyMatches || {}
2241
+ })
2242
+ );
2243
+ return;
2244
+ } catch (error) {
2245
+ console.warn(
2246
+ "[search] Fuzzy search failed, falling back to standard search:",
2247
+ error instanceof Error ? error.message : error
2248
+ );
2249
+ }
2250
+ }
2251
+ const result = await searchIndex.QUERY(queryObj, searchIndexOptions);
2211
2252
  res.end(JSON.stringify(result));
2212
2253
  } else {
2213
2254
  res.end(JSON.stringify({ RESULT: [] }));
2214
2255
  }
2215
2256
  };
2216
2257
  const del = async (req, res) => {
2217
- const requestURL = new URL(req.url, config2.apiURL);
2258
+ const requestURL = new URL(req.url ?? "", config2.apiURL);
2218
2259
  const docId = requestURL.pathname.split("/").filter(Boolean).slice(1).join("/");
2219
2260
  const result = await searchIndex.DELETE(docId);
2220
2261
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -2585,10 +2626,14 @@ ${dangerText(e.message)}
2585
2626
  configManager.config.search && searchIndexer
2586
2627
  );
2587
2628
  }
2629
+ const searchIndexWithFuzzy = searchIndexClient.searchIndex;
2630
+ if (searchIndexClient.fuzzySearchWrapper) {
2631
+ searchIndexWithFuzzy.fuzzySearchWrapper = searchIndexClient.fuzzySearchWrapper;
2632
+ }
2588
2633
  const server = await createDevServer(
2589
2634
  configManager,
2590
2635
  database,
2591
- searchIndexClient.searchIndex,
2636
+ searchIndexWithFuzzy,
2592
2637
  apiURL,
2593
2638
  this.noWatch,
2594
2639
  dbLock
@@ -5072,7 +5117,7 @@ var generateAllTemplates = async ({
5072
5117
  });
5073
5118
  templateMap.set(tem, { fields, templateObj });
5074
5119
  } catch (e) {
5075
- logger.log(`Error parsing template frontmatter template', tem + '.yml'`);
5120
+ logger.warn(`Error parsing template frontmatter template, ${tem}.yml`);
5076
5121
  console.error(e);
5077
5122
  templateMap.set(tem, { fields: [], templateObj: {} });
5078
5123
  }
@@ -5116,7 +5161,7 @@ var generateCollectionFromForestrySection = (args) => {
5116
5161
  }
5117
5162
  if (section.type === "directory") {
5118
5163
  if (!section?.path || section.path === "/" || section.path === "./" || section.path === ".") {
5119
- logger.log(
5164
+ logger.warn(
5120
5165
  warnText(
5121
5166
  `Warning: Section ${section.label} is using a Root Path. Currently, Tina Does not support Root paths see ${linkText(
5122
5167
  "https://github.com/tinacms/tinacms/issues/3768"
@@ -5253,7 +5298,7 @@ var generateCollectionFromForestrySection = (args) => {
5253
5298
  fields
5254
5299
  };
5255
5300
  } else {
5256
- logger.log(
5301
+ logger.warn(
5257
5302
  warnText(
5258
5303
  `Error: document section has an unsupported file extension: ${extname} in ${section.path}`
5259
5304
  )
@@ -6528,9 +6573,7 @@ ${titleText(" TinaCMS ")} has been initialized!`));
6528
6573
  );
6529
6574
  if (framework.name === "hugo") {
6530
6575
  logger.info(
6531
- focusText("Hugo is required. "),
6532
- "Don't have Hugo installed? Follow this guide to set it up: ",
6533
- linkText("https://gohugo.io/installation/")
6576
+ focusText("Hugo is required. ") + "Don't have Hugo installed? Follow this guide to set it up: " + linkText("https://gohugo.io/installation/")
6534
6577
  );
6535
6578
  }
6536
6579
  logger.info(
@@ -1,5 +1,10 @@
1
- import log4js from 'log4js';
2
- export declare const logger: log4js.Logger;
1
+ export declare const logger: {
2
+ level: string;
3
+ info: (msg: string) => boolean;
4
+ warn: (msg: string) => boolean;
5
+ error: (msg: string) => boolean;
6
+ debug: (msg: string) => void;
7
+ };
3
8
  export declare const note: (message?: string, title?: string) => void;
4
9
  export declare const log: (message?: string) => void;
5
10
  export declare const warn: (message?: string, path?: string) => void;
@@ -1,12 +1,48 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { SearchQueryResponse, SearchResult } from '@tinacms/search';
1
3
  export interface PathConfig {
2
4
  apiURL: string;
3
5
  searchPath: string;
4
6
  }
7
+ interface SearchIndexOptions {
8
+ DOCUMENTS?: boolean;
9
+ PAGE?: {
10
+ NUMBER: number;
11
+ SIZE: number;
12
+ };
13
+ }
14
+ interface SearchIndexResult {
15
+ RESULT: SearchResult[];
16
+ RESULT_LENGTH: number;
17
+ }
18
+ interface FuzzySearchWrapper {
19
+ query: (query: string, options: {
20
+ limit?: number;
21
+ cursor?: string;
22
+ fuzzy: boolean;
23
+ fuzzyOptions: Record<string, unknown>;
24
+ }) => Promise<SearchQueryResponse>;
25
+ }
26
+ interface SearchIndex {
27
+ PUT: (docs: Record<string, unknown>[]) => Promise<unknown>;
28
+ DELETE: (id: string) => Promise<unknown>;
29
+ QUERY: (query: {
30
+ AND?: string[];
31
+ OR?: string[];
32
+ }, options: SearchIndexOptions) => Promise<SearchIndexResult>;
33
+ fuzzySearchWrapper?: FuzzySearchWrapper;
34
+ }
35
+ interface RequestWithBody extends IncomingMessage {
36
+ body?: {
37
+ docs?: Record<string, unknown>[];
38
+ };
39
+ }
5
40
  export declare const createSearchIndexRouter: ({ config, searchIndex, }: {
6
41
  config: PathConfig;
7
- searchIndex: any;
42
+ searchIndex: SearchIndex;
8
43
  }) => {
9
- del: (req: any, res: any) => Promise<void>;
10
- get: (req: any, res: any) => Promise<void>;
11
- put: (req: any, res: any) => Promise<void>;
44
+ del: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
45
+ get: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
46
+ put: (req: RequestWithBody, res: ServerResponse) => Promise<void>;
12
47
  };
48
+ export {};
@@ -1,36 +1,16 @@
1
1
  /**
2
2
 
3
3
  */
4
- export declare const successText: import("chalk").Chalk & {
5
- supportsColor: import("chalk").ColorSupport;
6
- };
7
- export declare const focusText: import("chalk").Chalk & {
8
- supportsColor: import("chalk").ColorSupport;
9
- };
10
- export declare const dangerText: import("chalk").Chalk & {
11
- supportsColor: import("chalk").ColorSupport;
12
- };
13
- export declare const neutralText: import("chalk").Chalk & {
14
- supportsColor: import("chalk").ColorSupport;
15
- };
16
- export declare const linkText: import("chalk").Chalk & {
17
- supportsColor: import("chalk").ColorSupport;
18
- };
19
- export declare const labelText: import("chalk").Chalk & {
20
- supportsColor: import("chalk").ColorSupport;
21
- };
22
- export declare const cmdText: import("chalk").Chalk & {
23
- supportsColor: import("chalk").ColorSupport;
24
- };
4
+ export declare const successText: import("chalk").ChalkInstance;
5
+ export declare const focusText: import("chalk").ChalkInstance;
6
+ export declare const dangerText: import("chalk").ChalkInstance;
7
+ export declare const neutralText: import("chalk").ChalkInstance;
8
+ export declare const linkText: import("chalk").ChalkInstance;
9
+ export declare const labelText: import("chalk").ChalkInstance;
10
+ export declare const cmdText: import("chalk").ChalkInstance;
25
11
  export declare const indentedCmd: (str: any) => string;
26
12
  export declare const indentText: (str: any) => string;
27
- export declare const logText: import("chalk").Chalk & {
28
- supportsColor: import("chalk").ColorSupport;
29
- };
30
- export declare const warnText: import("chalk").Chalk & {
31
- supportsColor: import("chalk").ColorSupport;
32
- };
33
- export declare const titleText: import("chalk").Chalk & {
34
- supportsColor: import("chalk").ColorSupport;
35
- };
13
+ export declare const logText: import("chalk").ChalkInstance;
14
+ export declare const warnText: import("chalk").ChalkInstance;
15
+ export declare const titleText: import("chalk").ChalkInstance;
36
16
  export declare const CONFIRMATION_TEXT: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
3
  "type": "module",
4
- "version": "0.0.0-ac59522-20251205041248",
4
+ "version": "0.0.0-ad128cc-20251219023808",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "files": [
@@ -36,13 +36,12 @@
36
36
  "@types/jest": "26.0.4",
37
37
  "@types/js-yaml": "^4.0.9",
38
38
  "@types/listr": "0.14.2",
39
- "@types/log4js": "^2.3.5",
40
39
  "@types/multer": "^1.4.12",
41
40
  "@types/node": "^22.13.1",
42
41
  "@types/progress": "^2.0.7",
43
42
  "@types/prompts": "^2.4.9",
44
43
  "jest": "^29.7.0",
45
- "@tinacms/scripts": "1.4.1"
44
+ "@tinacms/scripts": "1.4.2"
46
45
  },
47
46
  "dependencies": {
48
47
  "@graphql-codegen/core": "^2.6.8",
@@ -64,7 +63,7 @@
64
63
  "auto-bind": "^4.0.0",
65
64
  "body-parser": "^1.20.3",
66
65
  "busboy": "^1.6.0",
67
- "chalk": "^2.4.2",
66
+ "chalk": "^5.4.1",
68
67
  "chokidar": "^3.6.0",
69
68
  "cli-spinner": "^0.2.10",
70
69
  "clipanion": "^3.2.1",
@@ -75,7 +74,6 @@
75
74
  "fs-extra": "^11.3.0",
76
75
  "graphql": "15.8.0",
77
76
  "js-yaml": "^4.1.0",
78
- "log4js": "^6.9.1",
79
77
  "many-level": "^2.0.0",
80
78
  "memory-level": "^1.0.0",
81
79
  "minimatch": "^5.1.6",
@@ -90,12 +88,12 @@
90
88
  "vite": "^4.5.9",
91
89
  "yup": "^1.6.1",
92
90
  "zod": "^3.24.2",
93
- "@tinacms/app": "0.0.0-ac59522-20251205041248",
94
- "@tinacms/graphql": "2.0.0",
95
- "@tinacms/metrics": "2.0.0",
96
- "@tinacms/schema-tools": "2.0.0",
97
- "tinacms": "0.0.0-ac59522-20251205041248",
98
- "@tinacms/search": "1.1.4"
91
+ "@tinacms/app": "0.0.0-ad128cc-20251219023808",
92
+ "@tinacms/graphql": "0.0.0-ad128cc-20251219023808",
93
+ "@tinacms/metrics": "2.0.1",
94
+ "@tinacms/schema-tools": "0.0.0-ad128cc-20251219023808",
95
+ "@tinacms/search": "0.0.0-ad128cc-20251219023808",
96
+ "tinacms": "0.0.0-ad128cc-20251219023808"
99
97
  },
100
98
  "publishConfig": {
101
99
  "registry": "https://registry.npmjs.org"