@ember-tooling/blueprint-model 0.4.1 → 0.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-tooling/blueprint-model",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ember-cli/ember-cli.git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "chalk": "^4.1.2",
11
+ "chalk": "^5.6.2",
12
12
  "diff": "^7.0.0",
13
13
  "isbinaryfile": "^5.0.4",
14
14
  "lodash": "^4.17.21",
@@ -2,7 +2,7 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const util = require('util');
5
- const jsdiff = require('diff');
5
+ const { applyPatch, createPatch } = require('diff');
6
6
  const quickTemp = require('quick-temp');
7
7
  const path = require('path');
8
8
  const SilentError = require('silent-error');
@@ -38,7 +38,7 @@ class EditFileDiff {
38
38
  diffString: readFile(resultHash.diffPath),
39
39
  currentString: readFile(resultHash.outputPath),
40
40
  }).then((result) => {
41
- let appliedDiff = jsdiff.applyPatch(result.currentString.toString(), result.diffString.toString());
41
+ let appliedDiff = applyPatch(result.currentString.toString(), result.diffString.toString());
42
42
 
43
43
  if (!appliedDiff) {
44
44
  let message = 'Patch was not cleanly applied.';
@@ -52,7 +52,7 @@ class EditFileDiff {
52
52
 
53
53
  invokeEditor(result) {
54
54
  let info = this.info;
55
- let diff = jsdiff.createPatch(info.outputPath, result.output.toString(), result.input);
55
+ let diff = createPatch(info.outputPath, result.output.toString(), result.input);
56
56
  let diffPath = path.join(this.tmpDifferenceDir, 'currentDiff.diff');
57
57
 
58
58
  return writeFile(diffPath, diff)
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const chalk = require('chalk');
3
+ const { default: chalk } = require('chalk');
4
4
 
5
5
  /*
6
6
  If you're here to remove the VITE experiment flag in favor of it being
@@ -2,11 +2,11 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const util = require('util');
5
- const chalk = require('chalk');
5
+ const { default: chalk } = require('chalk');
6
6
  const EditFileDiff = require('./edit-file-diff');
7
7
  const EOL = require('os').EOL;
8
8
  const rxEOL = new RegExp(EOL, 'g');
9
- const isBinaryFile = require('isbinaryfile').isBinaryFileSync;
9
+ const { isBinaryFileSync } = require('isbinaryfile');
10
10
  const hash = require('promise.hash.helper');
11
11
  const canEdit = require('./open-editor').canEdit;
12
12
  const processTemplate = require('./process-template');
@@ -58,7 +58,7 @@ class FileInfo {
58
58
  /* ignore */
59
59
  }
60
60
 
61
- let canDiff = !isBinaryFile(this.inputPath) && (!outputPathIsFile || !isBinaryFile(this.outputPath));
61
+ let canDiff = !isBinaryFileSync(this.inputPath) && (!outputPathIsFile || !isBinaryFileSync(this.outputPath));
62
62
 
63
63
  if (canDiff) {
64
64
  promptOptions.choices.push({ key: 'd', name: 'Diff', value: 'diff' });
@@ -73,12 +73,12 @@ class FileInfo {
73
73
 
74
74
  displayDiff() {
75
75
  let info = this,
76
- jsdiff = require('diff');
76
+ { createPatch } = require('diff');
77
77
  return hash({
78
78
  input: this.render(),
79
79
  output: readFile(info.outputPath),
80
80
  }).then((result) => {
81
- let diff = jsdiff.createPatch(
81
+ let diff = createPatch(
82
82
  info.outputPath,
83
83
  result.output.toString().replace(rxEOL, '\n'),
84
84
  result.input.replace(rxEOL, '\n')
@@ -106,7 +106,7 @@ class FileInfo {
106
106
 
107
107
  return readFile(path).then((content) =>
108
108
  lstat(path).then((fileStat) => {
109
- if (isBinaryFile(content, fileStat.size)) {
109
+ if (isBinaryFileSync(content, fileStat.size)) {
110
110
  return content;
111
111
  } else {
112
112
  try {