@tinacms/cli 0.0.0-9ffcade-20251202022528 → 0.0.0-a23fec8-20251217045135

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
@@ -1,15 +1,8 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
1
  // src/index.ts
9
2
  import { Cli, Builtins } from "clipanion";
10
3
 
11
4
  // package.json
12
- var version = "2.0.0";
5
+ var version = "2.0.3";
13
6
 
14
7
  // src/next/commands/dev-command/index.ts
15
8
  import path8 from "path";
@@ -35,15 +28,15 @@ function isUnicodeSupported() {
35
28
  }
36
29
 
37
30
  // src/logger/index.ts
38
- import log4js from "log4js";
39
- var logger = log4js.getLogger();
40
- log4js.configure({
41
- appenders: {
42
- out: { type: "stdout", layout: { type: "messagePassThrough" } }
43
- },
44
- categories: { default: { appenders: ["out"], level: "info" } }
45
- });
46
- 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
+ };
47
40
  function ansiRegex() {
48
41
  const pattern = [
49
42
  "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
@@ -1122,20 +1115,12 @@ var ConfigManager = class {
1122
1115
  this.generatedFolderPath,
1123
1116
  "config.prebuild.jsx"
1124
1117
  );
1125
- const nativeNodeModulesPlugin = {
1126
- name: "native-node-modules",
1127
- setup(build3) {
1128
- build3.onResolve({ filter: /^node:.*/ }, (args) => {
1129
- return {
1130
- path: args.path,
1131
- external: true
1132
- };
1133
- });
1134
- }
1135
- };
1136
1118
  const outfile = path3.join(tmpdir, "config.build.jsx");
1137
1119
  const outfile2 = path3.join(tmpdir, "config.build.mjs");
1138
1120
  const tempTSConfigFile = path3.join(tmpdir, "tsconfig.json");
1121
+ const esmRequireBanner = {
1122
+ js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
1123
+ };
1139
1124
  fs2.outputFileSync(tempTSConfigFile, "{}");
1140
1125
  const result2 = await esbuild.build({
1141
1126
  entryPoints: [configFilePath],
@@ -1165,12 +1150,12 @@ var ConfigManager = class {
1165
1150
  platform: "node",
1166
1151
  format: "esm",
1167
1152
  outfile,
1168
- loader: loaders
1153
+ loader: loaders,
1154
+ banner: esmRequireBanner
1169
1155
  });
1170
1156
  await esbuild.build({
1171
1157
  entryPoints: [outfile],
1172
1158
  bundle: true,
1173
- // Suppress warning about comparison with -0 from client module
1174
1159
  logLevel: "silent",
1175
1160
  platform: "node",
1176
1161
  target: ["esnext"],
@@ -2194,34 +2179,83 @@ var createSearchIndexRouter = ({
2194
2179
  searchIndex
2195
2180
  }) => {
2196
2181
  const put = async (req, res) => {
2197
- const { docs } = req.body;
2182
+ const docs = req.body?.docs ?? [];
2198
2183
  const result = await searchIndex.PUT(docs);
2199
2184
  res.writeHead(200, { "Content-Type": "application/json" });
2200
2185
  res.end(JSON.stringify({ result }));
2201
2186
  };
2202
2187
  const get = async (req, res) => {
2203
- const requestURL = new URL(req.url, config2.apiURL);
2188
+ const requestURL = new URL(req.url ?? "", config2.apiURL);
2204
2189
  const query = requestURL.searchParams.get("q");
2205
2190
  const optionsParam = requestURL.searchParams.get("options");
2206
- let options = {
2191
+ const fuzzyParam = requestURL.searchParams.get("fuzzy");
2192
+ const fuzzyOptionsParam = requestURL.searchParams.get("fuzzyOptions");
2193
+ let searchIndexOptions = {
2207
2194
  DOCUMENTS: false
2208
2195
  };
2209
2196
  if (optionsParam) {
2210
- options = {
2211
- ...options,
2197
+ searchIndexOptions = {
2198
+ ...searchIndexOptions,
2212
2199
  ...JSON.parse(optionsParam)
2213
2200
  };
2214
2201
  }
2215
2202
  res.writeHead(200, { "Content-Type": "application/json" });
2216
2203
  if (query) {
2217
- 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);
2218
2252
  res.end(JSON.stringify(result));
2219
2253
  } else {
2220
2254
  res.end(JSON.stringify({ RESULT: [] }));
2221
2255
  }
2222
2256
  };
2223
2257
  const del = async (req, res) => {
2224
- const requestURL = new URL(req.url, config2.apiURL);
2258
+ const requestURL = new URL(req.url ?? "", config2.apiURL);
2225
2259
  const docId = requestURL.pathname.split("/").filter(Boolean).slice(1).join("/");
2226
2260
  const result = await searchIndex.DELETE(docId);
2227
2261
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -2592,10 +2626,14 @@ ${dangerText(e.message)}
2592
2626
  configManager.config.search && searchIndexer
2593
2627
  );
2594
2628
  }
2629
+ const searchIndexWithFuzzy = searchIndexClient.searchIndex;
2630
+ if (searchIndexClient.fuzzySearchWrapper) {
2631
+ searchIndexWithFuzzy.fuzzySearchWrapper = searchIndexClient.fuzzySearchWrapper;
2632
+ }
2595
2633
  const server = await createDevServer(
2596
2634
  configManager,
2597
2635
  database,
2598
- searchIndexClient.searchIndex,
2636
+ searchIndexWithFuzzy,
2599
2637
  apiURL,
2600
2638
  this.noWatch,
2601
2639
  dbLock
@@ -5079,7 +5117,7 @@ var generateAllTemplates = async ({
5079
5117
  });
5080
5118
  templateMap.set(tem, { fields, templateObj });
5081
5119
  } catch (e) {
5082
- logger.log(`Error parsing template frontmatter template', tem + '.yml'`);
5120
+ logger.warn(`Error parsing template frontmatter template, ${tem}.yml`);
5083
5121
  console.error(e);
5084
5122
  templateMap.set(tem, { fields: [], templateObj: {} });
5085
5123
  }
@@ -5123,7 +5161,7 @@ var generateCollectionFromForestrySection = (args) => {
5123
5161
  }
5124
5162
  if (section.type === "directory") {
5125
5163
  if (!section?.path || section.path === "/" || section.path === "./" || section.path === ".") {
5126
- logger.log(
5164
+ logger.warn(
5127
5165
  warnText(
5128
5166
  `Warning: Section ${section.label} is using a Root Path. Currently, Tina Does not support Root paths see ${linkText(
5129
5167
  "https://github.com/tinacms/tinacms/issues/3768"
@@ -5260,7 +5298,7 @@ var generateCollectionFromForestrySection = (args) => {
5260
5298
  fields
5261
5299
  };
5262
5300
  } else {
5263
- logger.log(
5301
+ logger.warn(
5264
5302
  warnText(
5265
5303
  `Error: document section has an unsupported file extension: ${extname} in ${section.path}`
5266
5304
  )
@@ -6127,6 +6165,7 @@ var addSelfHostedTinaAuthToConfig = async (config2, configFile) => {
6127
6165
  };
6128
6166
 
6129
6167
  // src/cmds/init/apply.ts
6168
+ import { exec } from "child_process";
6130
6169
  async function apply({
6131
6170
  env,
6132
6171
  params,
@@ -6534,9 +6573,7 @@ ${titleText(" TinaCMS ")} has been initialized!`));
6534
6573
  );
6535
6574
  if (framework.name === "hugo") {
6536
6575
  logger.info(
6537
- focusText("Hugo is required. "),
6538
- "Don't have Hugo installed? Follow this guide to set it up: ",
6539
- 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/")
6540
6577
  );
6541
6578
  }
6542
6579
  logger.info(
@@ -6613,7 +6650,6 @@ var addReactiveFile = {
6613
6650
  }
6614
6651
  };
6615
6652
  function execShellCommand(cmd) {
6616
- const exec = __require("child_process").exec;
6617
6653
  return new Promise((resolve2, reject) => {
6618
6654
  exec(cmd, (error, stdout, stderr) => {
6619
6655
  if (error) {
@@ -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-9ffcade-20251202022528",
4
+ "version": "0.0.0-a23fec8-20251217045135",
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-9ffcade-20251202022528",
94
- "@tinacms/metrics": "2.0.0",
95
- "@tinacms/graphql": "2.0.0",
96
- "@tinacms/schema-tools": "2.0.0",
97
- "@tinacms/search": "1.1.4",
98
- "tinacms": "0.0.0-9ffcade-20251202022528"
91
+ "@tinacms/app": "0.0.0-a23fec8-20251217045135",
92
+ "@tinacms/graphql": "0.0.0-a23fec8-20251217045135",
93
+ "@tinacms/metrics": "2.0.1",
94
+ "@tinacms/schema-tools": "0.0.0-a23fec8-20251217045135",
95
+ "tinacms": "0.0.0-a23fec8-20251217045135",
96
+ "@tinacms/search": "0.0.0-a23fec8-20251217045135"
99
97
  },
100
98
  "publishConfig": {
101
99
  "registry": "https://registry.npmjs.org"