Skip to content

Commit 80be8bc

Browse files
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](prettier/prettier@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>
1 parent b6a7ffb commit 80be8bc

4 files changed

Lines changed: 77 additions & 67 deletions

File tree

core/field.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,8 @@ export abstract class Field<T = any>
810810
margin !== undefined
811811
? margin
812812
: !this.isFullBlockField()
813-
? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING
814-
: 0;
813+
? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING
814+
: 0;
815815
let totalWidth = xOffset * 2;
816816
let totalHeight = constants!.FIELD_TEXT_HEIGHT;
817817

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"markdown-tables-to-json": "^0.1.7",
9898
"mocha": "^10.0.0",
9999
"patch-package": "^8.0.0",
100-
"prettier": "3.0.3",
100+
"prettier": "3.1.0",
101101
"readline-sync": "^1.4.10",
102102
"rimraf": "^5.0.0",
103103
"typescript": "^5.0.2",

scripts/migration/js2ts

Lines changed: 70 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const fs = require('fs');
44
const path = require('path');
55

6-
const filenames = process.argv.slice(2); // Trim off node and script name.
6+
const filenames = process.argv.slice(2); // Trim off node and script name.
77

88
//////////////////////////////////////////////////////////////////////
99
// Load deps files via require (since they're executalbe .js files).
@@ -40,7 +40,7 @@ globalThis.goog = {};
4040
* to {'module': 'goog'} for backwards-compatibility. Valid properties
4141
* and values include {'module': 'goog'} and {'lang': 'es6'}.
4242
*/
43-
goog.addDependency = function(relPath, provides, _requires, opt_loadFlags) {
43+
goog.addDependency = function (relPath, provides, _requires, opt_loadFlags) {
4444
// Ignore any non-ESM files, as they can't be imported.
4545
if (opt_loadFlags?.module !== 'es6') return;
4646

@@ -61,7 +61,7 @@ require(path.resolve(__dirname, '../../build/deps.js'));
6161

6262
/** RegExp matching goog.require statements. */
6363
const requireRE =
64-
/(?:const\s+(?:([$\w]+)|(\{[^}]*\}))\s+=\s+)?goog.require(Type)?\('([^']+)'\);/mg;
64+
/(?:const\s+(?:([$\w]+)|(\{[^}]*\}))\s+=\s+)?goog.require(Type)?\('([^']+)'\);/gm;
6565

