@tinacms/scripts 0.0.0-e6a585d-20250514013816 → 0.0.0-e97cc34-20260505010028

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.
@@ -4,4 +4,4 @@
4
4
 
5
5
  // __mocks__/styleMock.js
6
6
 
7
- module.exports = '';
7
+ export default '';
package/bin/tina-build CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { BuildTina} = require('../dist/index.js')
4
- const tinaBuild = new BuildTina()
5
- tinaBuild.init(process.argv)
3
+ import { BuildTina } from '../dist/index.js';
4
+ const tinaBuild = new BuildTina();
5
+ tinaBuild.init(process.argv);
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+
30
+ export {
31
+ __spreadValues,
32
+ __objRest
33
+ };
package/dist/index.js CHANGED
@@ -1,73 +1,19 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- var __export = (target, all) => {
34
- for (var name in all)
35
- __defProp(target, name, { get: all[name], enumerable: true });
36
- };
37
- var __copyProps = (to, from, except, desc) => {
38
- if (from && typeof from === "object" || typeof from === "function") {
39
- for (let key of __getOwnPropNames(from))
40
- if (!__hasOwnProp.call(to, key) && key !== except)
41
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
42
- }
43
- return to;
44
- };
45
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
46
- // If the importer is in node compatibility mode or this is not an ESM
47
- // file that has been converted to a CommonJS file using a Babel-
48
- // compatible transform (i.e. "__esModule" has not been set), then set
49
- // "default" to the CommonJS "module.exports" for node compatibility.
50
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
51
- mod
52
- ));
53
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ import {
2
+ __objRest,
3
+ __spreadValues
4
+ } from "./chunk-Q2LW34XU.js";
54
5
 
55
6
  // src/index.ts
56
- var index_exports = {};
57
- __export(index_exports, {
58
- BuildTina: () => BuildTina
59
- });
60
- module.exports = __toCommonJS(index_exports);
61
- var fs = __toESM(require("fs"));
62
- var import_node_child_process = require("child_process");
63
- var import_node_path = __toESM(require("path"));
64
- var import_chalk = __toESM(require("chalk"));
65
- var import_chokidar = __toESM(require("chokidar"));
66
- var import_commander = __toESM(require("commander"));
67
- var import_esbuild = require("esbuild");
68
- var import_fs_extra = require("fs-extra");
69
- var import_json_diff = __toESM(require("json-diff"));
70
- var import_vite = require("vite");
7
+ import * as fs from "fs";
8
+ import { exec } from "child_process";
9
+ import path from "path";
10
+ import chalk from "chalk";
11
+ import chokidar from "chokidar";
12
+ import commander from "commander";
13
+ import { build as esbuild } from "esbuild";
14
+ import fsExtra from "fs-extra";
15
+ import jsonDiff from "json-diff";
16
+ import { build } from "vite";
71
17
 
72
18
  // src/utils.ts
