chore(*): Typo + fomatting (#4304)

This commit is contained in:
那里好脏不可以 2022-04-12 02:45:58 +08:00 committed by GitHub
parent 5c419b62fc
commit 37a8c90750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
97 changed files with 271 additions and 251 deletions

View File

@ -8,7 +8,7 @@ body:
label: Describe the bug
description: |
If swc crashed or panicked, you can gain error message by running `swc --sync <input.js>`.
Also, you can get backtrace by invoking swc by setting an environment varaible `SWC_DEBUG` to `1`.
Also, you can get backtrace by invoking swc by setting an environment variable `SWC_DEBUG` to `1`.
validations:
required: true
- type: textarea

View File

@ -9,7 +9,7 @@ export default function HiddenComponent() {
<Comp1 title={`My title`} hideHeader fullViewport>
<Comp2
image="/example.com/images/my.png"
title={`Title of an exmaple page`}
title={`Title of an example page`}
url={`${CONST}/directory`}
description="Hidden component, and maybe it's a good input for performance bug"
/>

View File

@ -324,7 +324,7 @@ impl Options {
// Do a resolver pass before everything.
//
// We do this before creating custom passses, so custom passses can use the
// We do this before creating custom passes, so custom passses can use the
// variable management system based on the syntax contexts.
if syntax.typescript() {
assumptions.set_class_methods = !transform.use_define_for_class_fields;

View File

@ -10,7 +10,7 @@ use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWit
/// If during compilation an ast node associated with
/// a comment is dropped, the comment will not appear in the final emitted
/// output. This can create problems in the JavaScript ecosystem, particularly
/// around instanbul coverage and other tooling that relies on comment
/// around istanbul coverage and other tooling that relies on comment
/// directives.
///
/// This transformer shifts orphaned comments to the next closest known span

View File

@ -21,7 +21,7 @@ use swc_ecma_visit::{noop_fold_type, Fold};
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct PluginConfig(String, serde_json::Value);
/// Struct represents arbitary `context` or `state` to be passed to plugin's
/// Struct represents arbitrary `context` or `state` to be passed to plugin's
/// entrypoint.
/// While internally this is strongly typed, it is not exposed as public
/// interface to plugin's entrypoint but instead will be passed as JSON string.

View File

@ -107,7 +107,7 @@ if (Deno.build.os !== "windows") {
{ perms: { run: true, write: true } },
async function chownSyncSucceed(): Promise<void> {
// TODO: when a file's owner is actually being changed,
// chown only succeeds if run under priviledged user (root)
// chown only succeeds if run under privileged user (root)
// The test script has no such privilege, so need to find a better way to test this case
const { uid, gid } = await getUidAndGid();
@ -118,7 +118,7 @@ if (Deno.build.os !== "windows") {
Deno.writeFileSync(filePath, fileData);
// the test script creates this file with the same uid and gid,
// here chown is a noop so it succeeds under non-priviledged user
// here chown is a noop so it succeeds under non-privileged user
Deno.chownSync(filePath, uid, gid);
Deno.removeSync(dirPath, { recursive: true });
@ -138,7 +138,7 @@ if (Deno.build.os !== "windows") {
Deno.writeFileSync(fileUrl, fileData);
// the test script creates this file with the same uid and gid,
// here chown is a noop so it succeeds under non-priviledged user
// here chown is a noop so it succeeds under non-privileged user
Deno.chownSync(fileUrl, uid, gid);
Deno.removeSync(dirPath, { recursive: true });
@ -158,7 +158,7 @@ if (Deno.build.os !== "windows") {
await Deno.writeFile(filePath, fileData);
// the test script creates this file with the same uid and gid,
// here chown is a noop so it succeeds under non-priviledged user
// here chown is a noop so it succeeds under non-privileged user
await Deno.chown(filePath, uid, gid);
Deno.removeSync(dirPath, { recursive: true });
@ -178,7 +178,7 @@ if (Deno.build.os !== "windows") {
await Deno.writeFile(fileUrl, fileData);
// the test script creates this file with the same uid and gid,
// here chown is a noop so it succeeds under non-priviledged user
// here chown is a noop so it succeeds under non-privileged user
await Deno.chown(fileUrl, uid, gid);
Deno.removeSync(dirPath, { recursive: true });

View File

@ -124,7 +124,8 @@ unitTest(function consoleTestStringifyCircular(): void {
};
nestedObj.o = circularObj;
const nestedObjExpected = `{
const nestedObjExpected = `\
{
num: 1,
bool: true,
str: "a",
@ -209,7 +210,8 @@ unitTest(function consoleTestStringifyCircular(): void {
assertEquals(stringify(JSON), 'JSON { Symbol(Symbol.toStringTag): "JSON" }');
assertEquals(
stringify(console),
`{
`\
{
log: [Function],
debug: [Function],
info: [Function],
@ -286,7 +288,8 @@ unitTest(function consoleTestStringifyLargeObject(): void {
};
assertEquals(
stringify(obj),
`{
`\
{
a: 2,
o: {
a: "1",
@ -311,7 +314,8 @@ unitTest(function consoleTestStringifyIterable() {
const longArray = new Array(200).fill(0);
assertEquals(
stringify(longArray),
`[
`\
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -326,7 +330,8 @@ unitTest(function consoleTestStringifyIterable() {
const obj = { a: "a", longArray };
assertEquals(
stringify(obj),
`{
`\
{
a: "a",
longArray: [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -353,7 +358,8 @@ unitTest(function consoleTestStringifyIterable() {
}
assertEquals(
stringify(longMap),
`Map {
`\
Map {
"0" => 0,
"1" => 1,
"2" => 2,
@ -466,7 +472,8 @@ unitTest(function consoleTestStringifyIterable() {
}
assertEquals(
stringify(longSet),
`Set {
`\
Set {
0,
1,
2,
@ -858,7 +865,8 @@ unitTest(function consoleGroup(): void {
assertEquals(
out.toString(),
`1
`\
1
2
3
4
@ -887,7 +895,8 @@ unitTest(function consoleGroupWarn(): void {
console.warn("7");
assertEquals(
both.toString(),
`1
`\
1
2
3
4
@ -905,7 +914,8 @@ unitTest(function consoleTable(): void {
console.table({ a: "test", b: 1 });
assertEquals(
stripColor(out.toString()),
`┌───────┬────────┐
`\
(idx) Values
a "test"
@ -918,7 +928,8 @@ unitTest(function consoleTable(): void {
console.table({ a: { b: 10 }, b: { b: 20, c: 30 } }, ["c"]);
assertEquals(
stripColor(out.toString()),
`┌───────┬────┐
`\
(idx) c
a
@ -931,7 +942,8 @@ unitTest(function consoleTable(): void {
console.table([1, 2, [3, [4]], [5, 6], [[7], [8]]]);
assertEquals(
stripColor(out.toString()),
`┌───────┬───────┬───────┬────────┐
`\
(idx) 0 1 Values
0 1
@ -947,7 +959,8 @@ unitTest(function consoleTable(): void {
console.table(new Set([1, 2, 3, "test"]));
assertEquals(
stripColor(out.toString()),
`┌────────────┬────────┐
`\
(iter idx) Values
0 1
@ -967,7 +980,8 @@ unitTest(function consoleTable(): void {
);
assertEquals(
stripColor(out.toString()),
`┌────────────┬─────┬────────┐
`\
(iter idx) Key Values
0 1 "one"
@ -986,7 +1000,8 @@ unitTest(function consoleTable(): void {
});
assertEquals(
stripColor(out.toString()),
`┌───────┬───────────┬───────────────────┬────────┐
`\
(idx) c e Values
a true
@ -1008,7 +1023,8 @@ unitTest(function consoleTable(): void {
]);
assertEquals(
stripColor(out.toString()),
`┌───────┬────────┬──────────────────────┬────┬────────┐
`\
(idx) 0 1 a Values
0 1
@ -1024,7 +1040,8 @@ unitTest(function consoleTable(): void {
console.table([]);
assertEquals(
stripColor(out.toString()),
`┌───────┐
`\
(idx)
@ -1035,7 +1052,8 @@ unitTest(function consoleTable(): void {
console.table({});
assertEquals(
stripColor(out.toString()),
`┌───────┐
`\
(idx)
@ -1046,7 +1064,8 @@ unitTest(function consoleTable(): void {
console.table(new Set());
assertEquals(
stripColor(out.toString()),
`┌────────────┐
`\
(iter idx)
@ -1057,7 +1076,8 @@ unitTest(function consoleTable(): void {
console.table(new Map());
assertEquals(
stripColor(out.toString()),
`┌────────────┐
`\
(iter idx)
@ -1072,7 +1092,8 @@ unitTest(function consoleTable(): void {
console.table(["Hello", "你好", "Amapá"]);
assertEquals(
stripColor(out.toString()),
`┌───────┬─────────┐
`\
(idx) Values
0 "Hello"
@ -1089,7 +1110,8 @@ unitTest(function consoleTable(): void {
]);
assertEquals(
stripColor(out.toString()),
`┌───────┬───┬───┐
`\
(idx) 0 1
0 1 2
@ -1102,7 +1124,8 @@ unitTest(function consoleTable(): void {
console.table({ 1: { a: 4, b: 5 }, 2: null, 3: { b: 6, c: 7 } }, ["b"]);
assertEquals(
stripColor(out.toString()),
`┌───────┬───┐
`\
(idx) b
1 5

View File

@ -679,7 +679,7 @@ unitTest(
try {
await response.text();
fail(
"Reponse.text() didn't throw on a filtered response without a body (type opaqueredirect)"
"Response.text() didn't throw on a filtered response without a body (type opaqueredirect)"
);
} catch (e) {
return;
@ -702,7 +702,7 @@ unitTest(
try {
await response.text();
fail(
"Reponse.text() didn't throw on a filtered response without a body (type error)"
"Response.text() didn't throw on a filtered response without a body (type error)"
);
} catch (e) {
return;

View File

@ -13,14 +13,14 @@ unitTest({ perms: { read: true } }, function watchFsInvalidPath() {
if (Deno.build.os === "windows") {
assertThrows(
() => {
Deno.watchFs("non-existant.file");
Deno.watchFs("non-existent.file");
},
Error,
"Input watch path is neither a file nor a directory"
);
} else {
assertThrows(() => {
Deno.watchFs("non-existant.file");
Deno.watchFs("non-existent.file");
}, Deno.errors.NotFound);
}
});
@ -42,7 +42,7 @@ unitTest(
const testDir = await Deno.makeTempDir();
const iter = Deno.watchFs(testDir);
// Asynchornously capture two fs events.
// Asynchronously capture two fs events.
const eventsPromise = getTwoEvents(iter);
// Make some random file system activity.

View File

@ -48,7 +48,7 @@ unitTest(function transformStreamConstructedNoTransform() {
new TransformStream({});
});
unitTest(function transformStreamIntstancesHaveProperProperties() {
unitTest(function transformStreamInstancesHaveProperProperties() {
const ts = new TransformStream({ transform(): void {} });
const proto = Object.getPrototypeOf(ts);
@ -425,7 +425,7 @@ unitTest(async function transformStreamCallTransformSync() {
await writePromise;
});
unitTest(function transformStreamCloseWriteCloesesReadWithNoChunks() {
unitTest(function transformStreamCloseWriteClosesReadWithNoChunks() {
const ts = new TransformStream({}, undefined, { highWaterMark: 0 });
const writer = ts.writable.getWriter();
@ -514,7 +514,7 @@ unitTest(function transformStreamReadableTypeThrows() {
);
});
unitTest(function transformStreamWirtableTypeThrows() {
unitTest(function transformStreamWritableTypeThrows() {
assertThrows(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
() => new TransformStream({ writableType: "bytes" as any }),

View File

@ -1,3 +1,3 @@
function foo1() {
// commnet into
// comment into
}

View File

@ -2,6 +2,6 @@
x Unexpected empty function pattern
,-[1:1]
1 | ,-> function foo1() {
2 | | // commnet into
2 | | // comment into
3 | `-> }
`----

View File

@ -6,7 +6,7 @@
{
"BinaryExpression": [
{
"message": "no 'in' expession",
"message": "no 'in' expression",
"operator": "in"
}
]

View File

@ -1,11 +1,11 @@
x no 'in' expession
x no 'in' expression
,----
1 | 'a' in { a: 10 };
: ^^^^^^^^^^^^^^^^
`----
x no 'in' expession
x no 'in' expression
,----
6 | if ('a' in { a: 10 }) {}
: ^^^^^^^^^^^^^^^^

View File

@ -5,7 +5,7 @@
"error",
{
"ForInExpression": {
"message": "no 'for-in' expession"
"message": "no 'for-in' expression"
}
}
]

View File

@ -1,5 +1,5 @@
x no 'for-in' expession
x no 'for-in' expression
,----
1 | for (var x in {}) {}
: ^^^^^^^^^^^^^^^^^^^^

View File

@ -5,7 +5,7 @@
"error",
{
"ForOfExpression": {
"message": "no 'for-of' expession"
"message": "no 'for-of' expression"
}
}
]

View File

@ -1,5 +1,5 @@
x no 'for-of' expession
x no 'for-of' expression
,----
1 | for (var x of {}) {}
: ^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,7 @@
const CD: ClassDecorator = () => { }
const PD: PropertyDecorator = () => { }
// Commenting out the decorators creates valid ouput.
// Commenting out the decorators creates valid output.
@CD
export class ServiceError extends Error {
@PD

View File

@ -26,7 +26,7 @@ use testing::{NormalizedOutput, Tester};
"privateNameAndAny.ts",
"privateNameAndIndexSignature.ts",
"privateNameImplicitDeclaration.ts",
"privateNameStaticAccessorssDerivedClasses.ts",
"privateNameStaticAccessorsDerivedClasses.ts",
"privateNameErrorsOnNotUseDefineForClassFieldsInEsNext.ts",
"enumConstantMembers.ts",
)

View File

@ -71,7 +71,7 @@ function ms(value: StringValue | number, options?: Options): number | string {
} catch (error) {
const message = isError(error)
? `${error.message}. value=${JSON.stringify(value)}`
: 'An unknown error has occured.';
: 'An unknown error has occurred.';
throw new Error(message);
}
}

View File

@ -51,7 +51,7 @@ export default function(c, e) {
if ("number" == typeof c && isFinite(c)) return (null == e ? void 0 : e.long) ? b(c) : a(c);
throw new Error("Value is not a string or number.");
} catch (f) {
var g = d(f) ? "".concat(f.message, ". value=").concat(JSON.stringify(c)) : "An unknown error has occured.";
var g = d(f) ? "".concat(f.message, ". value=").concat(JSON.stringify(c)) : "An unknown error has occurred.";
throw new Error(g);
}
};

View File

@ -1,6 +1,6 @@
use swc_common::pass::Repeat;
use swc_ecma_ast::*;
use swc_ecma_transforms_optimization::simplify::{const_propgation::constant_propagation, dce};
use swc_ecma_transforms_optimization::simplify::{const_propagation::constant_propagation, dce};
use swc_ecma_visit::FoldWith;
use crate::{Bundler, Load, Resolve};

View File

@ -43,7 +43,7 @@ const interfaceToAST = (
* We use GraphQL _interface_ to improve query definitions, the "FooBar" object
* type will implement "Foo" and "Bar" interfaces and if "Foo" exists somewhere
* else, programmer can create single "FooInterface" GraphQL Fragment and use
* it for all occurences of "Foo" as well as for all types, which implements
* it for all occurrences of "Foo" as well as for all types, which implements
* "FooInterface".
*
* We must use schema extension for this task. During GraphQL distillation, if

View File

@ -12,7 +12,7 @@ Deno.test({
});
Deno.test({
name: `"toValidGraphQLName" shoud convert invalid GraphQL name to valid`,
name: `"toValidGraphQLName" should convert invalid GraphQL name to valid`,
fn() {
Object.entries({
"9foo": `foo`,

View File

@ -20,7 +20,7 @@ export const main = async (
{ loadFile, writeTextFile }: PlatformSpecificApi,
) => {
const writeOutputFile = (path: string, data: string) => {
log(color.blue(`Writting file:\t${path}`));
log(color.blue(`Writing file:\t${path}`));
return writeTextFile(path, data);
};

View File

@ -24,13 +24,13 @@ use crate::{syntax_pos::Mark, SyntaxContext};
pub enum PluginError {
/// Occurs when failed to convert size passed from host / guest into usize
/// or similar for the conversion. This is an internal error rasied via
/// plugin_macro, noramlly plugin author should not raise this manually.
/// plugin_macro, normally plugin author should not raise this manually.
SizeInteropFailure(String),
/// Occurs when failed to reconstruct a struct from `Serialized`.
Deserialize(String),
/// Occurs when failed to serialize a struct into `Serialized`.
/// Unlike deserialize error, this error cannot forward any context for the
/// raw bytes: when serialze failed, there's nothing we can pass between
/// raw bytes: when serialize failed, there's nothing we can pass between
/// runtime.
Serialize(String),
}
@ -104,7 +104,7 @@ impl Serialized {
.with_context(|| format!("failed to deserialize `{}`", type_name::<W>()))
}
/// Convinient wrapper to Serialized::* to construct actual struct from raw
/// Convenient wrapper to Serialized::* to construct actual struct from raw
/// ptr. This is common workflow on both of runtime (host / plugin) to
/// deserialize struct from allocated / copied ptr.
///

View File

@ -108,7 +108,7 @@ pub(super) struct SourceMapFiles {
/// The interner for spans.
///
/// As most spans are simply stored, we store them as interend form.
/// As most spans are simply stored, we store them as interned form.
///
/// - Each ast node only stores pointer to actual data ([BytePos]).
/// - The pointers ([BytePos]) can be converted to file name, line and column

View File

@ -77,7 +77,7 @@ pub struct MutableMarkContext(pub u32, pub u32, pub u32);
// proxies instead which'll call actual host fn.
extern "C" {
// Instead of trying to copy-serialize `Mark`, this fn directly consume
// inner raw value as well as fn and let each context constrcuts struct
// inner raw value as well as fn and let each context constructs struct
// on their side.
fn __mark_fresh_proxy(mark: u32) -> u32;
fn __mark_parent_proxy(self_mark: u32) -> u32;

View File

@ -43,7 +43,7 @@ impl Visit for ColorHexAlpha {
Preference::Never if length == 4 || length == 8 => {
self.ctx.report(
hex_color,
format!("Unxpected alpha channel in '#{}'.", hex_color.value),
format!("Unexpected alpha channel in '#{}'.", hex_color.value),
);
}
_ => {}

View File

@ -20,7 +20,7 @@ const MESSAGE: &str = "Unexpected '!important'.";
struct DeclarationNoImportant {
ctx: LintRuleContext<()>,
// rule interal
// rule internal
keyframe_rules: Vec<Span>,
}

View File

@ -1,11 +1,11 @@
x Unxpected alpha channel in '#ffff'.
x Unexpected alpha channel in '#ffff'.
,-[$DIR/tests/rules/fail/color-hex-alpha/never/input.css:1:1]
1 | a { color: #ffff; }
: ^^^^^
`----
x Unxpected alpha channel in '#ffffffff'.
x Unexpected alpha channel in '#ffffffff'.
,-[$DIR/tests/rules/fail/color-hex-alpha/never/input.css:2:1]
2 | a { color: #ffffffff; }
: ^^^^^^^^^

View File

@ -25,4 +25,4 @@ The name of a test is `base64_url(md5(name))`.
Apache 2.0 / MIT, at your option.
Lots of tests are copied from rome toools and esbuild. If you want to use tests, please consult license of those libraries.
Lots of tests are copied from rome tools and esbuild. If you want to use tests, please consult license of those libraries.

View File

@ -37,7 +37,7 @@ where
/// Parse a given string as `T`.
///
/// If there are syntax errors but if it was recoverable, it will be appendend
/// If there are syntax errors but if it was recoverable, it will be appended
/// to `errors`.
pub fn parse_str<'a, T>(
src: &'a str,
@ -59,7 +59,7 @@ where
/// Parse a given file as `T`.
///
/// If there are syntax errors but if it was recoverable, it will be appendend
/// If there are syntax errors but if it was recoverable, it will be appended
/// to `errors`.
pub fn parse_file<'a, T>(
fm: &'a SourceFile,
@ -79,7 +79,7 @@ where
/// Parse a given file as `T`.
///
/// If there are syntax errors but if it was recoverable, it will be appendend
/// If there are syntax errors but if it was recoverable, it will be appended
/// to `errors`.
pub fn parse_tokens<'a, T>(
tokens: &'a Tokens,

View File

@ -49,7 +49,7 @@ fn parse_and_gen(entry: &Path) {
.expect("failed to process a module");
}
/// Usage: ./scripts/instruements path/to/input/file
/// Usage: ./scripts/instruments path/to/input/file
fn main() {
let main_file = env::args().nth(1).unwrap();

View File

@ -15,7 +15,7 @@ use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax};
use testing::NormalizedOutput;
const IGNORED_PASS_TESTS: &[&str] = &[
// Temporalily ignored
// Temporally ignored
"431ecef8c85d4d24.js",
"8386fbff927a9e0e.js",
"5654d4106d7025c2.js",

View File

@ -29,7 +29,7 @@ enum FunctionModifiers {
}
impl FunctionModifiers {
fn get_human_redable(&self) -> &'static str {
fn get_human_readable(&self) -> &'static str {
match self {
FunctionModifiers::Generator => "generator",
FunctionModifiers::Getter => "getter",
@ -189,7 +189,7 @@ impl NoEmptyFunction {
let message = if let Some(fn_modifier) = function_type {
format!(
"Unexpected empty {} {} pattern",
fn_modifier.get_human_redable(),
fn_modifier.get_human_readable(),
target_type
)
} else {

View File

@ -92,7 +92,7 @@ impl NoLoopFunc {
.any(|scope| self.scoped_unsafe_vars.get(scope).unwrap().contains(id))
}
fn extact_vars(&mut self, pat: &Pat) {
fn extract_vars(&mut self, pat: &Pat) {
match pat {
Pat::Ident(ident) => {
self.scoped_unsafe_vars
@ -103,7 +103,7 @@ impl NoLoopFunc {
Pat::Array(ArrayPat { elems, .. }) => {
elems.iter().for_each(|elem| {
if let Some(elem) = elem {
self.extact_vars(elem);
self.extract_vars(elem);
}
});
}
@ -116,18 +116,18 @@ impl NoLoopFunc {
.insert(key.to_id());
}
ObjectPatProp::KeyValue(KeyValuePatProp { value, .. }) => {
self.extact_vars(value.as_ref());
self.extract_vars(value.as_ref());
}
ObjectPatProp::Rest(RestPat { arg, .. }) => {
self.extact_vars(arg.as_ref());
self.extract_vars(arg.as_ref());
}
});
}
Pat::Rest(RestPat { arg, .. }) => {
self.extact_vars(arg.as_ref());
self.extract_vars(arg.as_ref());
}
Pat::Assign(AssignPat { left, .. }) => {
self.extact_vars(left.as_ref());
self.extract_vars(left.as_ref());
}
Pat::Invalid(_) => {}
Pat::Expr(_) => {}
@ -262,7 +262,7 @@ impl Visit for NoLoopFunc {
_ => {}
};
self.extact_vars(&var_declarator.name);
self.extract_vars(&var_declarator.name);
}
fn visit_function(&mut self, function: &Function) {

View File

@ -3786,7 +3786,7 @@ var Set = (global_window__WEBPACK_IMPORTED_MODULE_0___default().Set) ? (global_w
var Component$1 = /*#__PURE__*/function () {
/**
* A callback that is called when a component is ready. Does not have any
* paramters and any callback value will be ignored.
* parameters and any callback value will be ignored.
*
* @callback Component~ReadyCallback
* @this Component

View File

@ -40,7 +40,7 @@ fn bench_files(c: &mut Criterion) {
)
});
c.bench_function("jqeury", |b| {
c.bench_function("jquery", |b| {
bench_module(
b,
Default::default(),

View File

@ -47,7 +47,7 @@ fn bench_files(c: &mut Criterion) {
)
});
c.bench_function("jqeury", |b| {
c.bench_function("jquery", |b| {
bench_module(
b,
Default::default(),

View File

@ -426,7 +426,7 @@ macro_rules! expose {
$T:ty,
$($t:tt)*
) => {
/// Note: This is reccomended way to parse a file.
/// Note: This is recommended way to parse a file.
///
/// This is an alias for [Parser], [Lexer] and [SourceFileInput], but
/// instantiation of generics occur in `swc_ecma_parser` crate.

View File

@ -177,7 +177,7 @@ where
);
// ES2016
let pass = add!(pass, ExponentiationOperator, es2016::exponentation());
let pass = add!(pass, ExponentiationOperator, es2016::exponentiation());
// ES2015
let pass = add!(pass, BlockScopedFunctions, es2015::block_scoped_functions());

View File

@ -544,7 +544,7 @@ expect(log).toEqual(numsFrom0to9);
"#
);
// transformation_initiailzer_after_super_bug_8808
// transformation_initializer_after_super_bug_8808
test!(
syntax(false),
|t| transformation(t),
@ -1997,7 +1997,7 @@ expect(j).toBe(1);
"#
);
// element_descriptors_original_own_field_without_initiailzer_exec
// element_descriptors_original_own_field_without_initializer_exec
test_exec!(
syntax(false),
|t| tr(t),

View File

@ -204,7 +204,7 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
progressSubscriber?.error?.(e);
let error;
try {
error = new AjaxTimeoutError(xhr, request); // TODO: Make betterer.
error = new AjaxTimeoutError(xhr, request); // TODO: Make better.
} catch (err) {
error = err;
}
@ -402,7 +402,7 @@ const AjaxTimeoutErrorImpl = (() => {
})();
/**
* Thrown when an AJAX request timesout. Not to be confused with {@link TimeoutError}.
* Thrown when an AJAX request timeout. Not to be confused with {@link TimeoutError}.
*
* This is exported only because it is useful for checking to see if errors are an
* `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of

View File

@ -577,7 +577,7 @@ impl VisitMut for Fixer<'_> {
fn visit_mut_stmt(&mut self, s: &mut Stmt) {
let old = self.ctx;
// only ExprStmt would have unparened expr,
// only ExprStmt would have unparented expr,
// which would be handled in its own visit function
self.ctx = Context::FreeExpr;
s.visit_mut_children_with(self);

View File

@ -141,7 +141,7 @@ impl ForOf {
assert_eq!(
var.decls.len(),
1,
"Variable declarator of for of loop cannot contain multiple entires"
"Variable declarator of for of loop cannot contain multiple entries"
);
prepend(
&mut body.stmts,
@ -384,7 +384,6 @@ impl ForOf {
}
/// ```js
///
/// try {
/// if (!_iteratorNormalCompletion && _iterator.return != null) {
/// _iterator.return();

View File

@ -26,16 +26,16 @@ use swc_trace_macro::swc_trace;
/// x = Math.pow(x, 3);
/// ```
#[tracing::instrument(level = "info", skip_all)]
pub fn exponentation() -> impl Fold + VisitMut {
as_folder(Exponentation::default())
pub fn exponentiation() -> impl Fold + VisitMut {
as_folder(Exponentiation::default())
}
#[derive(Default)]
struct Exponentation {
struct Exponentiation {
vars: Vec<VarDeclarator>,
}
impl Parallel for Exponentation {
impl Parallel for Exponentiation {
fn create(&self) -> Self {
Self::default()
}
@ -46,7 +46,7 @@ impl Parallel for Exponentation {
}
#[swc_trace]
impl ParExplode for Exponentation {
impl ParExplode for Exponentiation {
fn after_one_stmt(&mut self, stmts: &mut Vec<Stmt>) {
if !self.vars.is_empty() {
stmts.push(Stmt::Decl(Decl::Var(VarDecl {
@ -72,7 +72,7 @@ impl ParExplode for Exponentation {
#[swc_trace]
#[parallel(explode)]
impl VisitMut for Exponentation {
impl VisitMut for Exponentiation {
noop_visit_mut_type!();
fn visit_mut_expr(&mut self, e: &mut Expr) {
@ -148,7 +148,7 @@ mod tests {
test!(
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
babel_binary,
"2 ** 2",
"Math.pow(2, 2)"
@ -157,7 +157,7 @@ mod tests {
test_exec!(
ignore,
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
babel_comprehensive,
r#"expect(2 ** 3).toBe(8);
expect(3 * 2 ** 3).toBe(24);
@ -186,7 +186,7 @@ expect(2 ** 3 ** 2).toBe(512);"#
// FIXME
ignore,
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
babel_memoize_object,
r#"var counters = 0;
Object.defineProperty(global, "reader", {
@ -202,7 +202,7 @@ expect(counters).toBe(1);"#
test!(
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
assign,
r#"x **= 3"#,
r#"x = Math.pow(x, 3)"#,
@ -210,7 +210,7 @@ expect(counters).toBe(1);"#
);
// test!(::swc_ecma_parser::Syntax::default(),
// |_| exponentation(),
// |_| exponentiation(),
// babel_4403,
// "var a, b;
// a[`${b++}`] **= 1;",
@ -222,7 +222,7 @@ expect(counters).toBe(1);"#
test!(
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
issue_740,
"self.a = 10 ** 2",
"self.a = Math.pow(10, 2)",
@ -233,7 +233,7 @@ expect(counters).toBe(1);"#
// bu JakeChampion
test!(
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
babel_binary_member_assignment_expression,
"var x = {}; x.a = 2 ** 2",
"var x = {}; x.a = Math.pow(2, 2)"
@ -241,7 +241,7 @@ expect(counters).toBe(1);"#
test!(
::swc_ecma_parser::Syntax::default(),
|_| exponentation(),
|_| exponentiation(),
assign_to_object_property,
r#"var self = {}; self.x **= 3"#,
r#"var self = {}; var ref = self.x; self.x = Math.pow(ref, 3);"#,

View File

@ -1,10 +1,10 @@
use swc_ecma_visit::Fold;
pub use self::exponentation::exponentation;
pub use self::exponentiation::exponentiation;
mod exponentation;
mod exponentiation;
#[tracing::instrument(level = "info", skip_all)]
pub fn es2016() -> impl Fold {
exponentation()
exponentiation()
}

View File

@ -1690,7 +1690,7 @@ expect(new Outer().hello()).toBe('hello');
"#
);
// spec_super_reference_in_prop_exression
// spec_super_reference_in_prop_expression
test!(
syntax(),
|t| spec_tr(t),
@ -2509,7 +2509,7 @@ expect(obj.test).toBe(3);
"#
);
// spec_derived_constructor_no_super_return_falsey
// spec_derived_constructor_no_super_return_falsy
test!(
syntax(),
|t| spec_tr(t),
@ -4831,7 +4831,7 @@ expect(t2).toBeInstanceOf(Array);
"#
);
// spec_super_reference_in_prop_exression_exec
// spec_super_reference_in_prop_expression_exec
test_exec!(
// babel also fails on this
ignore,
@ -5123,7 +5123,7 @@ let Foo = /*#__PURE__*/function (Bar) {
// extend_builtins_shadowed
test!(
// Cost is too high while being uesless
// Cost is too high while being useless
ignore,
syntax(),
|t| tr(t),

View File

@ -774,7 +774,7 @@ test!(
);
test!(
// optimiation is not implemented
// optimization is not implemented
ignore,
syntax(),
|_| tr(Default::default()),

View File

@ -7,7 +7,7 @@ use swc_ecma_parser::{EsConfig, Syntax};
use swc_ecma_transforms_base::resolver::resolver;
use swc_ecma_transforms_compat::{
es2015::{arrow, block_scoping, classes, function_name, template_literal},
es2016::exponentation,
es2016::exponentiation,
es2017::async_to_generator,
es2022::class_properties,
es3::reserved_words,
@ -4514,7 +4514,7 @@ test!(
syntax(),
|t| chain!(
class_properties(Some(t.comments.clone()), Default::default()),
exponentation(),
exponentiation(),
classes(Some(t.comments.clone()), Default::default()),
block_scoping(),
),

View File

@ -58,7 +58,7 @@ pub trait ImportResolver {
fn resolve_import(&self, base: &FileName, module_specifier: &str) -> Result<JsWord, Error>;
}
/// [ImportResolver] implementation which just uses orignal source.
/// [ImportResolver] implementation which just uses original source.
#[derive(Debug, Clone, Copy, Default)]
pub struct NoopImportResolver;

View File

@ -392,12 +392,12 @@ impl SystemJs {
fn hoist_var_decl(&mut self, var_decl: VarDecl) -> Option<Expr> {
let mut exprs = vec![];
for var_declartor in var_decl.decls {
for var_declarator in var_decl.decls {
let mut tos = vec![];
var_declartor.visit_with(&mut VarCollector { to: &mut tos });
var_declarator.visit_with(&mut VarCollector { to: &mut tos });
for (sym, ctxt) in tos {
if var_declartor.init.is_none() {
if var_declarator.init.is_none() {
for (k, v) in self.export_map.iter_mut() {
if (sym.clone(), ctxt) == *k {
for value in v.iter() {
@ -412,11 +412,11 @@ impl SystemJs {
.push(Ident::new(sym, DUMMY_SP.with_ctxt(ctxt)));
}
if let Some(init) = var_declartor.init {
if let Some(init) = var_declarator.init {
exprs.push(Box::new(Expr::Assign(AssignExpr {
span: DUMMY_SP,
op: op!("="),
left: PatOrExpr::Pat(Box::new(var_declartor.name)),
left: PatOrExpr::Pat(Box::new(var_declarator.name)),
right: init,
})));
}
@ -433,12 +433,12 @@ impl SystemJs {
fn hoist_for_var_decl(&mut self, var_decl_or_pat: VarDeclOrPat) -> VarDeclOrPat {
if let VarDeclOrPat::VarDecl(mut var_decl) = var_decl_or_pat {
if var_decl.kind == VarDeclKind::Var {
let var_declartor = var_decl.decls.remove(0);
let var_declarator = var_decl.decls.remove(0);
let mut tos = vec![];
var_declartor.visit_with(&mut VarCollector { to: &mut tos });
var_declarator.visit_with(&mut VarCollector { to: &mut tos });
for to in tos {
if var_declartor.init.is_none() {
if var_declarator.init.is_none() {
for (k, v) in self.export_map.iter_mut() {
if to == *k {
for value in v.iter() {
@ -453,7 +453,7 @@ impl SystemJs {
.push(Ident::new(to.0, DUMMY_SP.with_ctxt(to.1)));
}
VarDeclOrPat::Pat(var_declartor.name)
VarDeclOrPat::Pat(var_declarator.name)
} else {
VarDeclOrPat::VarDecl(var_decl)
}
@ -834,15 +834,15 @@ impl Fold for SystemJs {
decls: vec![],
..var_decl
};
for var_declartor in var_decl.decls {
for var_declarator in var_decl.decls {
let mut tos = vec![];
var_declartor.visit_with(&mut VarCollector { to: &mut tos });
var_declarator.visit_with(&mut VarCollector { to: &mut tos });
for to in tos {
let ident =
Ident::new(to.0.clone(), DUMMY_SP.with_ctxt(to.1));
self.add_export_name(to, ident.sym.clone());
}
decl.decls.push(var_declartor);
decl.decls.push(var_declarator);
}
execute_stmts.push(Stmt::Decl(Decl::Var(decl)));
}

View File

@ -23,7 +23,7 @@ use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWit
/// JSON.parse('{"a":1, "b"}')
/// ```
///
/// # COnditions
/// # Conditions
/// If any of the conditions below is matched, pure object literal is converter
/// to `JSON.parse`
///

View File

@ -50,7 +50,7 @@ pub fn expr_simplifier(config: Config) -> impl RepeatedJsPass + VisitMut + 'stat
struct SimplifyExpr {
config: Config,
changed: bool,
/// Uninitializd variables.
/// Uninitialized variables.
vars: Vec<VarDeclarator>,
is_arg_of_update: bool,
is_modifying: bool,

View File

@ -8,7 +8,7 @@ pub use self::{
};
mod branch;
pub mod const_propgation;
pub mod const_propagation;
pub mod dce;
mod expr;
pub mod inlining;

View File

@ -396,7 +396,7 @@ where
let src_without_helpers = tester.print(&module, &tester.comments.clone());
module = module.fold_with(&mut inject_helpers());
let transfromed_src = tester.print(&module, &tester.comments.clone());
let transformed_src = tester.print(&module, &tester.comments.clone());
println!(
"\t>>>>> Orig <<<<<\n{}\n\t>>>>> Code <<<<<\n{}",
@ -407,7 +407,7 @@ where
println!("\t>>>>> Expected stdout <<<<<\n{}", expected);
let actual = stdout_of(&transfromed_src).unwrap();
let actual = stdout_of(&transformed_src).unwrap();
assert_eq!(expected, actual);

View File

@ -204,7 +204,7 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
progressSubscriber?.error?.(e);
let error;
try {
error = new AjaxTimeoutError(xhr, request); // TODO: Make betterer.
error = new AjaxTimeoutError(xhr, request); // TODO: Make better.
} catch (err) {
error = err;
}
@ -402,7 +402,7 @@ const AjaxTimeoutErrorImpl = (() => {
})();
/**
* Thrown when an AJAX request timesout. Not to be confused with {@link TimeoutError}.
* Thrown when an AJAX request timeout. Not to be confused with {@link TimeoutError}.
*
* This is exported only because it is useful for checking to see if errors are an
* `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of

View File

@ -108,7 +108,7 @@ fn single_tr_group(c: &mut Criterion) {
es2019_optional_catch_binding,
);
c.bench_function("es2017_async_to_generator", es2017_async_to_generator);
c.bench_function("es2016_exponentation", es2016_exponentation);
c.bench_function("es2016_exponentiation", es2016_exponentiation);
c.bench_function("es2015_arrow", es2015_arrow);
c.bench_function("es2015_block_scoped_fn", es2015_block_scoped_fn);
c.bench_function("es2015_block_scoping", es2015_block_scoping);
@ -190,8 +190,8 @@ fn es2016(b: &mut Bencher) {
run(b, swc_ecma_transforms_compat::es2016);
}
fn es2016_exponentation(b: &mut Bencher) {
run(b, swc_ecma_transforms_compat::es2016::exponentation);
fn es2016_exponentiation(b: &mut Bencher) {
run(b, swc_ecma_transforms_compat::es2016::exponentiation);
}
fn es2015(b: &mut Bencher) {

View File

@ -12,7 +12,7 @@ struct SuperField {
ident: IndexMap<JsWord, Ident>,
}
/// Don't use it aginst function, it will stop if come across any function
/// Don't use it against function, it will stop if come across any function
/// use it against function body
#[derive(Default)]

View File

@ -135,7 +135,7 @@ struct BabelClassMethod<'a> {
#[derive(Serialize)]
struct AcornClassMethodValue<'a> {
/// `FuncionExpression`
/// `FunctionExpression`
#[serde(rename = "type")]
type_: &'a str,
#[serde(flatten)]

View File

@ -40,7 +40,7 @@ pub enum Declaration {
ImportDecl(ImportDeclaration),
#[tag("DeclareClass")]
DeclClass(DeclareClass),
#[tag("DeclareFuncction")]
#[tag("DeclareFunction")]
DeclFunc(DeclareFunction),
#[tag("DeclareInterface")]
DeclInterface(DeclareInterface),
@ -68,7 +68,7 @@ pub enum Declaration {
EnumDecl(EnumDeclaration),
#[tag("TSDeclareFunction")]
TSDeclFunc(TSDeclareFunction),
#[tag("TSIterfaceDeclaration")]
#[tag("TSInterfaceDeclaration")]
TSInterfaceDecl(TSInterfaceDeclaration),
#[tag("TSTypeAliasDeclaration")]
TSTypeAliasDecl(TSTypeAliasDeclaration),

View File

@ -148,7 +148,7 @@ impl Serialize for ObjectMethod {
#[derive(Serialize)]
struct AcornObjectMethodValue<'a> {
/// `FuncionExpression`
/// `FunctionExpression`
#[serde(rename = "type")]
type_: &'static str,
#[serde(flatten)]

View File

@ -324,7 +324,7 @@ pub struct TSIndexSignature {
#[serde(flatten)]
pub base: BaseNode,
#[serde(default)]
pub paramters: Vec<Identifier>,
pub parameters: Vec<Identifier>,
#[serde(default)]
pub type_annotation: Option<Box<TSTypeAnnotation>>,
#[serde(default)]

View File

@ -204,7 +204,7 @@ export class AjaxSubscriber<T> extends Subscriber<Event> {
progressSubscriber?.error?.(e);
let error;
try {
error = new AjaxTimeoutError(xhr, request); // TODO: Make betterer.
error = new AjaxTimeoutError(xhr, request); // TODO: Make better.
} catch (err) {
error = err;
}
@ -402,7 +402,7 @@ const AjaxTimeoutErrorImpl = (() => {
})();
/**
* Thrown when an AJAX request timesout. Not to be confused with {@link TimeoutError}.
* Thrown when an AJAX request timeout. Not to be confused with {@link TimeoutError}.
*
* This is exported only because it is useful for checking to see if errors are an
* `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of

View File

@ -213,7 +213,7 @@ impl Babelify for JSXAttrValue {
fn babelify(self, ctx: &Context) -> Self::Output {
match self {
JSXAttrValue::Lit(lit) => {
// TODO(dwoznicki): Babel only seems to accept string literals here. Is taht
// TODO(dwoznicki): Babel only seems to accept string literals here. Is that
// right?
match lit {
Lit::Str(s) => JSXAttrVal::String(s.babelify(ctx)),

View File

@ -296,7 +296,7 @@ impl Babelify for TsIndexSignature {
fn babelify(self, ctx: &Context) -> Self::Output {
TSIndexSignature {
base: ctx.base(self.span),
paramters: self
parameters: self
.params
.into_iter()
.map(|param| param.babelify(ctx).into())

View File

@ -24,7 +24,7 @@ extern "C" {
fn __add_pure_comment_proxy(byte_pos: u32);
}
/// A struct to exchance allocated Vec<Comment> between memory spaces.
/// A struct to exchange allocated Vec<Comment> between memory spaces.
#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
pub struct CommentsVecPtr(pub i32, pub i32);
@ -70,7 +70,7 @@ impl PluginCommentsProxy {
}
}
/// Utiilty wrapper to call host fn which returns a Comment or Vec<Comment>.
/// Utility wrapper to call host fn which returns a Comment or Vec<Comment>.
#[cfg_attr(not(target_arch = "wasm32"), allow(unused))]
fn read_returned_comments_from_host<F, R>(&self, f: F) -> Option<R>
where
@ -90,7 +90,7 @@ impl PluginCommentsProxy {
{
let ret = f(serialized_comments_vec_ptr_raw_ptr as _);
// Host fn call completes: by contract in commments_proxy, if return value is 0
// Host fn call completes: by contract in comments_proxy, if return value is 0
// we know there's no value to read. Otherwise, we know host filled in
// CommentsVecPtr to the pointer for the actual value for the
// results.

View File

@ -83,7 +83,7 @@ fn create_filesystem_cache(filesystem_cache_root: &Option<String>) -> Option<Fil
None
}
/// Create a new cache instance if not intialized. This can be called multiple
/// Create a new cache instance if not initialized. This can be called multiple
/// time, but any subsequent call will be ignored.
///
/// This fn have a side effect to create path to cache if given path is not
@ -121,7 +121,7 @@ impl PluginModuleCache {
}
}
/// Load a compiled plugin Module from speficied path.
/// Load a compiled plugin Module from specified path.
/// Since plugin will be initialized per-file transform, this function tries
/// to avoid reading filesystem per each initialization via naive
/// in-memory map which stores raw bytecodes from file. Unlike compiled

View File

@ -1,12 +1,12 @@
use wasmer::{LazyInit, Memory};
/// An external enviornment state imported (declared in host, injected into
/// An external environment state imported (declared in host, injected into
/// guest) fn can access. This'll allow host to read from updated state from
/// guest.
///
/// This is `base` environment exposes guest's memory space only. For other
/// calls requires additional data to be set in the host, separate
/// hostenvironments are decalred. Refer `CommentsHostEnvironment` for an
/// hostenvironments are declared. Refer `CommentsHostEnvironment` for an
/// example.
///
/// ref: https://docs.wasmer.io/integrations/examples/host-functions#declaring-the-data

View File

@ -82,7 +82,7 @@ where
);
}
/// Utility fn to unwrap necessary values for the commments, as well as host
/// Utility fn to unwrap necessary values for the comments, as well as host
/// environment's state.
fn unwrap_comments_storage_with_env<F, R>(env: &CommentHostEnvironment, f: F, default: R) -> R
where
@ -113,11 +113,11 @@ fn allocate_return_values_into_guest(
let (allocated_ptr, allocated_ptr_len) =
write_into_memory_view(memory, serialized_bytes, |_| {
// In most cases our host-plugin tranmpoline works in a way that
// In most cases our host-plugin trampoline works in a way that
// plugin pre-allocates
// memory before calling host imported fn. But in case of
// comments return value is Vec<Comments> which
// guest cannot predetermine size to allocate, intead
// guest cannot predetermine size to allocate, instead
// let host allocate by calling guest's alloc via attached
// hostenvironment.
alloc_guest_memory

View File

@ -12,7 +12,7 @@ pub fn emit_diagnostics(env: &BaseHostEnvironment, bytes_ptr: i32, bytes_ptr_len
let diagnostics_bytes = copy_bytes_into_host(memory, bytes_ptr, bytes_ptr_len);
let serialized = Serialized::new_for_plugin(&diagnostics_bytes[..], bytes_ptr_len);
let diagnostic = Serialized::deserialize::<Diagnostic>(&serialized)
.expect("Should able to be deserialized into diagnsotic");
.expect("Should able to be deserialized into diagnostic");
let mut builder =
swc_common::errors::DiagnosticBuilder::new_diagnostic(handler, diagnostic);

View File

@ -3,7 +3,7 @@ use swc_common::{hygiene::MutableMarkContext, plugin::Serialized, Mark, SyntaxCo
use crate::{host_environment::BaseHostEnvironment, memory_interop::write_into_memory_view};
/// A proxy to Mark::fresh() that can be used in plugin.
/// This it not direcly called by plugin, instead `impl Mark` will selectively
/// This it not directly called by plugin, instead `impl Mark` will selectively
/// call this depends on the running context.
pub fn mark_fresh_proxy(parent: u32) -> u32 {
Mark::fresh(Mark::from_u32(parent)).as_u32()
@ -22,7 +22,7 @@ pub fn mark_set_builtin_proxy(self_mark: u32, is_builtin: u32) {
}
/// A proxy to Mark::is_descendant_of_() that can be used in plugin.
/// Origianl call site have mutable param, which we'll pass over as return value
/// Original call site have mutable param, which we'll pass over as return value
/// via serialized MutableMarkContext.
/// Inside of guest context, once this host function returns it'll assign params
/// with return value accordingly.

View File

@ -31,7 +31,7 @@
* 2. `get_leading()` internally calls `__get_leading_comments_proxy`, which is
* imported fn `get_leading_comments_proxy` exists in the host.
* 3. Host access necessary values in its memory space (COMMENTS)
* 4. Host copies value to be returned into plguin's memory space. Memory
* 4. Host copies value to be returned into plugin's memory space. Memory
* allocation for the value should be manually performed.
* 5. Host completes imported fn, `PluginCommentsProxy::get_leading()` now can
* read, deserialize memory host wrote.
@ -79,7 +79,7 @@ pub(crate) fn build_import_object(
) -> ImportObject {
let wasmer_store = module.store();
// transfrom_result
// transform_result
let set_transform_result_fn_decl = Function::new_native_with_env(
wasmer_store,
TransformResultHostEnvironment::new(transform_result),

View File

@ -26,9 +26,9 @@ impl TransformResultHostEnvironment {
}
}
/// Set plugin's transformed result into host's enviroment.
/// Set plugin's transformed result into host's environment.
/// This is an `imported` fn - when we instantiate plugin module, we inject this
/// fn into pluging's export space. Once transform completes, plugin will call
/// fn into plugin's export space. Once transform completes, plugin will call
/// this to set its result back to host.
pub fn set_transform_result(
env: &TransformResultHostEnvironment,

View File

@ -44,7 +44,7 @@ where
// Get a subarray for current memoryview starting from ptr address we just
// allocated above, perform copying into specified ptr. Wasm's memory layout
// is linear and we have atomic gaurantee by not having any thread access,
// is linear and we have atomic guarantee by not having any thread access,
// so can safely get subarray from allocated ptr address.
//
// If we want safer operation instead, refer previous implementation

View File

@ -18,7 +18,7 @@ pub struct TransformExecutor {
// memory space
exported_plugin_alloc: wasmer::NativeFunc<u32, i32>,
instance: Instance,
// Reference to the pointers succesfully allocated which'll be freed by Drop.
// Reference to the pointers successfully allocated which'll be freed by Drop.
allocated_ptr_vec: Vec<(i32, i32)>,
transform_result: Arc<Mutex<Vec<u8>>>,
}

View File

@ -37,7 +37,7 @@ function defaultClearTimeout() {
}())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
//normal environments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
@ -46,7 +46,7 @@ function runTimeout(fun) {
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
// when when somebody has screwed with setTimeout but no I.E. madness
return cachedSetTimeout(fun, 0);
} catch (e) {
try {
@ -62,7 +62,7 @@ function runTimeout(fun) {
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
//normal environments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
@ -71,14 +71,14 @@ function runClearTimeout(marker) {
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
// when when somebody has screwed with setTimeout but no I.E. madness
return cachedClearTimeout(marker);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// same as above but when it's a version of I.E. that must have the global object for 'this', hopefully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
@ -144,7 +144,7 @@ process.nextTick = function (fun) {
}
};
// v8 likes predictible objects
// v8 likes predictable objects
function Item(fun, array) {
this.fun = fun;
this.array = array;

View File

@ -63,7 +63,7 @@
"estree",
"eval",
"Eval",
"exponentation",
"exponentiation",
"fargs",
"finalizer",
"fnames",

View File

@ -22,11 +22,11 @@ SWC wants to provide user-level feature to collect diagnostic information for it
- [option 1] Run profilers like [`perf`](https://perf.wiki.kernel.org/index.php/Main_Page), [`instruments`](https://developer.apple.com/forums/tags/instruments)
- [option 2] Provide a `traceable` binary enables tracing capabilites all time, emits trace event format compatible output
- [option 2] Provide a `traceable` binary enables tracing capabilities all time, emits trace event format compatible output
- **[option 3] Release binary provides runtime flags to enable tracing, emits trace event format compatible output**
- [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferrable way
- [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferable way
## Decision Outcome
@ -36,7 +36,7 @@ This decision is taken because
- It was relatively easy to the users who want to run performance profiling against real world codebases, by opt-in via specific flag, or initialization interfaces
- It was edge://tracing/ easy to visualize, diagnose via familiar UI (edge://tracing, chrome devtools)
- Trace event format have well-defined [spec](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#!), widely used not only limited to chroium's internal traces
- Trace event format have well-defined [spec](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#!), widely used not only limited to chromium's internal traces
- It doesn't require special setup for running profiling, like installing a new binary, or setting up per-platform tools which could be widely different between local dev machine to CI systems.
## Pros and Cons of the Options <!-- optional -->
@ -50,25 +50,25 @@ SWC does not implement any internal tracing features, let user rely on own profi
- Bad, depends on build config some of symbols might missing in release binary
- Bad, user have to setup per-platform specific profilers then have to translate its results
### [option 2] Provide a `traceable` binary enables tracing capabilites all time, emits trace event format compatible output
### [option 2] Provide a `traceable` binary enables tracing capabilities all time, emits trace event format compatible output
SWC implements internal logics to generate traceable outputs, which is compatible to trace event format. However, it is not included in normal release binary (`@swc/core`) but requires to install specific custom binary to opt in.
- Good, SWC does not have any overhead for its release binary to support trace.
- Good, users does not need to setup complex per-platform profilers
- Good, users can use existing visualization tools (chromium).
- Bad, it is non-trivial to setup programattic opt-in to enabling traces, or setting up continous monitoring on CI systems with normal release binary
- Bad, it is non-trivial to setup programmatic opt-in to enabling traces, or setting up continuous monitoring on CI systems with normal release binary
### [option 3] Release binary provides runtime flags to enable tracing, emits trace event format compatible output
SWC implements internal logics to generate traceble outputs, which is compatible to trace event format. It is included in release binary by default which can be enabled via cli flags, or programmatic interfaces.
SWC implements internal logics to generate traceable outputs, which is compatible to trace event format. It is included in release binary by default which can be enabled via cli flags, or programmatic interfaces.
- Good, users does not need to setup complex per-platform profilers
- Good, users can use existing visualization tools (chromium).
- Good, opt-in profiling is trivial as it can be controlled via programmatic interfaces without having separate binary
- Bad, there are runtime overheads by having traceable logics, even when trace is not enabled
### [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferrable way
### [option 4] Either creating separate binary or provide runtime flags, emits raw trace outputs let user convert into own preferable way
SWC follows option 2 or 3, however its emitted output is not compatible to trace event format but raw values from [tracing infrastructure](https://github.com/tokio-rs/tracing)

View File

@ -25,7 +25,7 @@ it("should accept object", async () => {
);
});
it("should accpept { mangle = true }", async () => {
it("should accept { mangle = true }", async () => {
const { code } = await swc.minify(
`
import foo from '@src/app';
@ -42,7 +42,7 @@ it("should accpept { mangle = true }", async () => {
);
});
it("should accpept { mangle = object }", async () => {
it("should accept { mangle = object }", async () => {
const { code } = await swc.minify(
`
import foo from '@src/app';
@ -87,7 +87,7 @@ it("should mangle locals", async () => {
);
});
describe("soruce map", () => {
describe("source map", () => {
it("should have `names`", async () => {
const { map } = await swc.minify(
`
@ -110,7 +110,7 @@ describe("soruce map", () => {
expect(JSON.parse(map).names).not.toEqual([]);
});
it("should have `sources` if file name is speicified", async () => {
it("should have `sources` if file name is specified", async () => {
const { map } = await swc.minify(
{
"foo.js": `(function(){

View File

@ -28,7 +28,7 @@ it("should emit _interopRequireWildcard", () => {
);
});
it("should work with amd and expternal helpers", () => {
it("should work with amd and external helpers", () => {
const out = swc.transformSync(
`class Foo {}
class Bar extends Foo {}`,

View File

@ -1,6 +1,6 @@
const swc = require('../../../');
it('should work without parser.sytax', () => {
it('should work without parser.syntax', () => {
const out = swc.transformSync(`const someValue = "test" ?? "default value";`, {
jsc: {
parser: {

View File

@ -113,7 +113,7 @@ it('should handle input sourcemap correctly', async () => {
})
describe('soruceMaps: true in .swcrc', () => {
describe('sourceMaps: true in .swcrc', () => {
it(`should be respected`, async () => {
const out = await swc.transformFile(path.join(__dirname, '..', '..', 'tests', 'issue-2120', 'input.js'));

View File

@ -86,8 +86,8 @@ function intToHex( int: number )
* Converts a hex string containing a color such as '#00DEAD' to
* an integer, such as 0x00DEAD;
*
* @param {Number} num
* @return {String}
* @param {String} hex
* @return {Number}
*/
function hexToInt( hex: string )
{

View File

@ -1091,12 +1091,12 @@ export class Visitor {
}
visitAssignmentExpression(n: AssignmentExpression): Expression {
n.left = this.visitPatternOrExpressison(n.left);
n.left = this.visitPatternOrExpression(n.left);
n.right = this.visitExpression(n.right);
return n;
}
visitPatternOrExpressison(n: Pattern | Expression): Pattern | Expression {
visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression {
switch (n.type) {
case "ObjectPattern":
case "ArrayPattern":

View File

@ -339,7 +339,7 @@ export function __experimental_registerGlobalTraceConfig(traceConfig: {
*
* Returns current binary's metadata to determine which binary is actually loaded.
*
* This is undocumented interface, does not gaurantee stability across `@swc/core`'s semver
* This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
* as internal representation may change anytime. Use it with caution.
*/
export function getBinaryMetadata() {

View File

@ -272,7 +272,7 @@ export interface Options extends Config {
*
* "root" - Passes the "root" value through as unchanged.
* "upward" - Walks upward from the "root" directory, looking for a directory
* containinga swc.config.js file, and throws an error if a swc.config.js
* containing a swc.config.js file, and throws an error if a swc.config.js
* is not found.
* "upward-optional" - Walk upward from the "root" directory, looking for
* a directory containing a swc.config.js file, and falls back to "root"
@ -333,7 +333,7 @@ export interface Options extends Config {
* a package that matches one of the "swcrcRoots" packages.
*
*
* Defaults to true as long as the filename option has been specificed
* Defaults to true as long as the filename option has been specified
*/
swcrc?: boolean;
@ -403,11 +403,11 @@ export type Swcrc = Config | Config[];
*/
export interface Config {
/**
* Note: The type is string because it follow rust's regex syntax.
* Note: The type is string because it follows rust's regex syntax.
*/
test?: string | string[];
/**
* Note: The type is string because it follow rust's regex syntax.
* Note: The type is string because it follows rust's regex syntax.
*/
exclude?: string | string[];
env?: EnvConfig;
@ -464,7 +464,7 @@ export interface EnvConfig {
shippedProposals?: boolean;
/**
* Enable all trnasforms
* Enable all transforms
*/
forceAllTransforms?: boolean;
}
@ -483,7 +483,7 @@ export interface JscConfig {
externalHelpers?: boolean;
/**
* Defaults to `es3` (which enableds **all** pass).
* Defaults to `es3` (which enabled **all** pass).
*/
target?: JscTarget;
@ -496,7 +496,7 @@ export interface JscConfig {
optimizeHygiene?: boolean,
keepImportAssertions?: boolean,
/**
* Specify the location where SWC stores its intermidiate cache files.
* Specify the location where SWC stores its intermediate cache files.
* Currently only transform plugin uses this. If not specified, SWC will
* create `.swc` directories.
*/
@ -1012,7 +1012,7 @@ export interface VariableDeclarator extends Node, HasSpan {
id: Pattern;
/// Initialization expresion.
/// Initialization expression.
init?: Expression;
/// Typescript only

View File

@ -13,8 +13,6 @@ export default function _asyncGeneratorDelegate(inner, awaitWrap) {
};
}
;
if (typeof Symbol === "function" && Symbol.iterator) {
iter[Symbol.iterator] = function () {
return this;

View File

@ -20,6 +20,6 @@ function get(target, property, receiver) {
return get(target, property, receiver);
}
export default function _get(target, property, reciever) {
return get(target, property, reciever);
export default function _get(target, property, receiver) {
return get(target, property, receiver);
}

View File

@ -1,4 +1,4 @@
import { getCurrentPrNumber, octokit } from "../util/octokit";
import { getCurrentPrNumber } from "../util/octokit";
import { parsePrComments } from "./comment-parser";

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Script used to verify the depdencies of the project.
# Script used to verify the dependencies of the project.
#
set -eu

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Script used to verify the depdencies of the project.
# Script used to verify the dependencies of the project.
#
set -eu
@ -16,7 +16,7 @@ if [ ! -z "${1-}" ] ; then
else
if [ ! -z "$TEXT" ]; then
echo "Found a depenedncy requires verification"
echo "Found a dependency requires verification"
# exit 1
else
echo "All dependencies are verified"