From f36df6fe352ffc6f5f6b8b329f3d7f632e0be815 Mon Sep 17 00:00:00 2001 From: Daniel Rozenberg Date: Tue, 9 Jul 2024 15:50:03 -0400 Subject: [PATCH] Regenerate expected Babel outputs --- .../no-transform/output.js | 1 - .../transform-assertions/nomodule/output.mjs | 1 - .../transform-assertions/transform/output.mjs | 1 - .../test/fixtures/transform/replace/output.js | 1 - .../ignored-let/output.js | 2 - .../ignored-var/output.js | 2 - .../should-transform/output.js | 2 - .../transform/ignored-not-import/output.mjs | 1 - .../fixtures/transform/ignored/output.mjs | 7 - .../fixtures/transform/sets-prop/output.mjs | 6 - .../imported-helpers/output.mjs | 16 +- .../fixtures/transform/dimensional/output.mjs | 2 - .../test/fixtures/transform/nested/output.mjs | 5 - .../fixtures/transform/transformed/output.mjs | 11 - .../test/fixtures/transform/mangle/output.js | 12 +- .../transform/export-default/output.js | 5 - .../fixtures/transform/export-from/output.js | 4 - .../transform/import-default/output.js | 4 - .../transform/imports-and-exports/output.js | 7 +- .../fixtures/transform/only-exports/output.js | 10 +- .../transform/single-import-name/output.js | 4 - .../test/fixtures/transform/class/output.js | 3 +- .../preserve-parens/output.js | 9 +- .../output.js | 3 +- .../transform-dev-assert-boolean/output.js | 12 +- .../transform-dev-assert-element/output.js | 7 +- .../transform-dev-assert-number-non/output.js | 3 +- .../transform-dev-assert-number/output.js | 16 +- .../output.js | 3 +- .../transform-dev-assert-string/output.js | 16 +- .../emit-typedefs/output.js | 8 +- .../remove-typedefs/output.js | 8 +- .../output.js | 14 +- .../should-transform-param/output.js | 6 +- .../imported-both-usage/output.mjs | 4 - .../imported-dev-usage/output.mjs | 4 - .../imported-user-usage/output.mjs | 4 - .../test/fixtures/transform/basic/output.js | 4 +- .../argument-function-identifier/output.js | 1 - .../output.js | 1 - .../existing-arrow-function/output.js | 1 - .../existing-async-arrow-function/output.js | 1 - .../function-expression/output.js | 4 - .../nested-function-inside-export/output.mjs | 1 - .../new-expression/output.js | 1 - .../transform-assertions/direct/output.js | 14 +- .../other-template-literals/output.js | 2 - .../enumvalues/output.mjs | 8 +- .../isenumvalue/output.mjs | 15 +- .../schema-complex/output.mjs | 277 +----------------- .../schema-currency-code/output.mjs | 16 +- .../schema-format-date/output.mjs | 24 +- .../schema-format/output.mjs | 20 +- .../schema-name-collision/output.mjs | 10 +- .../schema-object-enum/output.mjs | 123 +++----- .../schema-one-of/output.mjs | 35 +-- .../schema-refs/output.mjs | 24 +- .../ignore-unrelated-exports/output.mjs | 3 +- .../should-deopt-use-styles/output.mjs | 2 + .../should-replace-use-styles/output.mjs | 2 - .../transform/licenses-tabs/output.js | 4 +- .../fixtures/transform/licenses/output.js | 4 +- .../transform/promise-resolve/output.mjs | 2 - .../transform/relative-importing/output.mjs | 2 - .../fixtures/transform/directives/output.js | 3 - .../transform/rename-amp-privates/output.mjs | 39 --- .../transform/skip-nonamp-privates/output.mjs | 1 - .../transform/binary-expression/output.js | 2 - 68 files changed, 121 insertions(+), 749 deletions(-) diff --git a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/no-transform/output.js b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/no-transform/output.js index abab6e7e3048..13b1fe1b7639 100644 --- a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/no-transform/output.js +++ b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/no-transform/output.js @@ -3,7 +3,6 @@ const localDev = getMode().localDev; const minified = getMode().minified; const development = getMode().development; const namespaceVersion = mode.version(); - function getMode() { return {}; } diff --git a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/nomodule/output.mjs b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/nomodule/output.mjs index 45d07c8f35f3..f85bfb3e04ac 100644 --- a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/nomodule/output.mjs +++ b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/nomodule/output.mjs @@ -3,7 +3,6 @@ const test = false; const localDev = false; const minified = true; const development = getMode().development; - function foo() { if (getMode().development == false) { return false; diff --git a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/transform/output.mjs b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/transform/output.mjs index 3f3567f2cc3e..bee107f58f5a 100644 --- a/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/transform/output.mjs +++ b/build-system/babel-plugins/babel-plugin-amp-mode-transformer/test/fixtures/transform-assertions/transform/output.mjs @@ -5,7 +5,6 @@ const localDev = false; const minified = true; const development = false; const namespaceVersion = "$internalRuntimeVersion$"; - function foo() { if (false == false) { return false; diff --git a/build-system/babel-plugins/babel-plugin-amp-story-supported-languages/test/fixtures/transform/replace/output.js b/build-system/babel-plugins/babel-plugin-amp-story-supported-languages/test/fixtures/transform/replace/output.js index 8043b39db9d8..9fbd29e71f12 100644 --- a/build-system/babel-plugins/babel-plugin-amp-story-supported-languages/test/fixtures/transform/replace/output.js +++ b/build-system/babel-plugins/babel-plugin-amp-story-supported-languages/test/fixtures/transform/replace/output.js @@ -1,7 +1,6 @@ let AMP_STORY_SUPPORTED_LANGUAGES; AMP_STORY_SUPPORTED_LANGUAGES = 'test'; const a = ["af", "am", "ar", "bg", "bn", "bs", "ca", "cs", "da", "de", "el", "en-GB", "en", "es-419", "es", "et", "eu", "fa", "fi", "fil", "fr", "gl", "gu", "hi", "hr", "hu", "id", "is", "it", "iw", "ja", "ka", "km", "kn", "ko", "lo", "lt", "lv", "mk", "ml", "mn", "mr", "ms", "my", "ne", "nl", "no", "pa", "pl", "pt-BR", "pt-PT", "ro", "ru", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", "tr", "uk", "ur", "vi", "zh-CN", "zh-TW", "zu"]; - if (["af", "am", "ar", "bg", "bn", "bs", "ca", "cs", "da", "de", "el", "en-GB", "en", "es-419", "es", "et", "eu", "fa", "fi", "fil", "fr", "gl", "gu", "hi", "hr", "hu", "id", "is", "it", "iw", "ja", "ka", "km", "kn", "ko", "lo", "lt", "lv", "mk", "ml", "mn", "mr", "ms", "my", "ne", "nl", "no", "pa", "pl", "pt-BR", "pt-PT", "ro", "ru", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", "tr", "uk", "ur", "vi", "zh-CN", "zh-TW", "zu"].join(' ')) { console.log(["af", "am", "ar", "bg", "bn", "bs", "ca", "cs", "da", "de", "el", "en-GB", "en", "es-419", "es", "et", "eu", "fa", "fi", "fil", "fr", "gl", "gu", "hi", "hr", "hu", "id", "is", "it", "iw", "ja", "ka", "km", "kn", "ko", "lo", "lt", "lv", "mk", "ml", "mn", "mr", "ms", "my", "ne", "nl", "no", "pa", "pl", "pt-BR", "pt-PT", "ro", "ru", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", "tr", "uk", "ur", "vi", "zh-CN", "zh-TW", "zu"]); } diff --git a/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-let/output.js b/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-let/output.js index ef04009975b5..93b4be7ff0ce 100644 --- a/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-let/output.js +++ b/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-let/output.js @@ -4,7 +4,6 @@ let baz = NaN; let yep = 'hello'; let another = {}; let array = []; - function thing() { let foo = true; let bar = 1; @@ -13,7 +12,6 @@ function thing() { let another = {}; let array = []; } - thing: { let foo = true; let bar = 1; diff --git a/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-var/output.js b/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-var/output.js index 2f0700a9a99e..ff1aec31653d 100644 --- a/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-var/output.js +++ b/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/ignored-var/output.js @@ -4,7 +4,6 @@ var baz = NaN; var yep = 'hello'; var another = {}; var array = []; - function thing() { var foo = true; var bar = 1; @@ -13,7 +12,6 @@ function thing() { var another = {}; var array = []; } - thing: { var foo = true; var bar = 1; diff --git a/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/should-transform/output.js b/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/should-transform/output.js index ef04009975b5..93b4be7ff0ce 100644 --- a/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/should-transform/output.js +++ b/build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/should-transform/output.js @@ -4,7 +4,6 @@ let baz = NaN; let yep = 'hello'; let another = {}; let array = []; - function thing() { let foo = true; let bar = 1; @@ -13,7 +12,6 @@ function thing() { let another = {}; let array = []; } - thing: { let foo = true; let bar = 1; diff --git a/build-system/babel-plugins/babel-plugin-deep-pure/test/fixtures/transform/ignored-not-import/output.mjs b/build-system/babel-plugins/babel-plugin-deep-pure/test/fixtures/transform/ignored-not-import/output.mjs index 195af8bae9b6..008dc9a298de 100644 --- a/build-system/babel-plugins/babel-plugin-deep-pure/test/fixtures/transform/ignored-not-import/output.mjs +++ b/build-system/babel-plugins/babel-plugin-deep-pure/test/fixtures/transform/ignored-not-import/output.mjs @@ -1,3 +1,2 @@ const pure = v => v; - const ignored = pure(foo() || new Bar() || pure(pure(foo('bar', bar(), new Baz())) || 'foo')); diff --git a/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/ignored/output.mjs b/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/ignored/output.mjs index bbdca0baa477..32591a3f10fc 100644 --- a/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/ignored/output.mjs +++ b/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/ignored/output.mjs @@ -1,24 +1,17 @@ // Import does not end with core/dom/jsx so we ignore this file. - /** @jsx Preact.createElement */ import * as Preact from 'preact'; - () => Preact.createElement("svg", null); - () => Preact.createElement("svg", { xmlns: "http://www.w3.org/2000/svg" }); - () => Preact.createElement("path", { foo: "bar" }); - () => Preact.createElement("circle", { foo: "bar" }); - () => Preact.createElement("div", null); - () => Preact.createElement("span", { class: "whatever" }); diff --git a/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/sets-prop/output.mjs b/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/sets-prop/output.mjs index 292e886af783..0951427160b7 100644 --- a/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/sets-prop/output.mjs +++ b/build-system/babel-plugins/babel-plugin-dom-jsx-svg-namespace/test/fixtures/transform/sets-prop/output.mjs @@ -1,26 +1,20 @@ /** @jsx jsx.createElement */ import * as jsx from '../ANYWHERE_THAT_LEADS_TO/core/dom/jsx'; - () => jsx.createElement("svg", { xmlns: "http://www.w3.org/2000/svg" }); - () => jsx.createElement("svg", { xmlns: "http://www.w3.org/2000/svg" }); - () => jsx.createElement("path", { foo: "bar", xmlns: "http://www.w3.org/2000/svg" }); - () => jsx.createElement("circle", { foo: "bar", xmlns: "http://www.w3.org/2000/svg" }); - () => jsx.createElement("div", null); - () => jsx.createElement("span", { class: "whatever" }); diff --git a/build-system/babel-plugins/babel-plugin-imported-helpers/test/fixtures/transform-assertions/imported-helpers/output.mjs b/build-system/babel-plugins/babel-plugin-imported-helpers/test/fixtures/transform-assertions/imported-helpers/output.mjs index 0077fdad9f04..642774895bb4 100644 --- a/build-system/babel-plugins/babel-plugin-imported-helpers/test/fixtures/transform-assertions/imported-helpers/output.mjs +++ b/build-system/babel-plugins/babel-plugin-imported-helpers/test/fixtures/transform-assertions/imported-helpers/output.mjs @@ -1,18 +1,14 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; - const _foo = foo, - a = _foo.a, - b = _foo.b, - c = _objectWithoutPropertiesLoose(_foo, ["a", "b"]); - + a = _foo.a, + b = _foo.b, + c = _objectWithoutPropertiesLoose(_foo, ["a", "b"]); const _bar = bar, - d = _bar.d, - e = _bar.e, - f = _objectWithoutPropertiesLoose(_bar, ["d", "e"]); - + d = _bar.d, + e = _bar.e, + f = _objectWithoutPropertiesLoose(_bar, ["d", "e"]); const g = _objectSpread({}, foo); - const h = _objectSpread({ bar }, bar); diff --git a/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/dimensional/output.mjs b/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/dimensional/output.mjs index 7f891887d13b..d7a7399ca474 100644 --- a/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/dimensional/output.mjs +++ b/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/dimensional/output.mjs @@ -43,9 +43,7 @@ import { jsxStylePropertyString as _jsxStylePropertyString3 } from "#core/dom/js import { jsxStylePropertyString as _jsxStylePropertyString2 } from "#core/dom/jsx/style-property-string"; import { jsxStylePropertyString as _jsxStylePropertyString } from "#core/dom/jsx/style-property-string"; import * as jsx from 'ANYWHERE_LEADING_TO/core/dom/jsx'; - const dimensional = () =>
; - const nonDimensional = () =>
diff --git a/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/nested/output.mjs b/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/nested/output.mjs index 356b533f6558..c1b1f18ac470 100644 --- a/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/nested/output.mjs +++ b/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/nested/output.mjs @@ -1,11 +1,6 @@ import * as jsx from 'ANYWHERE_LEADING_TO/core/dom/jsx'; - const logicalAnd = () =>
; - const logicalAndDeep = () =>
; - const logicalOr = () =>
; - const ternary = () =>
; - const ternaryNested = () =>
; diff --git a/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/transformed/output.mjs b/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/transformed/output.mjs index 0af9fc73dbce..7c73fc912f4f 100644 --- a/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/transformed/output.mjs +++ b/build-system/babel-plugins/babel-plugin-jsx-style-object/test/fixtures/transform/transformed/output.mjs @@ -1,19 +1,15 @@ import { jsxStylePropertyString as _jsxStylePropertyString2 } from "#core/dom/jsx/style-property-string"; import { jsxStylePropertyString as _jsxStylePropertyString } from "#core/dom/jsx/style-property-string"; import * as jsx from 'ANYWHERE_LEADING_TO/core/dom/jsx'; - const randomObjectExpressionsAreUnmodified = () => ({ background, color: null }); - const nonObjectExpressionsAreUnmodified = () =>
; - const red = 'red'; - const otherAttributesAreUnmodified = () =>
; - const modified = () =>
; - const emptyStringValueIsRemoved = () =>
; - let dynamic = 0; - function modifyDynamicValue() { dynamic = 1; } - let backgroundColor = 'blue'; - const constants = () =>
; - const empty = () =>
; diff --git a/build-system/babel-plugins/babel-plugin-mangle-object-values/test/fixtures/transform/mangle/output.js b/build-system/babel-plugins/babel-plugin-mangle-object-values/test/fixtures/transform/mangle/output.js index deb34a065a1e..672e9de6cb3d 100644 --- a/build-system/babel-plugins/babel-plugin-mangle-object-values/test/fixtures/transform/mangle/output.js +++ b/build-system/babel-plugins/babel-plugin-mangle-object-values/test/fixtures/transform/mangle/output.js @@ -3,27 +3,31 @@ const x = { foo: 'bar', bar: 'qux', [x]: 'y' -}; // not mangled: +}; +// not mangled: const y = notMangled({ foo: 'bar', bar: 'qux', [x]: 'y' -}); // mangled: +}); +// mangled: const z = { foo: 1, bar: 2, [x]: 3 -}; // dupes: +}; +// dupes: const a = { foo: 1, baz: 2, // should be same as foo: bar: 1 -}; // 100 elements: +}; +// 100 elements: const b = { k0: 1, k1: 2, diff --git a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-default/output.js b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-default/output.js index b93af0d76598..74baf38b4c92 100644 --- a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-default/output.js +++ b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-default/output.js @@ -4,16 +4,13 @@ defineCallback.apply(null, arguments); var name = "build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-default/input"; var awaiting = callbacks[name] = callbacks[name] || []; - while (awaiting.length) { awaiting.pop()(_exports); } - awaiting.push = function (callback) { callback(_exports); }; } : defineCallback; - if (true) { exec({}); } else if (null) { @@ -24,7 +21,6 @@ if (true && name === 0) { return {}; } - return new Promise(function (resolve) { (callbacks[name] = callbacks[name] || []).push(resolve); }); @@ -37,6 +33,5 @@ _exports.__esModule = true; _exports.default = fn; - function fn() {} }); diff --git a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-from/output.js b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-from/output.js index 94dc3e894dfe..f81c842ecda2 100644 --- a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-from/output.js +++ b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-from/output.js @@ -4,16 +4,13 @@ defineCallback.apply(null, arguments); var name = "build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/export-from/input"; var awaiting = callbacks[name] = callbacks[name] || []; - while (awaiting.length) { awaiting.pop()(_exports); } - awaiting.push = function (callback) { callback(_exports); }; } : defineCallback; - if (false) { exec({}); } else if (null) { @@ -24,7 +21,6 @@ if (true && name === 0) { return {}; } - return new Promise(function (resolve) { (callbacks[name] = callbacks[name] || []).push(resolve); }); diff --git a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/import-default/output.js b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/import-default/output.js index dfbc4e1eb1ac..f57e769e7350 100644 --- a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/import-default/output.js +++ b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/import-default/output.js @@ -4,16 +4,13 @@ defineCallback.apply(null, arguments); var name = "build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/import-default/input"; var awaiting = callbacks[name] = callbacks[name] || []; - while (awaiting.length) { awaiting.pop()(_exports); } - awaiting.push = function (callback) { callback(_exports); }; } : defineCallback; - if (false) { exec({}); } else if ("build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/import-default/x") { @@ -24,7 +21,6 @@ if (false && name === 0) { return {}; } - return new Promise(function (resolve) { (callbacks[name] = callbacks[name] || []).push(resolve); }); diff --git a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/imports-and-exports/output.js b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/imports-and-exports/output.js index 0a95557176a9..ca987466db26 100644 --- a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/imports-and-exports/output.js +++ b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/imports-and-exports/output.js @@ -4,16 +4,13 @@ defineCallback.apply(null, arguments); var name = "build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/imports-and-exports/input"; var awaiting = callbacks[name] = callbacks[name] || []; - while (awaiting.length) { awaiting.pop()(_exports); } - awaiting.push = function (callback) { callback(_exports); }; } : defineCallback; - if (false) { exec({}); } else if (null) { @@ -24,7 +21,6 @@ if (true && name === 0) { return {}; } - return new Promise(function (resolve) { (callbacks[name] = callbacks[name] || []).push(resolve); }); @@ -37,10 +33,9 @@ _exports.__esModule = true; _exports.baz = void 0; - const baz = { + const baz = _exports.baz = { foo: _foo.foo, bar: _foo.bar, baz: 'baz' }; - _exports.baz = baz; }); diff --git a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/only-exports/output.js b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/only-exports/output.js index 05c8140a1004..8b64b3b4af57 100644 --- a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/only-exports/output.js +++ b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/only-exports/output.js @@ -4,16 +4,13 @@ defineCallback.apply(null, arguments); var name = "build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/only-exports/input"; var awaiting = callbacks[name] = callbacks[name] || []; - while (awaiting.length) { awaiting.pop()(_exports); } - awaiting.push = function (callback) { callback(_exports); }; } : defineCallback; - if (true) { exec({}); } else if (null) { @@ -24,7 +21,6 @@ if (true && name === 0) { return {}; } - return new Promise(function (resolve) { (callbacks[name] = callbacks[name] || []).push(resolve); }); @@ -36,10 +32,8 @@ "use strict"; _exports.__esModule = true; - _exports.y = y; _exports.x = void 0; - const x = 'y'; - _exports.x = x; - + _exports.y = y; + const x = _exports.x = 'y'; function y() {} }); diff --git a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/single-import-name/output.js b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/single-import-name/output.js index 33ec139133d7..ec717f8b4d42 100644 --- a/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/single-import-name/output.js +++ b/build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/single-import-name/output.js @@ -4,16 +4,13 @@ defineCallback.apply(null, arguments); var name = "build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/single-import-name/input"; var awaiting = callbacks[name] = callbacks[name] || []; - while (awaiting.length) { awaiting.pop()(_exports); } - awaiting.push = function (callback) { callback(_exports); }; } : defineCallback; - if (false) { exec({}); } else if ("build-system/babel-plugins/babel-plugin-nomodule-loader/test/fixtures/transform/single-import-name/foo") { @@ -24,7 +21,6 @@ if (false && name === 0) { return {}; } - return new Promise(function (resolve) { (callbacks[name] = callbacks[name] || []).push(resolve); }); diff --git a/build-system/babel-plugins/babel-plugin-react-style-props/test/fixtures/transform/class/output.js b/build-system/babel-plugins/babel-plugin-react-style-props/test/fixtures/transform/class/output.js index 308e1d093ab8..917b90f46945 100644 --- a/build-system/babel-plugins/babel-plugin-react-style-props/test/fixtures/transform/class/output.js +++ b/build-system/babel-plugins/babel-plugin-react-style-props/test/fixtures/transform/class/output.js @@ -1,5 +1,4 @@ -/*#__PURE__*/ -React.createElement("div", { +/*#__PURE__*/React.createElement("div", { id: "foo", className: "foo", hidden: true, diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/preserve-parens/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/preserve-parens/output.js index 6c2437168ca4..a68ad0f198c5 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/preserve-parens/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/preserve-parens/output.js @@ -1,9 +1,4 @@ -/** @type {!Element} */ -(dev()); - +/** @type {!Element} */(dev()); function hello() { - return ( - /** @type {!Element} */ - (dev()) - ); + return /** @type {!Element} */(dev()); } diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean-non/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean-non/output.js index ccddc1312dc9..b4be84d71434 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean-non/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean-non/output.js @@ -1,2 +1 @@ -/** @type {boolean} */ -(null); +/** @type {boolean} */(null); diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean/output.js index 3a2614aa5155..1e1aabbb665a 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-boolean/output.js @@ -1,10 +1,4 @@ const falsey = false; - -/** @type {boolean} */ -(falsey); - -/** @type {boolean} */ -(true); -let result = -/** @type {boolean} */ -(false); +/** @type {boolean} */(falsey); +/** @type {boolean} */(true); +let result = /** @type {boolean} */(false); diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-element/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-element/output.js index acd4676f39ff..54f3b740053c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-element/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-element/output.js @@ -1,5 +1,2 @@ -/** @type {!Element} */ -(element); -let result = -/** @type {!Element} */ -(element); +/** @type {!Element} */(element); +let result = /** @type {!Element} */(element); diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number-non/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number-non/output.js index 4a50c1ed57ee..a13a545d9702 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number-non/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number-non/output.js @@ -1,2 +1 @@ -/** @type {number} */ -(null); +/** @type {number} */(null); diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number/output.js index dd8816fcdc69..335172fb5439 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-number/output.js @@ -1,13 +1,5 @@ let num = 5; - -/** @type {number} */ -(num); - -/** @type {number} */ -(1 + 1); -let result = -/** @type {number} */ -(3); - -/** @type {number} */ -(0); +/** @type {number} */(num); +/** @type {number} */(1 + 1); +let result = /** @type {number} */(3); +/** @type {number} */(0); diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string-not-string-non/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string-not-string-non/output.js index dc302249d2d7..b317c79f8cc0 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string-not-string-non/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string-not-string-non/output.js @@ -1,2 +1 @@ -/** @type {string} */ -(null); +/** @type {string} */(null); diff --git a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string/output.js b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string/output.js index 472b7db7e0a5..4778ef45524f 100644 --- a/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-amp-asserts/test/fixtures/transform-assertions/transform-dev-assert-string/output.js @@ -1,13 +1,5 @@ let str = 'foo'; - -/** @type {string} */ -(str); - -/** @type {string} */ -('hello'); -let result = -/** @type {string} */ -('world'); -let result2 = -/** @type {string} */ -(''); +/** @type {string} */(str); +/** @type {string} */('hello'); +let result = /** @type {string} */('world'); +let result2 = /** @type {string} */(''); diff --git a/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/emit-typedefs/output.js b/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/emit-typedefs/output.js index 4a6f2852a0f8..396faa4f9656 100644 --- a/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/emit-typedefs/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/emit-typedefs/output.js @@ -2,7 +2,6 @@ /** @const */ const MIN_EVENT_INTERVAL_IN_MS = 100; - class PositionObserver { /** * @param {!Window} win @@ -10,13 +9,12 @@ class PositionObserver { constructor(win) { /** @private {!Window} */ this.win_ = win; + /**/ } - } -/**/ - +/**/ /** * @typedef {{ * viewportRect: !LayoutRectDef, @@ -24,7 +22,6 @@ class PositionObserver { * }} */ let PositionEntryDef; - /** * @typedef {{ * viewportRect: !LayoutRectDef, @@ -32,7 +29,6 @@ let PositionEntryDef; * }} */ let PositionEntryDef2; - /** * @typedef {{ * viewportRect: !LayoutRectDef, diff --git a/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/remove-typedefs/output.js b/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/remove-typedefs/output.js index f44123285a76..48fdb9f2e543 100644 --- a/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/remove-typedefs/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-annotation-to-extern/test/fixtures/extract-annotations/remove-typedefs/output.js @@ -4,10 +4,9 @@ * @type {number} */ let myOtherVariable = 3; -/** @const */ +/** @const */ const MIN_EVENT_INTERVAL_IN_MS = 100; - class PositionObserver { /** * @param {!Window} win @@ -15,13 +14,14 @@ class PositionObserver { constructor(win) { /** @private {!Window} */ this.win_ = win; + /** * @type {number} */ - let myOtherVariable = 3; + /**/ } - } + /**/ diff --git a/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param-destructures/output.js b/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param-destructures/output.js index 109367ebedf1..86471a5ef5f6 100644 --- a/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param-destructures/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param-destructures/output.js @@ -1,26 +1,24 @@ +let _a = a, + _bb = bb, + _c = c, + _a2 = a, + _bb2 = bb, + _c2 = c; function test({ a = 1, b: bb = 2 }, [c = 3]) { - let _a = a, - _bb = bb, - _c = c; _a; _bb; _c; } - class Foo { test({ a = 1, b: bb = 2 }, [c = 3]) { - let _a2 = a, - _bb2 = bb, - _c2 = c; _a2; _bb2; _c2; } - } diff --git a/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param/output.js b/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param/output.js index 7571a5ac9704..8510c07c7714 100644 --- a/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-default-assignment/test/fixtures/transform-assertions/should-transform-param/output.js @@ -1,12 +1,10 @@ +let _param = param, + _param2 = param; function test(param = 1) { - let _param = param; _param; } - class Foo { test(param = 1) { - let _param2 = param; _param2; } - } diff --git a/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-both-usage/output.mjs b/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-both-usage/output.mjs index 22d9732861c0..15b1fe10aec9 100644 --- a/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-both-usage/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-both-usage/output.mjs @@ -1,21 +1,17 @@ import { dev, user } from '#utils/log'; dev().info; user().fine; - function hello() { user().error('Should not be removed'); return false; } - export function helloAgain() { user().error('Should not be removed'); return false; } - class Foo { method() { dev().error(TAG, 'Should not be removed'); user().error('Should not be removed'); } - } diff --git a/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-dev-usage/output.mjs b/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-dev-usage/output.mjs index 699d0a727e15..86af787c155d 100644 --- a/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-dev-usage/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-dev-usage/output.mjs @@ -1,16 +1,12 @@ import { dev } from '#utils/log'; dev().info; dev().fine; - function hello() { return false; } - export function helloAgain() { return false; } - class Foo { method() {} - } diff --git a/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-user-usage/output.mjs b/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-user-usage/output.mjs index 589bf006ac1d..76bab56791e6 100644 --- a/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-user-usage/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-dev-methods/test/fixtures/transform-assertions/imported-user-usage/output.mjs @@ -1,17 +1,13 @@ import { user } from '#utils/log'; user().fine; user().error('Should not be removed'); - function hello() { return false; } - export function helloAgain() { user().error('Should not be removed'); return false; } - class Foo { method() {} - } diff --git a/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/test/fixtures/transform/basic/output.js b/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/test/fixtures/transform/basic/output.js index e16787f063e6..bd7a08616ef3 100644 --- a/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/test/fixtures/transform/basic/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-fix-leading-comments/test/fixtures/transform/basic/output.js @@ -2,10 +2,8 @@ * @protected {?{[key: string]: !ChildDef}} */ foo().bar; - /** * @return {number} - */ -function collectProps() { + */function collectProps() { return 1; } diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/argument-function-identifier/output.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/argument-function-identifier/output.js index 4e8fdb8df3f9..7a889dbed502 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/argument-function-identifier/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/argument-function-identifier/output.js @@ -1,5 +1,4 @@ function Foo(a) { return a + 1; } - registerService('x-foo', Foo); diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/class-function-declaration-in-public-method/output.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/class-function-declaration-in-public-method/output.js index d22046aa2542..1cb7d58dc146 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/class-function-declaration-in-public-method/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/class-function-declaration-in-public-method/output.js @@ -2,5 +2,4 @@ class Foo { foo() { let testInFooClass = () => ''; } - } diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-arrow-function/output.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-arrow-function/output.js index cf089ea2ae3d..e4e2f49a6bf5 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-arrow-function/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-arrow-function/output.js @@ -1,3 +1,2 @@ const thing = (a, b) => a + b; - let thing2 = (a, b) => a * b; diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-async-arrow-function/output.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-async-arrow-function/output.js index 78e7b57d0a6a..8ad247326f9b 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-async-arrow-function/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/existing-async-arrow-function/output.js @@ -1,3 +1,2 @@ const thing = async (a, b) => a + b; - let thing2 = async (a, b) => a * b; diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/function-expression/output.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/function-expression/output.js index bd04bbe1475b..77417349223b 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/function-expression/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/function-expression/output.js @@ -1,9 +1,5 @@ let fixedEncodeURIComponent = str => encodeURIComponent(str).replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16)); - const x = thing => console.log(thing + 1); - let fixedEncodeURIComponentArrow = str => encodeURIComponent(str).replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16)); - let y; - let fixedEncodeURIComponentArrowAssignment = str => encodeURIComponent(str).replace(/[!'()*]/g, y = c => '%' + c.charCodeAt(0).toString(16)); diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/nested-function-inside-export/output.mjs b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/nested-function-inside-export/output.mjs index 4ad9c8505de0..6d0382ddb11f 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/nested-function-inside-export/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/nested-function-inside-export/output.mjs @@ -1,5 +1,4 @@ export default function Foo() { let couldBeAnArrow = () => 1; - console.log(couldBeAnArrow()); } diff --git a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/new-expression/output.js b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/new-expression/output.js index f8962935bca7..f41c7bab59e9 100644 --- a/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/new-expression/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-function-declarations/test/fixtures/transform-assertions/new-expression/output.js @@ -1,5 +1,4 @@ function isNewed(a, b) { return a + b; } - console.log(new isNewed('a', 'b')); diff --git a/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/direct/output.js b/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/direct/output.js index 6c28684eb8dd..349fdb0a5d0c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/direct/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/direct/output.js @@ -1,10 +1,10 @@ const _template = ["html usage"], - _template2 = ["svg usage"], - _template3 = ["
html usage
"], - _template4 = ["
fourth sibling
"], - _template5 = ["
fifth sibling
"], - _template6 = ["sixth sibling"], - _template7 = ["seventh sibling"]; + _template2 = ["svg usage"], + _template3 = ["
html usage
"], + _template4 = ["
fourth sibling
"], + _template5 = ["
fifth sibling
"], + _template6 = ["sixth sibling"], + _template7 = ["seventh sibling"]; console.log(html(["html usage"])); console.log(html(["html usage multiline"])); console.log(html(["

Attribute Quote Removal

"])); @@ -31,14 +31,12 @@ console.log(svg([""])); console.log(svgFor(element)([""])); console.log(svgFor(element)([""])); - function pleaseHoistInternalUsage() { console.log(html(_template)); console.log(htmlFor(element)(_template)); console.log(svg(_template2)); console.log(svgFor(element)(_template2)); } - function pleaseHoistDifferentTemplates() { console.log(html(_template)); console.log(htmlFor(element)(_template)); diff --git a/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/other-template-literals/output.js b/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/other-template-literals/output.js index 39d3c52a98fa..845d43cec94c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/other-template-literals/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-html-template/test/fixtures/transform-assertions/other-template-literals/output.js @@ -3,9 +3,7 @@ const stringReplacement = 'yo'; console.log(`template (${stringReplacement}) literal`); const numericReplacement = 1; console.log(`template (${numericReplacement}) literal`); - function test(string) { return string; } - console.log(test`string`); diff --git a/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/enumvalues/output.mjs b/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/enumvalues/output.mjs index 43f0a8528271..6c8a410b29d7 100644 --- a/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/enumvalues/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/enumvalues/output.mjs @@ -1,7 +1,7 @@ const _enumValues_exportedEnum = ["A", "B", "C"], - _enumValues_enumInFile = [1, 100, 2], - _enumValues_ = ["FOO", 100, 2], - _enumValues_2 = ["single-item"]; + _enumValues_enumInFile = [1, 100, 2], + _enumValues_ = ["FOO", 100, 2], + _enumValues_2 = ["single-item"]; import { exportedEnum } from './exported.mjs'; _enumValues_exportedEnum; const enumInFile = { @@ -13,11 +13,9 @@ _enumValues_enumInFile; _enumValues_; _enumValues_2; ignoreMe(enumInFile); - function test() { _enumValues_exportedEnum; } - function other() { _enumValues_exportedEnum; } diff --git a/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/isenumvalue/output.mjs b/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/isenumvalue/output.mjs index 5cd7319656f6..01e35a00462c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/isenumvalue/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-inline-isenumvalue/test/fixtures/transform-assertions/isenumvalue/output.mjs @@ -1,30 +1,21 @@ const _isEnumValue_exportedEnum = x => x === "A" || x === "B" || x === "C", - _isEnumValue_enumInFile = x => x === 1 || x === 100 || x === 2, - _isEnumValue_ = x => x === "FOO" || x === 100 || x === 2, - _isEnumValue_2 = x => x === "single-item"; - + _isEnumValue_enumInFile = x => x === 1 || x === 100 || x === 2, + _isEnumValue_ = x => x === "FOO" || x === 100 || x === 2, + _isEnumValue_2 = x => x === "single-item"; import { exportedEnum } from './exported.mjs'; - _isEnumValue_exportedEnum(subject); - const enumInFile = { FOO: 1, BAR: 100, BAZ: 2 }; - _isEnumValue_enumInFile(x); - _isEnumValue_(y); - _isEnumValue_2(foo); - ignoreMe(enumInFile, x); - function test() { _isEnumValue_exportedEnum(x); } - function other() { _isEnumValue_exportedEnum(x); } diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-complex/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-complex/output.mjs index 90f88492b9af..fdaab0f3781c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-complex/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-complex/output.mjs @@ -12,215 +12,163 @@ const _schema = { }; import { isIso4217CurrencyCode } from '#core/json-schema'; "use strict"; - const _validate = validate0; const func0 = Object.prototype.hasOwnProperty; const wrapper0 = { validate: validate1 }; - function validate2(data, instancePath = "") { let vErrors = null; let errors = 0; - if (!(typeof data == "number" && isFinite(data))) { const err0 = (instancePath + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - validate2.errors = vErrors; return errors === 0; } - function validate1(data, instancePath = "") { let vErrors = null; let errors = 0; - if (Array.isArray(data)) { const len0 = data.length; - for (let i0 = 0; i0 < len0; i0++) { let data0 = data[i0]; - if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { if (data0.a === undefined) { const err0 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "a" + "'")).trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - if (data0.b === undefined) { const err1 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "b" + "'")).trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } - if (data0.c === undefined) { const err2 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "c" + "'")).trim(); - if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } - errors++; } - if (data0.d === undefined) { const err3 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "d" + "'")).trim(); - if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } - errors++; } - if (data0.e === undefined) { const err4 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "e" + "'")).trim(); - if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } - errors++; } - if (data0.f === undefined) { const err5 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "f" + "'")).trim(); - if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } - errors++; } - if (data0.g === undefined) { const err6 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "g" + "'")).trim(); - if (vErrors === null) { vErrors = [err6]; } else { vErrors.push(err6); } - errors++; } - if (data0.h === undefined) { const err7 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "h" + "'")).trim(); - if (vErrors === null) { vErrors = [err7]; } else { vErrors.push(err7); } - errors++; } - if (data0.i === undefined) { const err8 = (instancePath + "/" + i0 + ' ' + ("must have required property '" + "i" + "'")).trim(); - if (vErrors === null) { vErrors = [err8]; } else { vErrors.push(err8); } - errors++; } - for (const key0 in data0) { if (!func0.call(_schema, key0)) { const err9 = (instancePath + "/" + i0 + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err9]; } else { vErrors.push(err9); } - errors++; } } - if (data0.recursive !== undefined) { if (!wrapper0.validate(data0.recursive, instancePath + "/" + i0 + "/recursive")) { vErrors = vErrors === null ? wrapper0.validate.errors : vErrors.concat(wrapper0.validate.errors); errors = vErrors.length; } } - if (data0.a !== undefined) { let data2 = data0.a; const _errs6 = errors; let valid3 = false; let passing0 = null; const _errs7 = errors; - if (typeof data2 !== "string") { const err10 = (instancePath + "/" + i0 + "/a" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err10]; } else { vErrors.push(err10); } - errors++; } - var _valid0 = _errs7 === errors; - if (_valid0) { valid3 = true; passing0 = 0; } - const _errs9 = errors; - if (!(typeof data2 == "number" && isFinite(data2))) { const err11 = (instancePath + "/" + i0 + "/a" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err11]; } else { vErrors.push(err11); } - errors++; } - var _valid0 = _errs9 === errors; - if (_valid0 && valid3) { valid3 = false; passing0 = [passing0, 1]; @@ -230,20 +178,16 @@ function validate1(data, instancePath = "") { passing0 = 1; } } - if (!valid3) { const err12 = (instancePath + "/" + i0 + "/a" + ' ' + "must match exactly one schema in oneOf").trim(); - if (vErrors === null) { vErrors = [err12]; } else { vErrors.push(err12); } - errors++; } else { errors = _errs6; - if (vErrors !== null) { if (_errs6) { vErrors.length = _errs6; @@ -253,582 +197,451 @@ function validate1(data, instancePath = "") { } } } - if (data0.b !== undefined) { if (!validate2(data0.b, instancePath + "/" + i0 + "/b")) { vErrors = vErrors === null ? validate2.errors : vErrors.concat(validate2.errors); errors = vErrors.length; } } - if (data0.c !== undefined) { if (typeof data0.c !== "string") { const err13 = (instancePath + "/" + i0 + "/c" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err13]; } else { vErrors.push(err13); } - errors++; } } - if (data0.d !== undefined) { if (typeof data0.d !== "string") { const err14 = (instancePath + "/" + i0 + "/d" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err14]; } else { vErrors.push(err14); } - errors++; } } - if (data0.h !== undefined) { if (typeof data0.h !== "string") { const err15 = (instancePath + "/" + i0 + "/h" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err15]; } else { vErrors.push(err15); } - errors++; } } - if (data0.e !== undefined) { let data7 = data0.e; - if (typeof data7 == "number" && isFinite(data7)) { if (data7 < 0 || isNaN(data7)) { const err16 = (instancePath + "/" + i0 + "/e" + ' ' + "must be >= 0").trim(); - if (vErrors === null) { vErrors = [err16]; } else { vErrors.push(err16); } - errors++; } } else { const err17 = (instancePath + "/" + i0 + "/e" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err17]; } else { vErrors.push(err17); } - errors++; } } - if (data0.f !== undefined) { if (!isIso4217CurrencyCode(data0.f)) { const err18 = (instancePath + "/" + i0 + "/f" + ' ' + "must be a valid ISO 4217 currency code").trim(); - if (vErrors === null) { vErrors = [err18]; } else { vErrors.push(err18); } - errors++; } } - if (data0.g !== undefined) { let data9 = data0.g; - if (Array.isArray(data9)) { const len1 = data9.length; - for (let i1 = 0; i1 < len1; i1++) { let data10 = data9[i1]; - if (data10 && typeof data10 == "object" && !Array.isArray(data10)) { if (data10.url === undefined) { const err19 = (instancePath + "/" + i0 + "/g/" + i1 + ' ' + ("must have required property '" + "url" + "'")).trim(); - if (vErrors === null) { vErrors = [err19]; } else { vErrors.push(err19); } - errors++; } - if (data10.altText === undefined) { const err20 = (instancePath + "/" + i0 + "/g/" + i1 + ' ' + ("must have required property '" + "altText" + "'")).trim(); - if (vErrors === null) { vErrors = [err20]; } else { vErrors.push(err20); } - errors++; } - for (const key1 in data10) { if (!(key1 === "url" || key1 === "altText")) { const err21 = (instancePath + "/" + i0 + "/g/" + i1 + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err21]; } else { vErrors.push(err21); } - errors++; } } - if (data10.url !== undefined) { if (typeof data10.url !== "string") { const err22 = (instancePath + "/" + i0 + "/g/" + i1 + "/url" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err22]; } else { vErrors.push(err22); } - errors++; } } - if (data10.altText !== undefined) { if (typeof data10.altText !== "string") { const err23 = (instancePath + "/" + i0 + "/g/" + i1 + "/altText" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err23]; } else { vErrors.push(err23); } - errors++; } } } else { const err24 = (instancePath + "/" + i0 + "/g/" + i1 + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err24]; } else { vErrors.push(err24); } - errors++; } } } else { const err25 = (instancePath + "/" + i0 + "/g" + ' ' + "must be array").trim(); - if (vErrors === null) { vErrors = [err25]; } else { vErrors.push(err25); } - errors++; } } - if (data0.i !== undefined) { let data13 = data0.i; - if (data13 && typeof data13 == "object" && !Array.isArray(data13)) { if (data13.ratingValue === undefined) { const err26 = (instancePath + "/" + i0 + "/i" + ' ' + ("must have required property '" + "ratingValue" + "'")).trim(); - if (vErrors === null) { vErrors = [err26]; } else { vErrors.push(err26); } - errors++; } - if (data13.ratingCount === undefined) { const err27 = (instancePath + "/" + i0 + "/i" + ' ' + ("must have required property '" + "ratingCount" + "'")).trim(); - if (vErrors === null) { vErrors = [err27]; } else { vErrors.push(err27); } - errors++; } - if (data13.ratingUrl === undefined) { const err28 = (instancePath + "/" + i0 + "/i" + ' ' + ("must have required property '" + "ratingUrl" + "'")).trim(); - if (vErrors === null) { vErrors = [err28]; } else { vErrors.push(err28); } - errors++; } - for (const key2 in data13) { if (!(key2 === "ratingValue" || key2 === "ratingCount" || key2 === "ratingUrl")) { const err29 = (instancePath + "/" + i0 + "/i" + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err29]; } else { vErrors.push(err29); } - errors++; } } - if (data13.ratingValue !== undefined) { let data14 = data13.ratingValue; - if (typeof data14 == "number" && isFinite(data14)) { if (data14 < 0 || isNaN(data14)) { const err30 = (instancePath + "/" + i0 + "/i/ratingValue" + ' ' + "must be >= 0").trim(); - if (vErrors === null) { vErrors = [err30]; } else { vErrors.push(err30); } - errors++; } } else { const err31 = (instancePath + "/" + i0 + "/i/ratingValue" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err31]; } else { vErrors.push(err31); } - errors++; } } - if (data13.ratingCount !== undefined) { let data15 = data13.ratingCount; - if (typeof data15 == "number" && isFinite(data15)) { if (data15 < 0 || isNaN(data15)) { const err32 = (instancePath + "/" + i0 + "/i/ratingCount" + ' ' + "must be >= 0").trim(); - if (vErrors === null) { vErrors = [err32]; } else { vErrors.push(err32); } - errors++; } } else { const err33 = (instancePath + "/" + i0 + "/i/ratingCount" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err33]; } else { vErrors.push(err33); } - errors++; } } - if (data13.ratingUrl !== undefined) { if (typeof data13.ratingUrl !== "string") { const err34 = (instancePath + "/" + i0 + "/i/ratingUrl" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err34]; } else { vErrors.push(err34); } - errors++; } } } else { const err35 = (instancePath + "/" + i0 + "/i" + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err35]; } else { vErrors.push(err35); } - errors++; } } } else { const err36 = (instancePath + "/" + i0 + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err36]; } else { vErrors.push(err36); } - errors++; } } } else { const err37 = (instancePath + ' ' + "must be array").trim(); - if (vErrors === null) { vErrors = [err37]; } else { vErrors.push(err37); } - errors++; } - validate1.errors = vErrors; return errors === 0; } - function validate0(data, instancePath = "") { - /*# sourceURL="my-id" */ - ; + /*# sourceURL="my-id" */; let vErrors = null; let errors = 0; - if (data && typeof data == "object" && !Array.isArray(data)) { if (data.items === undefined) { const err0 = (instancePath + ' ' + ("must have required property '" + "items" + "'")).trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - for (const key0 in data) { if (!(key0 === "recursive" || key0 === "items")) { const err1 = (instancePath + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } } - if (data.recursive !== undefined) { if (!validate0(data.recursive, instancePath + "/recursive")) { vErrors = vErrors === null ? validate0.errors : vErrors.concat(validate0.errors); errors = vErrors.length; } } - if (data.items !== undefined) { let data1 = data.items; - if (Array.isArray(data1)) { const len0 = data1.length; - for (let i0 = 0; i0 < len0; i0++) { let data2 = data1[i0]; - if (data2 && typeof data2 == "object" && !Array.isArray(data2)) { if (data2.a === undefined) { const err2 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "a" + "'")).trim(); - if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } - errors++; } - if (data2.b === undefined) { const err3 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "b" + "'")).trim(); - if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } - errors++; } - if (data2.c === undefined) { const err4 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "c" + "'")).trim(); - if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } - errors++; } - if (data2.d === undefined) { const err5 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "d" + "'")).trim(); - if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } - errors++; } - if (data2.e === undefined) { const err6 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "e" + "'")).trim(); - if (vErrors === null) { vErrors = [err6]; } else { vErrors.push(err6); } - errors++; } - if (data2.f === undefined) { const err7 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "f" + "'")).trim(); - if (vErrors === null) { vErrors = [err7]; } else { vErrors.push(err7); } - errors++; } - if (data2.g === undefined) { const err8 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "g" + "'")).trim(); - if (vErrors === null) { vErrors = [err8]; } else { vErrors.push(err8); } - errors++; } - if (data2.h === undefined) { const err9 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "h" + "'")).trim(); - if (vErrors === null) { vErrors = [err9]; } else { vErrors.push(err9); } - errors++; } - if (data2.i === undefined) { const err10 = (instancePath + "/items/" + i0 + ' ' + ("must have required property '" + "i" + "'")).trim(); - if (vErrors === null) { vErrors = [err10]; } else { vErrors.push(err10); } - errors++; } - for (const key1 in data2) { if (!func0.call(_schema, key1)) { const err11 = (instancePath + "/items/" + i0 + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err11]; } else { vErrors.push(err11); } - errors++; } } - if (data2.recursive !== undefined) { if (!validate1(data2.recursive, instancePath + "/items/" + i0 + "/recursive")) { vErrors = vErrors === null ? validate1.errors : vErrors.concat(validate1.errors); errors = vErrors.length; } } - if (data2.a !== undefined) { let data4 = data2.a; const _errs10 = errors; let valid4 = false; let passing0 = null; const _errs11 = errors; - if (typeof data4 !== "string") { const err12 = (instancePath + "/items/" + i0 + "/a" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err12]; } else { vErrors.push(err12); } - errors++; } - var _valid0 = _errs11 === errors; - if (_valid0) { valid4 = true; passing0 = 0; } - const _errs13 = errors; - if (!(typeof data4 == "number" && isFinite(data4))) { const err13 = (instancePath + "/items/" + i0 + "/a" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err13]; } else { vErrors.push(err13); } - errors++; } - var _valid0 = _errs13 === errors; - if (_valid0 && valid4) { valid4 = false; passing0 = [passing0, 1]; @@ -838,20 +651,16 @@ function validate0(data, instancePath = "") { passing0 = 1; } } - if (!valid4) { const err14 = (instancePath + "/items/" + i0 + "/a" + ' ' + "must match exactly one schema in oneOf").trim(); - if (vErrors === null) { vErrors = [err14]; } else { vErrors.push(err14); } - errors++; } else { errors = _errs10; - if (vErrors !== null) { if (_errs10) { vErrors.length = _errs10; @@ -861,375 +670,293 @@ function validate0(data, instancePath = "") { } } } - if (data2.b !== undefined) { if (!validate2(data2.b, instancePath + "/items/" + i0 + "/b")) { vErrors = vErrors === null ? validate2.errors : vErrors.concat(validate2.errors); errors = vErrors.length; } } - if (data2.c !== undefined) { if (typeof data2.c !== "string") { const err15 = (instancePath + "/items/" + i0 + "/c" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err15]; } else { vErrors.push(err15); } - errors++; } } - if (data2.d !== undefined) { if (typeof data2.d !== "string") { const err16 = (instancePath + "/items/" + i0 + "/d" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err16]; } else { vErrors.push(err16); } - errors++; } } - if (data2.h !== undefined) { if (typeof data2.h !== "string") { const err17 = (instancePath + "/items/" + i0 + "/h" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err17]; } else { vErrors.push(err17); } - errors++; } } - if (data2.e !== undefined) { let data9 = data2.e; - if (typeof data9 == "number" && isFinite(data9)) { if (data9 < 0 || isNaN(data9)) { const err18 = (instancePath + "/items/" + i0 + "/e" + ' ' + "must be >= 0").trim(); - if (vErrors === null) { vErrors = [err18]; } else { vErrors.push(err18); } - errors++; } } else { const err19 = (instancePath + "/items/" + i0 + "/e" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err19]; } else { vErrors.push(err19); } - errors++; } } - if (data2.f !== undefined) { if (!isIso4217CurrencyCode(data2.f)) { const err20 = (instancePath + "/items/" + i0 + "/f" + ' ' + "must be a valid ISO 4217 currency code").trim(); - if (vErrors === null) { vErrors = [err20]; } else { vErrors.push(err20); } - errors++; } } - if (data2.g !== undefined) { let data11 = data2.g; - if (Array.isArray(data11)) { const len1 = data11.length; - for (let i1 = 0; i1 < len1; i1++) { let data12 = data11[i1]; - if (data12 && typeof data12 == "object" && !Array.isArray(data12)) { if (data12.url === undefined) { const err21 = (instancePath + "/items/" + i0 + "/g/" + i1 + ' ' + ("must have required property '" + "url" + "'")).trim(); - if (vErrors === null) { vErrors = [err21]; } else { vErrors.push(err21); } - errors++; } - if (data12.altText === undefined) { const err22 = (instancePath + "/items/" + i0 + "/g/" + i1 + ' ' + ("must have required property '" + "altText" + "'")).trim(); - if (vErrors === null) { vErrors = [err22]; } else { vErrors.push(err22); } - errors++; } - for (const key2 in data12) { if (!(key2 === "url" || key2 === "altText")) { const err23 = (instancePath + "/items/" + i0 + "/g/" + i1 + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err23]; } else { vErrors.push(err23); } - errors++; } } - if (data12.url !== undefined) { if (typeof data12.url !== "string") { const err24 = (instancePath + "/items/" + i0 + "/g/" + i1 + "/url" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err24]; } else { vErrors.push(err24); } - errors++; } } - if (data12.altText !== undefined) { if (typeof data12.altText !== "string") { const err25 = (instancePath + "/items/" + i0 + "/g/" + i1 + "/altText" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err25]; } else { vErrors.push(err25); } - errors++; } } } else { const err26 = (instancePath + "/items/" + i0 + "/g/" + i1 + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err26]; } else { vErrors.push(err26); } - errors++; } } } else { const err27 = (instancePath + "/items/" + i0 + "/g" + ' ' + "must be array").trim(); - if (vErrors === null) { vErrors = [err27]; } else { vErrors.push(err27); } - errors++; } } - if (data2.i !== undefined) { let data15 = data2.i; - if (data15 && typeof data15 == "object" && !Array.isArray(data15)) { if (data15.ratingValue === undefined) { const err28 = (instancePath + "/items/" + i0 + "/i" + ' ' + ("must have required property '" + "ratingValue" + "'")).trim(); - if (vErrors === null) { vErrors = [err28]; } else { vErrors.push(err28); } - errors++; } - if (data15.ratingCount === undefined) { const err29 = (instancePath + "/items/" + i0 + "/i" + ' ' + ("must have required property '" + "ratingCount" + "'")).trim(); - if (vErrors === null) { vErrors = [err29]; } else { vErrors.push(err29); } - errors++; } - if (data15.ratingUrl === undefined) { const err30 = (instancePath + "/items/" + i0 + "/i" + ' ' + ("must have required property '" + "ratingUrl" + "'")).trim(); - if (vErrors === null) { vErrors = [err30]; } else { vErrors.push(err30); } - errors++; } - for (const key3 in data15) { if (!(key3 === "ratingValue" || key3 === "ratingCount" || key3 === "ratingUrl")) { const err31 = (instancePath + "/items/" + i0 + "/i" + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err31]; } else { vErrors.push(err31); } - errors++; } } - if (data15.ratingValue !== undefined) { let data16 = data15.ratingValue; - if (typeof data16 == "number" && isFinite(data16)) { if (data16 < 0 || isNaN(data16)) { const err32 = (instancePath + "/items/" + i0 + "/i/ratingValue" + ' ' + "must be >= 0").trim(); - if (vErrors === null) { vErrors = [err32]; } else { vErrors.push(err32); } - errors++; } } else { const err33 = (instancePath + "/items/" + i0 + "/i/ratingValue" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err33]; } else { vErrors.push(err33); } - errors++; } } - if (data15.ratingCount !== undefined) { let data17 = data15.ratingCount; - if (typeof data17 == "number" && isFinite(data17)) { if (data17 < 0 || isNaN(data17)) { const err34 = (instancePath + "/items/" + i0 + "/i/ratingCount" + ' ' + "must be >= 0").trim(); - if (vErrors === null) { vErrors = [err34]; } else { vErrors.push(err34); } - errors++; } } else { const err35 = (instancePath + "/items/" + i0 + "/i/ratingCount" + ' ' + "must be number").trim(); - if (vErrors === null) { vErrors = [err35]; } else { vErrors.push(err35); } - errors++; } } - if (data15.ratingUrl !== undefined) { if (typeof data15.ratingUrl !== "string") { const err36 = (instancePath + "/items/" + i0 + "/i/ratingUrl" + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err36]; } else { vErrors.push(err36); } - errors++; } } } else { const err37 = (instancePath + "/items/" + i0 + "/i" + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err37]; } else { vErrors.push(err37); } - errors++; } } } else { const err38 = (instancePath + "/items/" + i0 + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err38]; } else { vErrors.push(err38); } - errors++; } } } else { const err39 = (instancePath + "/items" + ' ' + "must be array").trim(); - if (vErrors === null) { vErrors = [err39]; } else { vErrors.push(err39); } - errors++; } } } else { const err40 = (instancePath + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err40]; } else { vErrors.push(err40); } - errors++; } - validate0.errors = vErrors; return errors === 0; } - const validate = (data, schemaName = "complex") => _validate(data, schemaName) ? [] : _validate.errors; - -console. -/*OK*/ -log(validate({})); +console. /*OK*/log(validate({})); diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-currency-code/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-currency-code/output.mjs index 2652fcf24ff6..aa0570e0e71c 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-currency-code/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-currency-code/output.mjs @@ -1,33 +1,21 @@ import { isIso4217CurrencyCode } from '#core/json-schema'; "use strict"; - const validate = validate0; - function validate0(data, instancePath = "") { let vErrors = null; let errors = 0; - if (!isIso4217CurrencyCode(data)) { const err0 = (instancePath + ' ' + "must be a valid ISO 4217 currency code").trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - validate0.errors = vErrors; return errors === 0; } - const validateCurrencyCode = (data, schemaName = "currency-code") => validate(data, schemaName) ? [] : validate.errors; - -console. -/*OK*/ -log(validateCurrencyCode('MXN')); -console. -/*OK*/ -log(validateCurrencyCode('INVALID')); +console. /*OK*/log(validateCurrencyCode('MXN')); +console. /*OK*/log(validateCurrencyCode('INVALID')); diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format-date/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format-date/output.mjs index bbbefc68bf71..5d237b6d100f 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format-date/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format-date/output.mjs @@ -2,76 +2,56 @@ const validate = validate0; const formats0 = /^\d\d\d\d-[0-1]\d-[0-3]\d$/; const formats2 = /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i; const formats4 = /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i; - function validate0(data, instancePath = "") { let vErrors = null; let errors = 0; - if (data && typeof data == "object" && !Array.isArray(data)) { if (data["my-date"] !== undefined) { let data0 = data["my-date"]; - if (typeof data0 === "string") { if (!formats0.test(data0)) { const err0 = (instancePath + "/my-date" + ' ' + ("must match format \"" + "date" + "\"")).trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } } } - if (data["my-date-time"] !== undefined) { let data1 = data["my-date-time"]; - if (typeof data1 === "string") { if (!formats2.test(data1)) { const err1 = (instancePath + "/my-date-time" + ' ' + ("must match format \"" + "date-time" + "\"")).trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } } } - if (data["my-time"] !== undefined) { let data2 = data["my-time"]; - if (typeof data2 === "string") { if (!formats4.test(data2)) { const err2 = (instancePath + "/my-time" + ' ' + ("must match format \"" + "time" + "\"")).trim(); - if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } - errors++; } } } } - validate0.errors = vErrors; return errors === 0; } - const validateFormatDate = (data, schemaName = "format-date") => validate(data, schemaName) ? [] : validate.errors; - -console. -/*OK*/ -log(validateFormatDate('invalid')); -console. -/*OK*/ -log(validateFormatDate('https://example.com')); +console. /*OK*/log(validateFormatDate('invalid')); +console. /*OK*/log(validateFormatDate('https://example.com')); diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format/output.mjs index 5c539bad7a7e..7abd7cacd4ed 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-format/output.mjs @@ -1,58 +1,42 @@ const validate = validate0; const formats0 = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i; const formats2 = /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i; - function validate0(data, instancePath = "") { let vErrors = null; let errors = 0; - if (data && typeof data == "object" && !Array.isArray(data)) { if (data["my-uri"] !== undefined) { let data0 = data["my-uri"]; - if (typeof data0 === "string") { if (!formats0.test(data0)) { const err0 = (instancePath + "/my-uri" + ' ' + ("must match format \"" + "uri" + "\"")).trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } } } - if (data["my-email"] !== undefined) { let data1 = data["my-email"]; - if (typeof data1 === "string") { if (!formats2.test(data1)) { const err1 = (instancePath + "/my-email" + ' ' + ("must match format \"" + "email" + "\"")).trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } } } } - validate0.errors = vErrors; return errors === 0; } - const validateFormat = (data, schemaName = "format") => validate(data, schemaName) ? [] : validate.errors; - -console. -/*OK*/ -log(validateFormat('invalid')); -console. -/*OK*/ -log(validateFormat('https://example.com')); +console. /*OK*/log(validateFormat('invalid')); +console. /*OK*/log(validateFormat('https://example.com')); diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-name-collision/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-name-collision/output.mjs index b64aad44aa10..1e6cb594c955 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-name-collision/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-name-collision/output.mjs @@ -6,37 +6,29 @@ const validate0 = ` ajv's should be renamed, and this assignment should be preserved. `; const _schema = '', - _schema2 = 'generated value should be _schema3'; + _schema2 = 'generated value should be _schema3'; const _validate = _validate2; - const func0 = require("ajv/dist/runtime/equal").default; - function _validate2(data, instancePath = "") { let vErrors = null; let errors = 0; - if (data && typeof data == "object" && !Array.isArray(data)) { if (data.foo !== undefined) { if (!func0(data.foo, _schema3)) { const err0 = (instancePath + "/foo" + ' ' + "must be equal to constant").trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } } } - _validate2.errors = vErrors; return errors === 0; } - const validate = (data, schemaName = "name-collision") => _validate(data, schemaName) ? [] : _validate.errors; - validate(` "validate" is ajvCompile's default output name. This should not fail transform. diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-object-enum/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-object-enum/output.mjs index 103551a872df..968af417ca11 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-object-enum/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-object-enum/output.mjs @@ -1,56 +1,50 @@ const _schema = { - prop_a: 0, - prop_b: 0, - prop_c: 0, - prop_d: 0, - prop_e: 0, - prop_f: 0, - prop_g: 0, - prop_h: 0, - prop_i: 0 -}, - _schema2 = { - prop_z: 0, - prop_y: 0, - prop_x: 0, - prop_w: 0, - prop_v: 0, - prop_u: 0, - prop_t: 0, - prop_s: 0, - prop_r: 0 -}, - _schema3 = { - foo: "This object should be included in the schema object", - bar: { - "all keys are included": true - } -}, - _schema4 = { - bar: "This object should also be included in the schema object" -}, - _schema5 = { - object: true, - bar: { - "all keys are included": true - } -}; + prop_a: 0, + prop_b: 0, + prop_c: 0, + prop_d: 0, + prop_e: 0, + prop_f: 0, + prop_g: 0, + prop_h: 0, + prop_i: 0 + }, + _schema2 = { + prop_z: 0, + prop_y: 0, + prop_x: 0, + prop_w: 0, + prop_v: 0, + prop_u: 0, + prop_t: 0, + prop_s: 0, + prop_r: 0 + }, + _schema3 = { + foo: "This object should be included in the schema object", + bar: { + "all keys are included": true + } + }, + _schema4 = { + bar: "This object should also be included in the schema object" + }, + _schema5 = { + object: true, + bar: { + "all keys are included": true + } + }; const _validate = validate0; - const func0 = require("ajv/dist/runtime/equal").default; - const func1 = Object.prototype.hasOwnProperty; - function validate0(data, instancePath = "") { let vErrors = null; let errors = 0; - if (Array.isArray(data)) { const len0 = data.length; - for (let i0 = 0; i0 < len0; i0++) { let data0 = data[i0]; - if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { if (data0.prop_a !== undefined) { let data1 = data0.prop_a; @@ -58,42 +52,31 @@ function validate0(data, instancePath = "") { let valid3 = false; let passing0 = null; const _errs4 = errors; - if (typeof data1 !== "boolean") { const err0 = (instancePath + "/" + i0 + "/prop_a" + ' ' + "must be boolean").trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - var _valid0 = _errs4 === errors; - if (_valid0) { valid3 = true; passing0 = 0; } - const _errs6 = errors; - if (!(data1 === 123 || data1 === 345 || func0(data1, _schema3) || data1 === "this string should NOT be included in the schema object" || data1 === "this string should also NOT be included in the schema object" || func0(data1, _schema4))) { const err1 = (instancePath + "/" + i0 + "/prop_a" + ' ' + "must be equal to one of the allowed values").trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } - var _valid0 = _errs6 === errors; - if (_valid0 && valid3) { valid3 = false; passing0 = [passing0, 1]; @@ -103,20 +86,16 @@ function validate0(data, instancePath = "") { passing0 = 1; } } - if (!valid3) { const err2 = (instancePath + "/" + i0 + "/prop_a" + ' ' + "must match exactly one schema in oneOf").trim(); - if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } - errors++; } else { errors = _errs3; - if (vErrors !== null) { if (_errs3) { vErrors.length = _errs3; @@ -126,87 +105,68 @@ function validate0(data, instancePath = "") { } } } - if (data0.prop_c !== undefined) { let data2 = data0.prop_c; - if (data2 && typeof data2 == "object" && !Array.isArray(data2)) { for (const key0 in data2) { if (!(key0 === "prop_x" || key0 === "prop_y" || key0 === "prop_z")) { const err3 = (instancePath + "/" + i0 + "/prop_c" + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } - errors++; } } - if (data2.prop_z !== undefined) { let data3 = data2.prop_z; - if (data3 && typeof data3 == "object" && !Array.isArray(data3)) { if (data3.objectWithoutAditionalPropertiesA !== undefined) { let data4 = data3.objectWithoutAditionalPropertiesA; - if (data4 && typeof data4 == "object" && !Array.isArray(data4)) { for (const key1 in data4) { if (!func1.call(_schema, key1)) { const err4 = (instancePath + "/" + i0 + "/prop_c/prop_z/objectWithoutAditionalPropertiesA" + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } - errors++; } } } } - if (data3.objectWithoutAditionalPropertiesB !== undefined) { let data5 = data3.objectWithoutAditionalPropertiesB; - if (data5 && typeof data5 == "object" && !Array.isArray(data5)) { for (const key2 in data5) { if (!func1.call(_schema2, key2)) { const err5 = (instancePath + "/" + i0 + "/prop_c/prop_z/objectWithoutAditionalPropertiesB" + ' ' + "must NOT have additional properties").trim(); - if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } - errors++; } } - if (data5.prop_w !== undefined) { let data6 = data5.prop_w; - if (data6 && typeof data6 == "object" && !Array.isArray(data6)) { if (data6.prop_xyz !== undefined) { let data7 = data6.prop_xyz; - if (data7 && typeof data7 == "object" && !Array.isArray(data7)) { if (data7.prop_abc !== undefined) { let data8 = data7.prop_abc; - if (!(data8 === "this string should NOT be included in the schema object" || data8 === 123 || func0(data8, _schema5))) { const err6 = (instancePath + "/" + i0 + "/prop_c/prop_z/objectWithoutAditionalPropertiesB/prop_w/prop_xyz/prop_abc" + ' ' + "must be equal to one of the allowed values").trim(); - if (vErrors === null) { vErrors = [err6]; } else { vErrors.push(err6); } - errors++; } } @@ -220,13 +180,11 @@ function validate0(data, instancePath = "") { } } else { const err7 = (instancePath + "/" + i0 + "/prop_c" + ' ' + "must be object").trim(); - if (vErrors === null) { vErrors = [err7]; } else { vErrors.push(err7); } - errors++; } } @@ -234,22 +192,15 @@ function validate0(data, instancePath = "") { } } else { const err8 = (instancePath + ' ' + "must be array").trim(); - if (vErrors === null) { vErrors = [err8]; } else { vErrors.push(err8); } - errors++; } - validate0.errors = vErrors; return errors === 0; } - const validate = (data, schemaName = "object-enum") => _validate(data, schemaName) ? [] : _validate.errors; - -console. -/*OK*/ -log(validate({})); +console. /*OK*/log(validate({})); diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-one-of/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-one-of/output.mjs index 518afa13b6a1..9eae29410f51 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-one-of/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-one-of/output.mjs @@ -1,5 +1,4 @@ const validate = validate0; - function validate0(data, instancePath = "") { let vErrors = null; let errors = 0; @@ -7,42 +6,31 @@ function validate0(data, instancePath = "") { let valid0 = false; let passing0 = null; const _errs1 = errors; - if (0 !== data) { const err0 = (instancePath + ' ' + "must be equal to constant").trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - var _valid0 = _errs1 === errors; - if (_valid0) { valid0 = true; passing0 = 0; } - const _errs2 = errors; - if (typeof data !== "string") { const err1 = (instancePath + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } - var _valid0 = _errs2 === errors; - if (_valid0 && valid0) { valid0 = false; passing0 = [passing0, 1]; @@ -52,20 +40,16 @@ function validate0(data, instancePath = "") { passing0 = 1; } } - if (!valid0) { const err2 = (instancePath + ' ' + "must match exactly one schema in oneOf").trim(); - if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } - errors++; } else { errors = _errs0; - if (vErrors !== null) { if (_errs0) { vErrors.length = _errs0; @@ -74,22 +58,11 @@ function validate0(data, instancePath = "") { } } } - validate0.errors = vErrors; return errors === 0; } - const validateOneOf = (data, schemaName = "one-of") => validate(data, schemaName) ? [] : validate.errors; - -console. -/*OK*/ -log(validateOneOf('invalid')); -console. -/*OK*/ -log(validateOneOf(0)); -console. -/*OK*/ -log(validateOneOf(1)); -console. -/*OK*/ -log(validateOneOf(true)); +console. /*OK*/log(validateOneOf('invalid')); +console. /*OK*/log(validateOneOf(0)); +console. /*OK*/log(validateOneOf(1)); +console. /*OK*/log(validateOneOf(true)); diff --git a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-refs/output.mjs b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-refs/output.mjs index 90952aba3bdc..1bd2598ede44 100644 --- a/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-refs/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-json-import/test/fixtures/transform-assertions/schema-refs/output.mjs @@ -1,55 +1,43 @@ const validate = validate0; const formats0 = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i; const pattern0 = new RegExp("^https://", "u"); - function validate1(data, instancePath = "") { let vErrors = null; let errors = 0; - if (typeof data === "string") { if (!pattern0.test(data)) { const err0 = (instancePath + ' ' + ("must match pattern \"" + "^https://" + "\"")).trim(); - if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } - errors++; } - if (!formats0.test(data)) { const err1 = (instancePath + ' ' + ("must match format \"" + "uri" + "\"")).trim(); - if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } - errors++; } } else { const err2 = (instancePath + ' ' + "must be string").trim(); - if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } - errors++; } - validate1.errors = vErrors; return errors === 0; } - function validate0(data, instancePath = "") { let vErrors = null; let errors = 0; - if (data && typeof data == "object" && !Array.isArray(data)) { if (data.foo !== undefined) { if (!validate1(data.foo, instancePath + "/foo")) { @@ -57,7 +45,6 @@ function validate0(data, instancePath = "") { errors = vErrors.length; } } - if (data.bar !== undefined) { if (!validate1(data.bar, instancePath + "/bar")) { vErrors = vErrors === null ? validate1.errors : vErrors.concat(validate1.errors); @@ -65,22 +52,15 @@ function validate0(data, instancePath = "") { } } } - validate0.errors = vErrors; return errors === 0; } - const validateRefs = (data, schemaName = "refs") => validate(data, schemaName) ? [] : validate.errors; - -console. -/*OK*/ -log(validateRefs({ +console. /*OK*/log(validateRefs({ foo: 'foo', bar: 'foo' })); -console. -/*OK*/ -log(validateRefs({ +console. /*OK*/log(validateRefs({ foo: 'https://foo.com', bar: 'https://bar.org' })); diff --git a/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/ignore-unrelated-exports/output.mjs b/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/ignore-unrelated-exports/output.mjs index 4aa27f3da6f9..fbc8d0befc84 100644 --- a/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/ignore-unrelated-exports/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/ignore-unrelated-exports/output.mjs @@ -3,8 +3,9 @@ var _classes = { floatLeft: "float-left-07984bd" }; export const $floatLeft = "float-left-07984bd"; -export const useStyles = () => _classes; // These next lines should be unaffected by jss transform. +export const useStyles = () => _classes; +// These next lines should be unaffected by jss transform. export const CSS = ".float-left-07984bd{float:left}"; export const unrelated = 5; unrelated + unrelated == unrelated * 2; diff --git a/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-deopt-use-styles/output.mjs b/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-deopt-use-styles/output.mjs index f133cd409819..0559bec8b8f2 100644 --- a/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-deopt-use-styles/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-deopt-use-styles/output.mjs @@ -2,8 +2,10 @@ import { $thisOneIsOptimized as _$thisOneIsOptimized2 } from "./bar.jss"; import { $thisOneIsOptimized as _$thisOneIsOptimized } from "./foo.jss"; // useStyles() references that don't belong to a MemberExpression should be // preserve the classname object. + // TODO(alanorozco): It would be nice if these cases were linted to prevent // deopt. + import { useStyles } from './foo.jss'; import { useStyles as useAnotherStyles } from './bar.jss'; console.log(useStyles()); diff --git a/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-replace-use-styles/output.mjs b/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-replace-use-styles/output.mjs index 4cebfed48dc4..45741bdedf11 100644 --- a/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-replace-use-styles/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-jss/test/fixtures/transform-assertions/should-replace-use-styles/output.mjs @@ -9,11 +9,9 @@ import { useStyles } from '../foo.jss'; import { useStyles as useSomeOtherNameWithStyles } from './something.jss'; console.log(_$b); console.log(_$x); - function x() { return _$foo; } - _$x2; const { one: _unused, diff --git a/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses-tabs/output.js b/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses-tabs/output.js index 4491a80b3346..13e4238e68ae 100644 --- a/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses-tabs/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses-tabs/output.js @@ -4,7 +4,5 @@ const Gd = { HIDDEN: "hidden", PAUSED: "paused", INACTIVE: "inactive" -}; -/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ - +}; /* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ let Hd; diff --git a/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses/output.js b/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses/output.js index 4491a80b3346..13e4238e68ae 100644 --- a/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-minified-comments/test/fixtures/transform/licenses/output.js @@ -4,7 +4,5 @@ const Gd = { HIDDEN: "hidden", PAUSED: "paused", INACTIVE: "inactive" -}; -/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ - +}; /* Copyright (c) 2014 The Polymer Project Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd */ let Hd; diff --git a/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/promise-resolve/output.mjs b/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/promise-resolve/output.mjs index 3cf0ef279202..8c288ada6b30 100644 --- a/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/promise-resolve/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/promise-resolve/output.mjs @@ -1,6 +1,4 @@ import { resolvedPromise as _resolvedPromise2 } from "./../../../../../../../src/core/data-structures/promise"; import { resolvedPromise as _resolvedPromise } from "./../../../../../../../src/core/data-structures/promise"; - _resolvedPromise(); - _resolvedPromise2().then(() => {}); diff --git a/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/relative-importing/output.mjs b/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/relative-importing/output.mjs index 5eecb612a4e5..5ba95fcd6388 100644 --- a/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/relative-importing/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-promise-resolve/test/fixtures/transform/relative-importing/output.mjs @@ -1,6 +1,4 @@ import { resolvedPromise as _resolvedPromise2 } from "./core/data-structures/promise"; import { resolvedPromise as _resolvedPromise } from "./core/data-structures/promise"; - _resolvedPromise(); - _resolvedPromise2().then(() => {}); diff --git a/build-system/babel-plugins/babel-plugin-transform-remove-directives/test/fixtures/transform/directives/output.js b/build-system/babel-plugins/babel-plugin-transform-remove-directives/test/fixtures/transform/directives/output.js index ffb204942b7f..4342518db421 100644 --- a/build-system/babel-plugins/babel-plugin-transform-remove-directives/test/fixtures/transform/directives/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-remove-directives/test/fixtures/transform/directives/output.js @@ -1,9 +1,6 @@ function without() {} - 'use strict'; - function named() {} - try { (function () {})(); } catch (e) {} diff --git a/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/rename-amp-privates/output.mjs b/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/rename-amp-privates/output.mjs index 00566092d5b3..ad098cbd66d4 100644 --- a/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/rename-amp-privates/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/rename-amp-privates/output.mjs @@ -1,85 +1,46 @@ const obj = { test_AMP_PRIVATE_: 1, - method_AMP_PRIVATE_() {}, - get getter_AMP_PRIVATE_() {}, - set setter_AMP_PRIVATE_(v) {}, - shorthand_AMP_PRIVATE_: shorthand_, [test_]: 1, - [method_]() {}, - get [getter_]() {}, - set [setter_](v) {}, - 'test_': 1, - 'method_'() {}, - get 'getter_'() {}, - set 'setter_'(v) {} - }; - class Instance { test_AMP_PRIVATE_ = 1; - method_AMP_PRIVATE_() {} - get getter_AMP_PRIVATE_() {} - set setter_AMP_PRIVATE_(v) {} - [test_] = 1; - [method_]() {} - get [getter_]() {} - set [setter_](v) {} - 'test_' = 1; - 'method_'() {} - get 'getter_'() {} - set 'setter_'(v) {} - } - class Static { static test_AMP_PRIVATE_ = 1; - static method_AMP_PRIVATE_() {} - static get getter_AMP_PRIVATE_() {} - static set setter_AMP_PRIVATE_(v) {} - static [test_] = 1; - static [method_]() {} - static get [getter_]() {} - static set [setter_](v) {} - static 'test_' = 1; - static 'method_'() {} - static get 'getter_'() {} - static set 'setter_'(v) {} - } - var bar_; foo.bar_AMP_PRIVATE_; foo[bar_]; diff --git a/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/skip-nonamp-privates/output.mjs b/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/skip-nonamp-privates/output.mjs index 226c2d6f4e27..6d2a74a4060e 100644 --- a/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/skip-nonamp-privates/output.mjs +++ b/build-system/babel-plugins/babel-plugin-transform-rename-privates/test/fixtures/transform/skip-nonamp-privates/output.mjs @@ -6,5 +6,4 @@ class Foo { */ this.hello_ = 'world'; } - } diff --git a/build-system/babel-plugins/babel-plugin-transform-stringish-literals/test/fixtures/transform/binary-expression/output.js b/build-system/babel-plugins/babel-plugin-transform-stringish-literals/test/fixtures/transform/binary-expression/output.js index 469210ca5321..c05f6ff630bd 100644 --- a/build-system/babel-plugins/babel-plugin-transform-stringish-literals/test/fixtures/transform/binary-expression/output.js +++ b/build-system/babel-plugins/babel-plugin-transform-stringish-literals/test/fixtures/transform/binary-expression/output.js @@ -10,13 +10,11 @@ let stringEnd = "foo/1"; let illegalCharacterString = "Invalid share providers configuration for story. Value must be `true` or a params object."; let illegalCharacterTemplate = `Invalid ${x}Value must be \`true\` or a params object.`; let illegalEscapeValue = `Invalid ${x}\${foo}`; - inverted: { let illegalCharacterString = "Value must be `true` or a params object. Invalid share providers configuration for story."; let illegalCharacterTemplate = `Value must be \`true\` or a params object. Invalid ${x}`; let illegalEscapeValue = `\${foo}Invalid ${x}`; } - let stringLiterals = "12"; let numberLiterals = 3; let booleanLiterals = 1;