73
19
  function deepMerge(target, source) {
@@ -104,9 +50,10 @@ async function sequential(items, callback) {
104
50
  }
105
51
 
106
52
  // src/index.ts
53
+ var { outputFileSync } = fsExtra;
107
54
  var BuildTina = class {
108
55
  constructor(name) {
109
- this.program = new import_commander.default.Command(name);
56
+ this.program = new commander.Command(name);
110
57
  }
111
58
  registerCommands(commands, noHelp = false) {
112
59
  for (const command of commands) {
@@ -148,7 +95,7 @@ Examples:
148
95
  let packageJson = null;
149
96
  try {
150
97
  const packageJsonContent = fs.readFileSync(
151
- import_node_path.default.join(process.cwd(), "package.json")
98
+ path.join(process.cwd(), "package.json")
152
99
  );
153
100
  packageJson = JSON.parse(packageJsonContent.toString());
154
101
  } catch (err) {
@@ -162,7 +109,7 @@ Examples:
162
109
  console.info(`Skipping ${packageJson.name}`);
163
110
  return;
164
111
  }
165
- const successMessage = `${import_chalk.default.blue(`${packageJson.name}`)} built in`;
112
+ const successMessage = `${chalk.blue(`${packageJson.name}`)} built in`;
166
113
  console.time(successMessage);
167
114
  const entries = ((_a = packageJson.buildConfig) == null ? void 0 : _a.entryPoints.map(
168
115
  (ep) => {
@@ -185,7 +132,7 @@ Examples:
185
132
  }
186
133
  watch() {
187
134
  try {
188
- (0, import_node_child_process.exec)("pnpm list -r --json", (error, stdout) => {
135
+ exec("pnpm list -r --json", (error, stdout) => {
189
136
  if (error) {
190
137
  throw error;
191
138
  }
@@ -195,8 +142,8 @@ Examples:
195
142
  const pkgPath = "packages";
196
143
  if (pkg.path.includes(pkgPath)) watchPaths.push(pkg.path);
197
144
  }
198
- import_chokidar.default.watch(
199
- watchPaths.map((p) => import_node_path.default.join(p, "src", "**/*")),
145
+ chokidar.watch(
146
+ watchPaths.map((p) => path.join(p, "src", "**/*")),
200
147
  { ignored: ["**/spec/**/*", "node_modules"] }
201
148
  ).on("change", async (path2) => {
202
149
  const changedPackagePath = watchPaths.find(
@@ -233,7 +180,7 @@ Examples:
233
180
  process.exit(1);
234
181
  }
235
182
  try {
236
- (0, import_node_child_process.exec)(
183
+ exec(
237
184
  "pnpm exec tinacms dev --no-server",
238
185
  { cwd: process.cwd() },
239
186
  (error, stdout, stderr) => {
@@ -266,13 +213,13 @@ Examples:
266
213
  }
267
214
  const _a = tinaLock.schema, { version } = _a, schema = __objRest(_a, ["version"]);
268
215
  const _b = newTinaLock.schema, { version: newVersion } = _b, newSchema = __objRest(_b, ["version"]);
269
- const schemaDiff = import_json_diff.default.diffString(schema, newSchema);
216
+ const schemaDiff = jsonDiff.diffString(schema, newSchema);
270
217
  if (schemaDiff) {
271
218
  console.error("Unexpected change(s) to Tina schema \u274C");
272
219
  console.error(schemaDiff);
273
220
  throw new Error("Unexpected change(s) to Tina schema \u274C");
274
221
  }
275
- const graphqlDiff = import_json_diff.default.diffString(
222
+ const graphqlDiff = jsonDiff.diffString(
276
223
  tinaLock.graphql,
277
224
  newTinaLock.graphql
278
225
  );
@@ -333,10 +280,10 @@ See --help for a list of available commands.`
333
280
  this.program.parse(args);
334
281
  }
335
282
  getOutputPaths(entry) {
336
- const { dir, name } = import_node_path.default.parse(entry);
283
+ const { dir, name } = path.parse(entry);
337
284
  const outdir = dir.replace("src", "dist");
338
285
  const outfile = name;
339
- const relativeOutfile = import_node_path.default.join(
286
+ const relativeOutfile = path.join(
340
287
  outdir.split("/").map(() => "..").join("/"),
341
288
  dir,
342
289
  name
@@ -346,7 +293,7 @@ See --help for a list of available commands.`
346
293
  async buildPackage(entryPoint, packageJSON) {
347
294
  const entry = entryPoint.name;
348
295
  const target = entryPoint.target;
349
- const extension = import_node_path.default.extname(entry);
296
+ const extension = path.extname(entry);
350
297
  const deps = packageJSON.dependencies;
351
298
  const peerDeps = packageJSON.peerDependencies;
352
299
  const external = Object.keys(__spreadValues(__spreadValues({}, deps), peerDeps));
@@ -357,14 +304,16 @@ See --help for a list of available commands.`
357
304
  return;
358
305
  }
359
306
  external.forEach((ext) => globals[ext] = "NOOP");
307
+ const isExternal = (id) => external.some((dep) => id === dep || id.startsWith(`${dep}/`));
360
308
  if (target === "node") {
361
309
  if (["@tinacms/graphql", "@tinacms/datalayer"].includes(packageJSON.name)) {
362
- await (0, import_esbuild.build)({
363
- entryPoints: [import_node_path.default.join(process.cwd(), entry)],
310
+ await esbuild({
311
+ entryPoints: [path.join(process.cwd(), entry)],
364
312
  bundle: true,
365
313
  platform: "node",
366
- target: "node20",
367
- outfile: import_node_path.default.join(
314
+ target: "esnext",
315
+ format: "esm",
316
+ outfile: path.join(
368
317
  process.cwd(),
369
318
  "dist",
370
319
  `${outInfo.outfile ? outInfo.outfile : "index"}.js`
@@ -375,66 +324,55 @@ See --help for a list of available commands.`
375
324
  return !entryPoint2.bundle.includes(item);
376
325
  })
377
326
  });
378
- await (0, import_esbuild.build)({
379
- entryPoints: [import_node_path.default.join(process.cwd(), entry)],
327
+ await esbuild({
328
+ entryPoints: [path.join(process.cwd(), entry)],
380
329
  bundle: true,
381
330
  platform: "node",
382
- target: "es2020",
331
+ target: "esnext",
383
332
  format: "esm",
384
- outfile: import_node_path.default.join(
333
+ outfile: path.join(
385
334
  process.cwd(),
386
335
  "dist",
387
- `${outInfo.outfile ? outInfo.outfile : "index"}.mjs`
336
+ `${outInfo.outfile ? outInfo.outfile : "index"}.js`
388
337
  ),
389
338
  external
390
339
  });
391
340
  } else if (["@tinacms/mdx"].includes(packageJSON.name)) {
392
341
  const peerDeps2 = packageJSON.peerDependencies;
393
- await (0, import_esbuild.build)({
394
- entryPoints: [import_node_path.default.join(process.cwd(), entry)],
395
- bundle: true,
396
- platform: "node",
397
- target: "node20",
398
- format: "cjs",
399
- outfile: import_node_path.default.join(process.cwd(), "dist", "index.js"),
400
- external: Object.keys(__spreadValues({}, peerDeps2))
401
- });
402
- await (0, import_esbuild.build)({
403
- entryPoints: [import_node_path.default.join(process.cwd(), entry)],
342
+ await esbuild({
343
+ entryPoints: [path.join(process.cwd(), entry)],
404
344
  bundle: true,
405
345
  platform: "node",
406
- target: "es2020",
346
+ target: "esnext",
407
347
  format: "esm",
408
- outfile: import_node_path.default.join(process.cwd(), "dist", "index.mjs"),
409
- // Bundle dependencies, the remark ecosystem only publishes ES modules
410
- // and includes "development" export maps which actually throw errors during
411
- // development, which we don't want to expose our users to.
348
+ outfile: path.join(process.cwd(), "dist", "index.js"),
412
349
  external: Object.keys(__spreadValues({}, peerDeps2))
413
350
  });
414
- await (0, import_esbuild.build)({
415
- entryPoints: [import_node_path.default.join(process.cwd(), entry)],
351
+ await esbuild({
352
+ entryPoints: [path.join(process.cwd(), entry)],
416
353
  bundle: true,
417
354
  platform: "browser",
418
- target: "es2020",
355
+ target: "esnext",
419
356
  format: "esm",
420
- outfile: import_node_path.default.join(process.cwd(), "dist", "index.browser.mjs"),
357
+ outfile: path.join(process.cwd(), "dist", "index.browser.js"),
421
358
  // Bundle dependencies, the remark ecosystem only publishes ES modules
422
359
  // and includes "development" export maps which actually throw errors during
423
360
  // development, which we don't want to expose our users to.
424
361
  external: Object.keys(__spreadValues({}, peerDeps2))
425
362
  });
426
363
  } else {
427
- await (0, import_esbuild.build)({
428
- entryPoints: [import_node_path.default.join(process.cwd(), entry)],
364
+ await esbuild({
365
+ entryPoints: [path.join(process.cwd(), entry)],
429
366
  bundle: true,
430
367
  platform: "node",
431
- target: "node20",
432
- outfile: import_node_path.default.join(process.cwd(), "dist", `${outInfo.outfile}.js`),
368
+ target: "esnext",
369
+ format: "esm",
370
+ outfile: path.join(process.cwd(), "dist", `${outInfo.outfile}.js`),
433
371
  external
434
372
  });
435
373
  }
436
374
  fs.writeFileSync(
437
- import_node_path.default.join(
375
+ path.join(
438
376
  process.cwd(),
439
377
  "dist",
440
378
  entry.replace("src/", "").replace(extension, ".d.ts")
@@ -446,27 +384,27 @@ See --help for a list of available commands.`
446
384
  const defaultBuildConfig = {
447
385
  resolve: {
448
386
  alias: {
449
- "@toolkit": import_node_path.default.resolve(process.cwd(), "src/toolkit"),
450
- "@tinacms/toolkit": import_node_path.default.resolve(
387
+ "@toolkit": path.resolve(process.cwd(), "src/toolkit"),
388
+ "@tinacms/toolkit": path.resolve(
451
389
  process.cwd(),
452
390
  "src/toolkit/index.ts"
453
- )
391
+ ),
392
+ "@utils": path.resolve(process.cwd(), "src/utils")
454
393
  }
455
394
  },
456
395
  build: {
457
396
  minify: false,
458
397
  assetsInlineLimit: 0,
459
398
  lib: {
460
- entry: import_node_path.default.resolve(process.cwd(), entry),
399
+ entry: path.resolve(process.cwd(), entry),
461
400
  name: packageJSON.name,
462
- fileName: (format) => {
463
- return format === "umd" ? `${outInfo.outfile}.js` : `${outInfo.outfile}.mjs`;
464
- }
401
+ formats: ["es"],
402
+ fileName: () => `${outInfo.outfile}.js`
465
403
  },
466
404
  outDir: outInfo.outdir,
467
405
  emptyOutDir: false,
468
406
  // We build multiple files in to the dir.
469
- sourcemap: true,
407
+ sourcemap: false,
470
408
  rollupOptions: {
471
409
  onwarn(warning, warn) {
472
410
  if (warning.code === "MODULE_LEVEL_DIRECTIVE") {
@@ -480,7 +418,7 @@ See --help for a list of available commands.`
480
418
  * I'm pretty sure it doesn't, since everything works
481
419
  *
482
420
  * By setting a global for each external dep we're silencing these warnings
483
- * No name was provided for external module 'react-beautiful-dnd' in output.globals – guessing 'reactBeautifulDnd'
421
+ * No name was provided for external module in output.globals
484
422
  *
485
423
  * They don't occur for es builds, only UMD and I can't quite find
486
424
  * an authoritative response on wny they're needed or how they're
@@ -492,20 +430,19 @@ See --help for a list of available commands.`
492
430
  output: {
493
431
  globals
494
432
  },
495
- external
433
+ external: isExternal
496
434
  }
497
435
  }
498
436
  };
499
437
  const buildConfig = packageJSON.buildConfig ? deepMerge(defaultBuildConfig, packageJSON.buildConfig) : defaultBuildConfig;
500
- await (0, import_vite.build)(__spreadValues({}, buildConfig));
501
- (0, import_fs_extra.outputFileSync)(
502
- import_node_path.default.join(outInfo.outdir, `${outInfo.outfile}.d.ts`),
438
+ await build(__spreadValues({}, buildConfig));
439
+ outputFileSync(
440
+ path.join(outInfo.outdir, `${outInfo.outfile}.d.ts`),
503
441
  `export * from "${outInfo.relativeOutfile}"`
504
442
  );
505
443
  return true;
506
444
  }
507
445
  };
508
- // Annotate the CommonJS export names for ESM import in node:
509
- 0 && (module.exports = {
446
+ export {
510
447
  BuildTina
511
- });
448
+ };
@@ -1,55 +1,18 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ import "./chunk-Q2LW34XU.js";
28
2
 
29
3
  // src/jest-runner.ts
30
- var jest_runner_exports = {};
31
- __export(jest_runner_exports, {
32
- default: () => jest_runner_default
33
- });
34
- module.exports = __toCommonJS(jest_runner_exports);
35
- var import_jest_plugin = __toESM(require("@sucrase/jest-plugin"));
36
4
  var config = {
37
5
  verbose: true,
38
6
  transform: {
39
- ".(ts|tsx)": "@tinacms/scripts/dist/jest-runner.js",
40
- ".(js)": "@tinacms/scripts/dist/jest-runner.js"
7
+ "^.+\\.[tj]sx?$": "babel-jest"
41
8
  },
42
- transformIgnorePatterns: [],
43
- testRegex: "(\\.spec|.test)\\.(ts|tsx|js)$",
44
- modulePaths: ["<rootDir>/dir/", "<rootDir>/node_modules/"],
45
- moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
46
9
  testPathIgnorePatterns: ["/dist/"],
47
10
  moduleNameMapper: {
48
11
  "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/../../__mocks__/fileMock.js",
49
12
  "\\.(css|less|scss|sass)$": "@tinacms/scripts/__mocks__/styleMock.js"
50
13
  }
51
14
  };
52
- var jest_runner_default = {
53
- process: import_jest_plugin.default.process,
54
- config
15
+ var jest_runner_default = config;
16
+ export {
17
+ jest_runner_default as default
55
18
  };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/scripts",
3
- "version": "0.0.0-e6a585d-20250514013816",
3
+ "type": "module",
4
+ "version": "0.0.0-e97cc34-20260505010028",
4
5
  "main": "dist/index.js",
5
6
  "files": [
6
7
  "dist",
@@ -13,8 +14,7 @@
13
14
  "tinacms-scripts": "./bin/tina-build"
14
15
  },
15
16
  "dependencies": {
16
- "@sucrase/jest-plugin": "^3.0.0",
17
- "chalk": "^4.1.2",
17
+ "chalk": "^5.4.1",
18
18
  "chokidar": "^3.6.0",
19
19
  "commander": "^7.2.0",
20
20
  "esbuild": "^0.24.2",
@@ -26,11 +26,16 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/fs-extra": "^11.0.4",
29
- "@types/json-diff": "^1.0.3"
29
+ "@types/json-diff": "^1.0.3",
30
+ "jest": "^30.1.3"
31
+ },
32
+ "repository": {
33
+ "url": "https://github.com/tinacms/tinacms.git",
34
+ "directory": "packages/@tinacms/scripts"
30
35
  },
31
36
  "scripts": {
32
37
  "build:all": "bin/tina-build build:all",
33
38
  "watch": "node bin/tina-build watch",
34
- "build": "pnpm tsup src/jest-runner.ts src/css-transform.ts src/index.ts --format cjs"
39
+ "build": "pnpm tsup src/jest-runner.ts src/index.ts --format esm"
35
40
  }
36
41
  }