mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
chore(deps): Bump prettier from 3.0.3 to 3.1.0 (#7658)
* chore(deps): Bump prettier from 3.0.3 to 3.1.0 Bumps [prettier](https://github.com/prettier/prettier) from 3.0.3 to 3.1.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.0.3...3.1.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore: format --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Beka Westberg <bwestberg@google.com>
This commit is contained in:
@@ -810,8 +810,8 @@ export abstract class Field<T = any>
|
|||||||
margin !== undefined
|
margin !== undefined
|
||||||
? margin
|
? margin
|
||||||
: !this.isFullBlockField()
|
: !this.isFullBlockField()
|
||||||
? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING
|
? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING
|
||||||
: 0;
|
: 0;
|
||||||
let totalWidth = xOffset * 2;
|
let totalWidth = xOffset * 2;
|
||||||
let totalHeight = constants!.FIELD_TEXT_HEIGHT;
|
let totalHeight = constants!.FIELD_TEXT_HEIGHT;
|
||||||
|
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -45,7 +45,7 @@
|
|||||||
"markdown-tables-to-json": "^0.1.7",
|
"markdown-tables-to-json": "^0.1.7",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"patch-package": "^8.0.0",
|
"patch-package": "^8.0.0",
|
||||||
"prettier": "3.0.3",
|
"prettier": "3.1.0",
|
||||||
"readline-sync": "^1.4.10",
|
"readline-sync": "^1.4.10",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2",
|
||||||
@@ -8917,9 +8917,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "3.0.3",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz",
|
||||||
"integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
|
"integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
"markdown-tables-to-json": "^0.1.7",
|
"markdown-tables-to-json": "^0.1.7",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"patch-package": "^8.0.0",
|
"patch-package": "^8.0.0",
|
||||||
"prettier": "3.0.3",
|
"prettier": "3.1.0",
|
||||||
"readline-sync": "^1.4.10",
|
"readline-sync": "^1.4.10",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const filenames = process.argv.slice(2); // Trim off node and script name.
|
const filenames = process.argv.slice(2); // Trim off node and script name.
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Load deps files via require (since they're executalbe .js files).
|
// Load deps files via require (since they're executalbe .js files).
|
||||||
@@ -40,7 +40,7 @@ globalThis.goog = {};
|
|||||||
* to {'module': 'goog'} for backwards-compatibility. Valid properties
|
* to {'module': 'goog'} for backwards-compatibility. Valid properties
|
||||||
* and values include {'module': 'goog'} and {'lang': 'es6'}.
|
* and values include {'module': 'goog'} and {'lang': 'es6'}.
|
||||||
*/
|
*/
|
||||||
goog.addDependency = function(relPath, provides, _requires, opt_loadFlags) {
|
goog.addDependency = function (relPath, provides, _requires, opt_loadFlags) {
|
||||||
// Ignore any non-ESM files, as they can't be imported.
|
// Ignore any non-ESM files, as they can't be imported.
|
||||||
if (opt_loadFlags?.module !== 'es6') return;
|
if (opt_loadFlags?.module !== 'es6') return;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ require(path.resolve(__dirname, '../../build/deps.js'));
|
|||||||
|
|
||||||
/** RegExp matching goog.require statements. */
|
/** RegExp matching goog.require statements. */
|
||||||
const requireRE =
|
const requireRE =
|
||||||
/(?:const\s+(?:([$\w]+)|(\{[^}]*\}))\s+=\s+)?goog.require(Type)?\('([^']+)'\);/mg;
|
/(?:const\s+(?:([$\w]+)|(\{[^}]*\}))\s+=\s+)?goog.require(Type)?\('([^']+)'\);/gm;
|
||||||
|
|
||||||
/** RegExp matching key: value pairs in destructuring assignments. */
|
/** RegExp matching key: value pairs in destructuring assignments. */
|
||||||
const keyValueRE = /([$\w]+)\s*:\s*([$\w]+)\s*(?=,|})/g;
|
const keyValueRE = /([$\w]+)\s*:\s*([$\w]+)\s*(?=,|})/g;
|
||||||
@@ -80,72 +80,82 @@ for (const filename of filenames) {
|
|||||||
contents = contents.replace(/^\s*["']use strict["']\s*; *\n/m, '');
|
contents = contents.replace(/^\s*["']use strict["']\s*; *\n/m, '');
|
||||||
|
|
||||||
// Migrate from goog.module to goog.declareModuleId.
|
// Migrate from goog.module to goog.declareModuleId.
|
||||||
const closurePathRelative =
|
const closurePathRelative = path.relative(
|
||||||
path.relative(path.dirname(path.resolve(filename)), closurePath);
|
path.dirname(path.resolve(filename)),
|
||||||
|
closurePath,
|
||||||
|
);
|
||||||
contents = contents.replace(
|
contents = contents.replace(
|
||||||
/^goog.module\('([$\w.]+)'\);$/m,
|
/^goog.module\('([$\w.]+)'\);$/m,
|
||||||
`import * as goog from '${closurePathRelative}/goog.js';\n` +
|
`import * as goog from '${closurePathRelative}/goog.js';\n` +
|
||||||
`goog.declareModuleId('$1');`);
|
`goog.declareModuleId('$1');`,
|
||||||
|
);
|
||||||
|
|
||||||
// Migrate from goog.require to import.
|
// Migrate from goog.require to import.
|
||||||
contents = contents.replace(
|
contents = contents.replace(
|
||||||
requireRE,
|
requireRE,
|
||||||
function(
|
function (
|
||||||
orig, // Whole statement to be replaced.
|
orig, // Whole statement to be replaced.
|
||||||
name, // Name of named import of whole module (if applicable).
|
name, // Name of named import of whole module (if applicable).
|
||||||
names, // {}-enclosed list of destructured imports.
|
names, // {}-enclosed list of destructured imports.
|
||||||
type, // If truthy, it is a requireType not require.
|
type, // If truthy, it is a requireType not require.
|
||||||
moduleId, // goog.module ID that was goog.require()d.
|
moduleId, // goog.module ID that was goog.require()d.
|
||||||
) {
|
) {
|
||||||
const importPath = modulePaths[moduleId];
|
const importPath = modulePaths[moduleId];
|
||||||
type = type ? ' type' : '';
|
type = type ? ' type' : '';
|
||||||
if (!importPath) {
|
if (!importPath) {
|
||||||
console.warn(`Unable to migrate goog.require('${
|
console.warn(
|
||||||
moduleId}') as no ES module path known.`);
|
`Unable to migrate goog.require('${moduleId}') as no ES module path known.`,
|
||||||
return orig;
|
);
|
||||||
}
|
return orig;
|
||||||
let relativePath =
|
}
|
||||||
path.relative(path.dirname(path.resolve(filename)), importPath);
|
let relativePath = path.relative(
|
||||||
if (relativePath[0] !== '.') relativePath = './' + relativePath;
|
path.dirname(path.resolve(filename)),
|
||||||
if (name) {
|
importPath,
|
||||||
return `import${type} * as ${name} from '${relativePath}';`;
|
);
|
||||||
} else if (names) {
|
if (relativePath[0] !== '.') relativePath = './' + relativePath;
|
||||||
names = names.replace(keyValueRE, '$1 as $2');
|
if (name) {
|
||||||
return `import${type} ${names} from '${relativePath}';`;
|
return `import${type} * as ${name} from '${relativePath}';`;
|
||||||
} else { // Side-effect only require.
|
} else if (names) {
|
||||||
return `import${type} '${relativePath}';`;
|
names = names.replace(keyValueRE, '$1 as $2');
|
||||||
}
|
return `import${type} ${names} from '${relativePath}';`;
|
||||||
});
|
} else {
|
||||||
|
// Side-effect only require.
|
||||||
|
return `import${type} '${relativePath}';`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Find and update or remove old-style export assignemnts.
|
// Find and update or remove old-style export assignemnts.
|
||||||
/** @type {!Array<{name: string, re: RegExp>}>} */
|
/** @type {!Array<{name: string, re: RegExp>}>} */
|
||||||
const easyExports = [];
|
const easyExports = [];
|
||||||
contents = contents.replace(
|
contents = contents.replace(
|
||||||
/^\s*exports\.([$\w]+)\s*=\s*([$\w]+)\s*;\n/gm,
|
/^\s*exports\.([$\w]+)\s*=\s*([$\w]+)\s*;\n/gm,
|
||||||
function(
|
function (
|
||||||
orig, // Whole statement to be replaced.
|
orig, // Whole statement to be replaced.
|
||||||
exportName, // Name to export item as.
|
exportName, // Name to export item as.
|
||||||
declName, // Already-declared name for item being exported.
|
declName, // Already-declared name for item being exported.
|
||||||
) {
|
) {
|
||||||
// Renamed exports have to be transalted as-is.
|
// Renamed exports have to be transalted as-is.
|
||||||
if (exportName !== declName) {
|
if (exportName !== declName) {
|
||||||
return `export {${declName} as ${exportName}};\n`;
|
return `export {${declName} as ${exportName}};\n`;
|
||||||
}
|
}
|
||||||
// OK, we're doing "export.foo = foo;". Can we update the
|
// OK, we're doing "export.foo = foo;". Can we update the
|
||||||
// declaration? We can't actualy modify it yet as we're in
|
// declaration? We can't actualy modify it yet as we're in
|
||||||
// the middle of a search-and-replace on contents already, but
|
// the middle of a search-and-replace on contents already, but
|
||||||
// we can delete the old export and later update the
|
// we can delete the old export and later update the
|
||||||
// declaration into an export.
|
// declaration into an export.
|
||||||
const declRE = new RegExp(
|
const declRE = new RegExp(
|
||||||
`^(\\s*)((?:const|let|var|function|class)\\s+${declName})\\b`,
|
`^(\\s*)((?:const|let|var|function|class)\\s+${declName})\\b`,
|
||||||
'gm');
|
'gm',
|
||||||
if (contents.match(declRE)) {
|
);
|
||||||
easyExports.push({exportName, declRE});
|
if (contents.match(declRE)) {
|
||||||
return ''; // Delete existing export assignment.
|
easyExports.push({exportName, declRE});
|
||||||
} else {
|
return ''; // Delete existing export assignment.
|
||||||
return `export ${exportName};\n`; // Safe fallback.
|
} else {
|
||||||
}
|
return `export ${exportName};\n`; // Safe fallback.
|
||||||
});
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
// Add 'export' to existing declarations where appropriate.
|
// Add 'export' to existing declarations where appropriate.
|
||||||
for (const {exportName, declRE} of easyExports) {
|
for (const {exportName, declRE} of easyExports) {
|
||||||
contents = contents.replace(declRE, '$1export $2');
|
contents = contents.replace(declRE, '$1export $2');
|
||||||
|
|||||||
Reference in New Issue
Block a user