6666
/** RegExp matching key: value pairs in destructuring assignments. */
6767
const keyValueRE = /([$\w]+)\s*:\s*([$\w]+)\s*(?=,|})/g;
@@ -80,72 +80,82 @@ for (const filename of filenames) {
8080
contents = contents.replace(/^\s*["']use strict["']\s*; *\n/m, '');
8181

8282
// Migrate from goog.module to goog.declareModuleId.
83-
const closurePathRelative =
84-
path.relative(path.dirname(path.resolve(filename)), closurePath);
83+
const closurePathRelative = path.relative(
84+
path.dirname(path.resolve(filename)),
85+
closurePath,
86+
);
8587
contents = contents.replace(
86-
/^goog.module\('([$\w.]+)'\);$/m,
87-
`import * as goog from '${closurePathRelative}/goog.js';\n` +
88-
`goog.declareModuleId('$1');`);
88+
/^goog.module\('([$\w.]+)'\);$/m,
89+
`import * as goog from '${closurePathRelative}/goog.js';\n` +
90+
`goog.declareModuleId('$1');`,
91+
);
8992

9093
// Migrate from goog.require to import.
9194
contents = contents.replace(
92-
requireRE,
93-
function(
94-
orig, // Whole statement to be replaced.
95-
name, // Name of named import of whole module (if applicable).
96-
names, // {}-enclosed list of destructured imports.
97-
type, // If truthy, it is a requireType not require.
98-
moduleId, // goog.module ID that was goog.require()d.
99-
) {
100-
const importPath = modulePaths[moduleId];
101-
type = type ? ' type' : '';
102-
if (!importPath) {
103-
console.warn(`Unable to migrate goog.require('${
104-
moduleId}') as no ES module path known.`);
105-
return orig;
106-
}
107-
let relativePath =
108-
path.relative(path.dirname(path.resolve(filename)), importPath);
109-
if (relativePath[0] !== '.') relativePath = './' + relativePath;
110-
if (name) {
111-
return `import${type} * as ${name} from '${relativePath}';`;
112-
} else if (names) {
113-
names = names.replace(keyValueRE, '$1 as $2');
114-
return `import${type} ${names} from '${relativePath}';`;
115-
} else { // Side-effect only require.
116-
return `import${type} '${relativePath}';`;
117-
}
118-
});
95+
requireRE,
96+
function (
97+
orig, // Whole statement to be replaced.
98+
name, // Name of named import of whole module (if applicable).
99+
names, // {}-enclosed list of destructured imports.
100+
type, // If truthy, it is a requireType not require.
101+
moduleId, // goog.module ID that was goog.require()d.
102+
) {
103+
const importPath = modulePaths[moduleId];
104+
type = type ? ' type' : '';
105+
if (!importPath) {
106+
console.warn(
107+
`Unable to migrate goog.require('${moduleId}') as no ES module path known.`,
108+
);
109+
return orig;
110+
}
111+
let relativePath = path.relative(
112+
path.dirname(path.resolve(filename)),
113+
importPath,
114+
);
115+
if (relativePath[0] !== '.') relativePath = './' + relativePath;
116+
if (name) {
117+
return `import${type} * as ${name} from '${relativePath}';`;
118+
} else if (names) {
119+
names = names.replace(keyValueRE, '$1 as $2');
120+
return `import${type} ${names} from '${relativePath}';`;
121+
} else {
122+
// Side-effect only require.
123+
return `import${type} '${relativePath}';`;
124+
}
125+
},
126+
);
119127

120128
// Find and update or remove old-style export assignemnts.
121129
/** @type {!Array<{name: string, re: RegExp>}>} */
122130
const easyExports = [];
123131
contents = contents.replace(
124-
/^\s*exports\.([$\w]+)\s*=\s*([$\w]+)\s*;\n/gm,
125-
function(
126-
orig, // Whole statement to be replaced.
127-
exportName, // Name to export item as.
128-
declName, // Already-declared name for item being exported.
129-
) {
130-
// Renamed exports have to be transalted as-is.
131-
if (exportName !== declName) {
132-
return `export {${declName} as ${exportName}};\n`;
133-
}
134-
// OK, we're doing "export.foo = foo;". Can we update the
135-
// declaration? We can't actualy modify it yet as we're in
136-
// the middle of a search-and-replace on contents already, but
137-
// we can delete the old export and later update the
138-
// declaration into an export.
139-
const declRE = new RegExp(
140-
`^(\\s*)((?:const|let|var|function|class)\\s+${declName})\\b`,
141-
'gm');
142-
if (contents.match(declRE)) {
143-
easyExports.push({exportName, declRE});
144-
return ''; // Delete existing export assignment.
145-
} else {
146-
return `export ${exportName};\n`; // Safe fallback.
147-
}
148-
});
132+
/^\s*exports\.([$\w]+)\s*=\s*([$\w]+)\s*;\n/gm,
133+
function (
134+
orig, // Whole statement to be replaced.
135+
exportName, // Name to export item as.
136+
declName, // Already-declared name for item being exported.
137+
) {
138+
// Renamed exports have to be transalted as-is.
139+
if (exportName !== declName) {
140+
return `export {${declName} as ${exportName}};\n`;
141+
}
142+
// OK, we're doing "export.foo = foo;". Can we update the
143+
// declaration? We can't actualy modify it yet as we're in
144+
// the middle of a search-and-replace on contents already, but
145+
// we can delete the old export and later update the
146+
// declaration into an export.
147+
const declRE = new RegExp(
148+
`^(\\s*)((?:const|let|var|function|class)\\s+${declName})\\b`,
149+
'gm',
150+
);
151+
if (contents.match(declRE)) {
152+
easyExports.push({exportName, declRE});
153+
return ''; // Delete existing export assignment.
154+
} else {
155+
return `export ${exportName};\n`; // Safe fallback.
156+
}
157+
},
158+
);
149159
// Add 'export' to existing declarations where appropriate.
150160
for (const {exportName, declRE} of easyExports) {
151161
contents = contents.replace(declRE, '$1export $2');

0 commit comments

Comments
 (0)