From 20ce326909670d0e40c9f1bbd804387c2958eae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 16 Sep 2021 13:23:33 +0900 Subject: [PATCH] feat(es/minifer): Improve minifier (#2229) swc_ecma_minifier: - `if_return`: Allow side-effect-free statements to come after `if_return`. - `collapse_vars`: Move variables without init to first. - `analyzer`: Remove useless fields. - Don't drop `return` tokens if there's a finally block. - `drop_return_value`: Drop side-effect-free return arguments. - `make_sequences`: Don't inject `void 0` to return args. - `if_terminate`: Move to the pure optimizer. - Fix a bug related to `RegExp`. --- Cargo.lock | 4 +- ecmascript/minifier/Cargo.toml | 2 +- ecmascript/minifier/examples/perf.rs | 85 + ecmascript/minifier/package.json | 1 + ecmascript/minifier/scripts/instrument.sh | 4 + ecmascript/minifier/src/analyzer/mod.rs | 3 - .../minifier/src/analyzer/storage/normal.rs | 15 +- ecmascript/minifier/src/compress/mod.rs | 5 + .../src/compress/optimize/if_return.rs | 183 +- .../minifier/src/compress/optimize/mod.rs | 25 +- .../src/compress/optimize/sequences.rs | 4 +- .../minifier/src/compress/pure/if_return.rs | 106 ++ ecmascript/minifier/src/compress/pure/misc.rs | 46 +- ecmascript/minifier/src/compress/pure/mod.rs | 70 +- ecmascript/minifier/src/compress/pure/vars.rs | 60 +- .../fixture/issues/vercel/001/input.js | 1 + .../fixture/issues/vercel/001/output.js | 1 + .../fixture/projects/mootools/7/output.js | 3 +- .../output.js | 989 ----------- .../function-7fe8439c89afccb77983/output.js | 989 ----------- .../head-432fc3a9a66c90ce2ec2/output.js | 1158 ------------- .../output.js | 1067 ------------ .../nested-05a7ce04b1f7eb6da341/output.js | 989 ----------- .../no-chunk-e2d9573b8d7df68a6cde/output.js | 1481 ----------------- .../no-ssr-9ced90e71a0d75a11cdd/output.js | 990 ----------- .../output.js | 999 ----------- .../ssr-994266264fb6ff57d32c/output.js | 987 ----------- .../ssr-true-6d4aa8fc503b9d073aef/output.js | 990 ----------- .../266-aee26c928109d49d6151/input.js | 0 .../266-aee26c928109d49d6151/output.js | 0 .../framework-054ead69ea8124b4cb27/input.js | 0 .../framework-054ead69ea8124b4cb27/output.js | 0 .../main-2953d6142ff4a439dbc0/input.js | 0 .../main-2953d6142ff4a439dbc0/output.js | 0 .../input.js | 0 .../output.js | 0 .../input.js | 0 .../output.js | 0 .../polyfills-6437a4964f697e5b0b3e/input.js | 0 .../polyfills-6437a4964f697e5b0b3e/output.js | 0 .../webpack-eb940a9a97802b481f9b/input.js | 0 .../webpack-eb940a9a97802b481f9b/output.js | 0 .../383.5942fafdbede773d29c7/output.js | 3 +- .../input.js | 0 .../output.js | 370 ++++ .../function-7fe8439c89afccb77983/input.js | 0 .../function-7fe8439c89afccb77983/output.js | 370 ++++ .../head-432fc3a9a66c90ce2ec2/input.js | 0 .../head-432fc3a9a66c90ce2ec2/output.js | 421 +++++ .../input.js | 0 .../output.js | 399 +++++ .../nested-05a7ce04b1f7eb6da341/input.js | 0 .../nested-05a7ce04b1f7eb6da341/output.js | 370 ++++ .../no-chunk-e2d9573b8d7df68a6cde/input.js | 0 .../no-chunk-e2d9573b8d7df68a6cde/output.js | 554 ++++++ .../no-ssr-9ced90e71a0d75a11cdd/input.js | 0 .../no-ssr-9ced90e71a0d75a11cdd/output.js | 371 +++++ .../input.js | 0 .../output.js | 373 +++++ .../dynamic/ssr-994266264fb6ff57d32c/input.js | 0 .../ssr-994266264fb6ff57d32c/output.js | 370 ++++ .../ssr-true-6d4aa8fc503b9d073aef/input.js | 0 .../ssr-true-6d4aa8fc503b9d073aef/output.js | 371 +++++ .../projects/next/extra/if_return/.3/input.js | 63 + .../next/extra/if_return/.3/output.js | 45 + .../projects/next/extra/if_return/.4/input.js | 106 ++ .../next/extra/if_return/.4/output.js | 98 ++ .../projects/next/extra/if_return/1/input.js | 20 + .../projects/next/extra/if_return/1/output.js | 10 + .../projects/next/extra/if_return/2/input.js | 62 + .../projects/next/extra/if_return/2/output.js | 16 + ecmascript/minifier/tests/golden.txt | 3 + ecmascript/minifier/tests/ignored.txt | 3 - .../tests/projects/output/angular-1.2.5.js | 54 +- .../tests/projects/output/jquery-1.9.1.js | 8 +- .../projects/output/jquery.mobile-1.4.2.js | 136 +- .../tests/projects/output/mootools-1.4.5.js | 13 +- .../tests/projects/output/react-17.0.2.js | 5 +- .../tests/projects/output/react-dom-17.0.2.js | 217 ++- .../tests/projects/output/underscore-1.5.2.js | 3 +- .../tests/projects/output/yui-3.12.0.js | 16 +- .../compress/issue-611/issue_611/output.js | 10 +- .../config.json | 0 .../expected.stdout | 0 .../input.js | 0 .../output.js | 0 ecmascript/minifier/yarn.lock | 549 +++++- package.json | 2 +- .../issue-2011/reduced/output/index.js | 2 +- wasm/Cargo.toml | 2 +- 90 files changed, 5711 insertions(+), 10961 deletions(-) create mode 100644 ecmascript/minifier/examples/perf.rs create mode 100755 ecmascript/minifier/scripts/instrument.sh create mode 100644 ecmascript/minifier/src/compress/pure/if_return.rs create mode 100644 ecmascript/minifier/tests/compress/fixture/issues/vercel/001/input.js create mode 100644 ecmascript/minifier/tests/compress/fixture/issues/vercel/001/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js delete mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/266-aee26c928109d49d6151/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/266-aee26c928109d49d6151/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/framework-054ead69ea8124b4cb27/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/framework-054ead69ea8124b4cb27/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/main-2953d6142ff4a439dbc0/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/main-2953d6142ff4a439dbc0/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/polyfills-6437a4964f697e5b0b3e/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/polyfills-6437a4964f697e5b0b3e/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/webpack-eb940a9a97802b481f9b/input.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => .archive-4}/webpack-eb940a9a97802b481f9b/output.js (100%) rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/chunkfilename-b114cf1d23876beaa712/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/function-7fe8439c89afccb77983/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/head-432fc3a9a66c90ce2ec2/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/nested-05a7ce04b1f7eb6da341/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/ssr-994266264fb6ff57d32c/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js rename ecmascript/minifier/tests/compress/fixture/projects/next/{.archive-3 => archive-3}/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/input.js (100%) create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/input.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/output.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/input.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/output.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/input.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/output.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/input.js create mode 100644 ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/output.js rename ecmascript/minifier/tests/terser/compress/logical-assignment/{assignment_in_left_part => .assignment_in_left_part}/config.json (100%) rename ecmascript/minifier/tests/terser/compress/logical-assignment/{assignment_in_left_part => .assignment_in_left_part}/expected.stdout (100%) rename ecmascript/minifier/tests/terser/compress/logical-assignment/{assignment_in_left_part => .assignment_in_left_part}/input.js (100%) rename ecmascript/minifier/tests/terser/compress/logical-assignment/{assignment_in_left_part => .assignment_in_left_part}/output.js (100%) diff --git a/Cargo.lock b/Cargo.lock index 0675ecebe17..ec36fcf4e67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2629,7 +2629,7 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.27.2" +version = "0.27.3" dependencies = [ "ansi_term 0.12.1", "anyhow", @@ -3401,7 +3401,7 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm" -version = "1.2.87" +version = "1.2.88" dependencies = [ "anyhow", "console_error_panic_hook", diff --git a/ecmascript/minifier/Cargo.toml b/ecmascript/minifier/Cargo.toml index 4f20f24b03b..7a6a80c4e92 100644 --- a/ecmascript/minifier/Cargo.toml +++ b/ecmascript/minifier/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"] license = "Apache-2.0/MIT" name = "swc_ecma_minifier" repository = "https://github.com/swc-project/swc.git" -version = "0.27.2" +version = "0.27.3" [features] debug = [] diff --git a/ecmascript/minifier/examples/perf.rs b/ecmascript/minifier/examples/perf.rs new file mode 100644 index 00000000000..989fd9e12be --- /dev/null +++ b/ecmascript/minifier/examples/perf.rs @@ -0,0 +1,85 @@ +use std::{env::args, path::Path}; +use swc_common::{input::SourceFileInput, sync::Lrc, Mark, SourceMap}; +use swc_ecma_codegen::text_writer::JsWriter; +use swc_ecma_minifier::{ + optimize, + option::{ExtraOptions, MinifyOptions}, +}; +use swc_ecma_parser::{lexer::Lexer, Parser}; +use swc_ecma_transforms::{ + fixer, + hygiene::{self, hygiene_with_config}, + resolver_with_mark, +}; +use swc_ecma_visit::FoldWith; + +fn main() { + let file = args().nth(1).expect("should provide a path to file"); + + eprintln!("File: {}", file); + + testing::run_test2(false, |cm, handler| { + let fm = cm.load_file(Path::new(&file)).expect("failed to load file"); + + let top_level_mark = Mark::fresh(Mark::root()); + + let lexer = Lexer::new( + Default::default(), + Default::default(), + SourceFileInput::from(&*fm), + None, + ); + + let mut parser = Parser::new_from(lexer); + let program = parser + .parse_module() + .map_err(|err| { + err.into_diagnostic(&handler).emit(); + }) + .map(|module| module.fold_with(&mut resolver_with_mark(top_level_mark))) + .unwrap(); + + let output = optimize( + program, + cm.clone(), + None, + None, + &MinifyOptions { + compress: Some(Default::default()), + mangle: Some(Default::default()), + ..Default::default() + }, + &ExtraOptions { top_level_mark }, + ); + + let output = output + .fold_with(&mut hygiene_with_config(hygiene::Config { + ..Default::default() + })) + .fold_with(&mut fixer(None)); + + print(cm.clone(), &[output], true); + + Ok(()) + }) + .unwrap(); +} + +fn print(cm: Lrc, nodes: &[N], minify: bool) -> String { + let mut buf = vec![]; + + { + let mut emitter = swc_ecma_codegen::Emitter { + cfg: swc_ecma_codegen::Config { minify }, + cm: cm.clone(), + comments: None, + wr: Box::new(JsWriter::new(cm.clone(), "\n", &mut buf, None)), + }; + + for n in nodes { + n.emit_with(&mut emitter).unwrap(); + } + } + + String::from_utf8(buf).unwrap() +} diff --git a/ecmascript/minifier/package.json b/ecmascript/minifier/package.json index a90760e5172..454aac2d229 100644 --- a/ecmascript/minifier/package.json +++ b/ecmascript/minifier/package.json @@ -14,6 +14,7 @@ "author": "", "license": "ISC", "devDependencies": { + "antd": "^4.16.13", "babel-eslint": "^10.1.0", "eslint": "^7.29.0" } diff --git a/ecmascript/minifier/scripts/instrument.sh b/ecmascript/minifier/scripts/instrument.sh new file mode 100755 index 00000000000..5f097676fff --- /dev/null +++ b/ecmascript/minifier/scripts/instrument.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eu + +cargo instruments --release -t time --open --features log/release_max_level_off --example perf -- $@ \ No newline at end of file diff --git a/ecmascript/minifier/src/analyzer/mod.rs b/ecmascript/minifier/src/analyzer/mod.rs index 461bfc0a182..fce3e747301 100644 --- a/ecmascript/minifier/src/analyzer/mod.rs +++ b/ecmascript/minifier/src/analyzer/mod.rs @@ -131,9 +131,6 @@ pub(crate) enum ScopeKind { pub(crate) struct ScopeData { pub has_with_stmt: bool, pub has_eval_call: bool, - - /// Variables declared in the scope. - pub declared_symbols: FxHashMap>, } /// Analyzed info of a whole program we are working on. diff --git a/ecmascript/minifier/src/analyzer/storage/normal.rs b/ecmascript/minifier/src/analyzer/storage/normal.rs index 2bb616abdbe..10680afb3dc 100644 --- a/ecmascript/minifier/src/analyzer/storage/normal.rs +++ b/ecmascript/minifier/src/analyzer/storage/normal.rs @@ -144,22 +144,11 @@ impl Storage for ProgramData { } impl ScopeDataLike for ScopeData { - fn add_declared_symbol(&mut self, i: &Ident) { - self.declared_symbols - .entry(i.sym.clone()) - .or_default() - .insert(i.span.ctxt); - } + fn add_declared_symbol(&mut self, _: &Ident) {} - fn merge(&mut self, other: Self, is_child: bool) { + fn merge(&mut self, other: Self, _: bool) { self.has_with_stmt |= other.has_with_stmt; self.has_eval_call |= other.has_eval_call; - - if !is_child { - for (k, v) in other.declared_symbols { - self.declared_symbols.entry(k).or_default().extend(v); - } - } } fn mark_eval_called(&mut self) { diff --git a/ecmascript/minifier/src/compress/mod.rs b/ecmascript/minifier/src/compress/mod.rs index 95986dc9187..bb718a8c1c1 100644 --- a/ecmascript/minifier/src/compress/mod.rs +++ b/ecmascript/minifier/src/compress/mod.rs @@ -314,6 +314,11 @@ where end_time - start_time, self.pass ); + + if cfg!(feature = "debug") && visitor.changed() { + let start = n.dump(); + log::debug!("===== After pure =====\n{}", start); + } } } diff --git a/ecmascript/minifier/src/compress/optimize/if_return.rs b/ecmascript/minifier/src/compress/optimize/if_return.rs index a7082a49ec9..1a4b52da947 100644 --- a/ecmascript/minifier/src/compress/optimize/if_return.rs +++ b/ecmascript/minifier/src/compress/optimize/if_return.rs @@ -16,104 +16,6 @@ impl Optimizer<'_, M> where M: Mode, { - /// # Input - /// - /// ```js - /// function f(a, b) { - /// if (a) return; - /// console.log(b); - /// } - /// ``` - /// - /// # Output - /// ```js - /// function f(a, b) { - /// if (!a) - /// console.log(b); - /// } - /// ``` - pub(super) fn negate_if_terminate( - &mut self, - stmts: &mut Vec, - handle_return: bool, - handle_continue: bool, - ) { - if handle_return { - if !self.options.if_return || !self.options.bools { - return; - } - - if stmts.len() == 1 { - for s in stmts.iter_mut() { - match s { - Stmt::If(s) => match &mut *s.cons { - Stmt::Block(cons) => { - self.negate_if_terminate(&mut cons.stmts, true, false); - } - _ => {} - }, - _ => {} - } - } - } - } - - let len = stmts.len(); - - let pos_of_if = stmts.iter().enumerate().rposition(|(idx, s)| { - idx != len - 1 - && match s { - Stmt::If(IfStmt { - cons, alt: None, .. - }) => match &**cons { - Stmt::Return(ReturnStmt { arg: None, .. }) => handle_return, - - Stmt::Continue(ContinueStmt { label: None, .. }) => handle_continue, - _ => false, - }, - _ => false, - } - }); - - let pos_of_if = match pos_of_if { - Some(v) => v, - _ => return, - }; - - self.changed = true; - log::debug!( - "if_return: Negating `foo` in `if (foo) return; bar()` to make it `if (!foo) bar()`" - ); - - let mut new = vec![]; - new.extend(stmts.drain(..pos_of_if)); - let cons = stmts.drain(1..).collect::>(); - - let if_stmt = stmts.take().into_iter().next().unwrap(); - match if_stmt { - Stmt::If(mut s) => { - assert_eq!(s.alt, None); - self.negate(&mut s.test); - - s.cons = if cons.len() == 1 { - Box::new(cons.into_iter().next().unwrap()) - } else { - Box::new(Stmt::Block(BlockStmt { - span: DUMMY_SP, - stmts: cons, - })) - }; - - new.push(Stmt::If(s)) - } - _ => { - unreachable!() - } - } - - *stmts = new; - } - pub(super) fn merge_nested_if(&mut self, s: &mut IfStmt) { if !self.options.conditionals && !self.options.bools { return; @@ -221,7 +123,7 @@ where } fn merge_nested_if_returns(&mut self, s: &mut Stmt, can_work: bool) { - let terminate = always_terminates(&*s); + let terminate = can_merge_as_if_return(&*s); match s { Stmt::Block(s) => { @@ -285,14 +187,37 @@ where }); let skip = idx_of_not_mergable.map(|v| v + 1).unwrap_or(0); log::trace!("if_return: Skip = {}", skip); + let mut last_idx = stmts.len() - 1; - if stmts.len() <= skip + 1 { + { + loop { + let s = stmts.get(last_idx); + let s = match s { + Some(s) => s, + _ => break, + }; + + match s { + Stmt::Decl(Decl::Var(v)) => { + if v.decls.iter().all(|v| v.init.is_none()) { + last_idx -= 1; + continue; + } + } + _ => {} + } + + break; + } + } + + if last_idx <= skip { log::trace!("if_return: [x] Aborting because of skip"); return; } { - let stmts = &stmts[skip..]; + let stmts = &stmts[skip..=last_idx]; let return_count: usize = stmts.iter().map(|v| count_leaping_returns(v)).sum(); // There's no return statment so merging requires injecting unnecessary `void 0` @@ -351,6 +276,7 @@ where } { + let stmts = &stmts[..=last_idx]; let start = stmts .iter() .enumerate() @@ -414,6 +340,10 @@ where continue; } } + if idx > last_idx { + new.push(stmt); + continue; + } let stmt = if !self.can_merge_stmt_as_if_return(&stmt, len - 1 == idx) { debug_assert_eq!(cur, None); @@ -663,3 +593,54 @@ fn always_terminates_with_return_arg(s: &Stmt) -> bool { _ => false, } } + +fn can_merge_as_if_return(s: &Stmt) -> bool { + fn cost(s: &Stmt) -> Option { + match s { + Stmt::Block(..) => { + if !always_terminates(s) { + return None; + } + } + _ => {} + } + + match s { + Stmt::Return(ReturnStmt { arg: Some(..), .. }) => Some(-1), + + Stmt::Return(ReturnStmt { arg: None, .. }) => Some(0), + + Stmt::Throw(..) | Stmt::Break(..) | Stmt::Continue(..) => Some(0), + + Stmt::If(IfStmt { cons, alt, .. }) => { + Some(cost(&cons)? + alt.as_deref().and_then(cost).unwrap_or(0)) + } + Stmt::Block(s) => { + let mut sum = 0; + let mut found = false; + for s in s.stmts.iter().rev() { + let c = cost(s); + if let Some(c) = c { + found = true; + sum += c; + } + } + if found { + Some(sum) + } else { + None + } + } + + _ => None, + } + } + + let c = cost(s); + + if cfg!(feature = "debug") { + log::trace!("merging cost of `{}` = {:?}", dump(s), c); + } + + c.unwrap_or(0) < 0 +} diff --git a/ecmascript/minifier/src/compress/optimize/mod.rs b/ecmascript/minifier/src/compress/optimize/mod.rs index 0b20b9577e6..73148be02e8 100644 --- a/ecmascript/minifier/src/compress/optimize/mod.rs +++ b/ecmascript/minifier/src/compress/optimize/mod.rs @@ -1161,7 +1161,7 @@ where if s.value.contains(|c: char| !c.is_ascii()) { return true; } - if s.value.contains("\\\0") || s.value.contains("//") { + if s.value.contains("\\\0") || s.value.contains("/") { return true; } @@ -1842,13 +1842,6 @@ where n.left.visit_mut_with(&mut *self.with_ctx(ctx)); n.body.visit_mut_with(self); - - match &mut *n.body { - Stmt::Block(body) => { - self.negate_if_terminate(&mut body.stmts, false, true); - } - _ => {} - } } fn visit_mut_for_of_stmt(&mut self, n: &mut ForOfStmt) { @@ -1861,13 +1854,6 @@ where n.left.visit_mut_with(&mut *self.with_ctx(ctx)); n.body.visit_mut_with(self); - - match &mut *n.body { - Stmt::Block(body) => { - self.negate_if_terminate(&mut body.stmts, false, true); - } - _ => {} - } } fn visit_mut_for_stmt(&mut self, s: &mut ForStmt) { @@ -1881,13 +1867,6 @@ where self.with_ctx(ctx).optimize_init_of_for_stmt(s); self.with_ctx(ctx).drop_if_break(s); - - match &mut *s.body { - Stmt::Block(body) => { - self.negate_if_terminate(&mut body.stmts, false, true); - } - _ => {} - } } fn visit_mut_function(&mut self, n: &mut Function) { @@ -1925,8 +1904,6 @@ where Some(body) => { // Bypass block scope handler. body.visit_mut_children_with(optimizer); - - optimizer.negate_if_terminate(&mut body.stmts, true, false); } None => {} } diff --git a/ecmascript/minifier/src/compress/optimize/sequences.rs b/ecmascript/minifier/src/compress/optimize/sequences.rs index f17501cccf3..e4dded80e6d 100644 --- a/ecmascript/minifier/src/compress/optimize/sequences.rs +++ b/ecmascript/minifier/src/compress/optimize/sequences.rs @@ -81,7 +81,7 @@ where | Stmt::If(..) | Stmt::Switch(..) | Stmt::With(..) - | Stmt::Return(ReturnStmt { .. }) + | Stmt::Return(ReturnStmt { arg: Some(..), .. }) | Stmt::Throw(ThrowStmt { .. }) | Stmt::For(ForStmt { init: None, .. }) | Stmt::For(ForStmt { @@ -171,7 +171,7 @@ where new_stmts.push(T::from_stmt(Stmt::With(stmt))); } - Stmt::Return(mut stmt) => { + Stmt::Return(mut stmt @ ReturnStmt { arg: Some(..), .. }) => { match stmt.arg.as_deref_mut() { Some(e) => { e.prepend_exprs(take(&mut exprs)); diff --git a/ecmascript/minifier/src/compress/pure/if_return.rs b/ecmascript/minifier/src/compress/pure/if_return.rs new file mode 100644 index 00000000000..65964a8f416 --- /dev/null +++ b/ecmascript/minifier/src/compress/pure/if_return.rs @@ -0,0 +1,106 @@ +use crate::compress::util::negate; + +use super::Pure; +use swc_common::{util::take::Take, DUMMY_SP}; +use swc_ecma_ast::*; + +impl Pure<'_, M> { + /// # Input + /// + /// ```js + /// function f(a, b) { + /// if (a) return; + /// console.log(b); + /// } + /// ``` + /// + /// # Output + /// ```js + /// function f(a, b) { + /// if (!a) + /// console.log(b); + /// } + /// ``` + pub(super) fn negate_if_terminate( + &mut self, + stmts: &mut Vec, + handle_return: bool, + handle_continue: bool, + ) { + if handle_return { + if !self.options.if_return || !self.options.bools { + return; + } + + if stmts.len() == 1 { + for s in stmts.iter_mut() { + match s { + Stmt::If(s) => match &mut *s.cons { + Stmt::Block(cons) => { + self.negate_if_terminate(&mut cons.stmts, true, false); + } + _ => {} + }, + _ => {} + } + } + } + } + + let len = stmts.len(); + + let pos_of_if = stmts.iter().enumerate().rposition(|(idx, s)| { + idx != len - 1 + && match s { + Stmt::If(IfStmt { + cons, alt: None, .. + }) => match &**cons { + Stmt::Return(ReturnStmt { arg: None, .. }) => handle_return, + + Stmt::Continue(ContinueStmt { label: None, .. }) => handle_continue, + _ => false, + }, + _ => false, + } + }); + + let pos_of_if = match pos_of_if { + Some(v) => v, + _ => return, + }; + + self.changed = true; + log::debug!( + "if_return: Negating `foo` in `if (foo) return; bar()` to make it `if (!foo) bar()`" + ); + + let mut new = vec![]; + new.extend(stmts.drain(..pos_of_if)); + let cons = stmts.drain(1..).collect::>(); + + let if_stmt = stmts.take().into_iter().next().unwrap(); + match if_stmt { + Stmt::If(mut s) => { + assert_eq!(s.alt, None); + self.changed = true; + negate(&mut s.test, false); + + s.cons = if cons.len() == 1 { + Box::new(cons.into_iter().next().unwrap()) + } else { + Box::new(Stmt::Block(BlockStmt { + span: DUMMY_SP, + stmts: cons, + })) + }; + + new.push(Stmt::If(s)) + } + _ => { + unreachable!() + } + } + + *stmts = new; + } +} diff --git a/ecmascript/minifier/src/compress/pure/misc.rs b/ecmascript/minifier/src/compress/pure/misc.rs index e81c309dc5a..790856bd938 100644 --- a/ecmascript/minifier/src/compress/pure/misc.rs +++ b/ecmascript/minifier/src/compress/pure/misc.rs @@ -34,6 +34,26 @@ where fn drop_return_value(&mut self, stmts: &mut Vec) -> bool { // TODO(kdy1): (maybe) run optimization again if it's removed. + for s in stmts.iter_mut() { + match s { + Stmt::Return(ReturnStmt { + arg: arg @ Some(..), + .. + }) => { + self.ignore_return_value(arg.as_deref_mut().unwrap()); + + match arg.as_deref() { + Some(Expr::Invalid(..)) => { + *arg = None; + } + + _ => {} + } + } + _ => {} + } + } + if let Some(last) = stmts.last_mut() { self.drop_return_value_of_stmt(last) } else { @@ -46,6 +66,11 @@ where match s { Stmt::Block(s) => self.drop_return_value(&mut s.stmts), Stmt::Return(ret) => { + self.changed = true; + if cfg!(feature = "debug") { + log::trace!("Dropping `return` token"); + } + let span = ret.span; match ret.arg.take() { Some(arg) => { @@ -72,19 +97,19 @@ where } Stmt::Try(s) => { - let a = self.drop_return_value(&mut s.block.stmts); + let a = if s.finalizer.is_none() { + self.drop_return_value(&mut s.block.stmts) + } else { + false + }; + let b = s - .handler - .as_mut() - .map(|c| self.drop_return_value(&mut c.body.stmts)) - .unwrap_or_default(); - let c = s .finalizer .as_mut() .map(|s| self.drop_return_value(&mut s.stmts)) .unwrap_or_default(); - a || b || c + a || b } _ => false, @@ -93,6 +118,13 @@ where pub(super) fn ignore_return_value(&mut self, e: &mut Expr) { match e { + Expr::Seq(e) => { + if let Some(last) = e.exprs.last_mut() { + // Non-last elements are already processed. + self.ignore_return_value(&mut **last); + } + } + Expr::Call(CallExpr { callee: ExprOrSuper::Expr(callee), .. diff --git a/ecmascript/minifier/src/compress/pure/mod.rs b/ecmascript/minifier/src/compress/pure/mod.rs index 931fbd837b7..d2a26bfdc8e 100644 --- a/ecmascript/minifier/src/compress/pure/mod.rs +++ b/ecmascript/minifier/src/compress/pure/mod.rs @@ -3,7 +3,7 @@ use crate::{ marks::Marks, mode::Mode, option::CompressOptions, util::MoudleItemExt, MAX_PAR_DEPTH, }; use rayon::prelude::*; -use swc_common::{pass::Repeated, DUMMY_SP}; +use swc_common::{pass::Repeated, util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith}; @@ -13,6 +13,7 @@ mod conds; mod ctx; mod dead_code; mod evaluate; +mod if_return; mod loops; mod misc; mod numbers; @@ -196,6 +197,10 @@ where *e = Expr::Invalid(Invalid { span: DUMMY_SP }); return; } + if seq.exprs.len() == 1 { + self.changed = true; + *e = *seq.exprs.take().into_iter().next().unwrap(); + } } _ => {} } @@ -253,6 +258,36 @@ where self.visit_par(exprs); } + fn visit_mut_for_in_stmt(&mut self, n: &mut ForInStmt) { + n.right.visit_mut_with(self); + + n.left.visit_mut_with(self); + + n.body.visit_mut_with(self); + + match &mut *n.body { + Stmt::Block(body) => { + self.negate_if_terminate(&mut body.stmts, false, true); + } + _ => {} + } + } + + fn visit_mut_for_of_stmt(&mut self, n: &mut ForOfStmt) { + n.right.visit_mut_with(self); + + n.left.visit_mut_with(self); + + n.body.visit_mut_with(self); + + match &mut *n.body { + Stmt::Block(body) => { + self.negate_if_terminate(&mut body.stmts, false, true); + } + _ => {} + } + } + fn visit_mut_for_stmt(&mut self, s: &mut ForStmt) { s.visit_mut_children_with(self); @@ -261,6 +296,13 @@ where if let Some(test) = &mut s.test { self.optimize_expr_in_bool_ctx(&mut **test); } + + match &mut *s.body { + Stmt::Block(body) => { + self.negate_if_terminate(&mut body.stmts, false, true); + } + _ => {} + } } fn visit_mut_function(&mut self, f: &mut Function) { @@ -275,6 +317,8 @@ where if let Some(body) = &mut f.body { self.remove_useless_return(&mut body.stmts); + self.negate_if_terminate(&mut body.stmts, true, false); + if let Some(last) = body.stmts.last_mut() { self.drop_unused_stmt_at_end_of_fn(last); } @@ -342,9 +386,24 @@ where fn visit_mut_seq_expr(&mut self, e: &mut SeqExpr) { e.visit_mut_children_with(self); + if e.exprs.len() == 0 { + return; + } + self.drop_useless_ident_ref_in_seq(e); self.merge_seq_call(e); + + let len = e.exprs.len(); + for (idx, e) in e.exprs.iter_mut().enumerate() { + let is_last = idx == len - 1; + + if !is_last { + self.ignore_return_value(&mut **e); + } + } + + e.exprs.retain(|e| !e.is_invalid()); } fn visit_mut_stmt(&mut self, s: &mut Stmt) { @@ -372,6 +431,15 @@ where } self.loop_to_for_stmt(s); + + match s { + Stmt::Expr(es) => { + if es.expr.is_invalid() { + *s = Stmt::Empty(EmptyStmt { span: DUMMY_SP }); + } + } + _ => {} + } } fn visit_mut_stmts(&mut self, items: &mut Vec) { diff --git a/ecmascript/minifier/src/compress/pure/vars.rs b/ecmascript/minifier/src/compress/pure/vars.rs index a450aad80d7..9d1ddbf370d 100644 --- a/ecmascript/minifier/src/compress/pure/vars.rs +++ b/ecmascript/minifier/src/compress/pure/vars.rs @@ -27,38 +27,46 @@ where } { - // let mut found_other = false; - // let mut need_work = false; + let mut found_other = false; + let mut need_work = false; - // for stmt in &*stmts { - // match stmt.as_stmt() { - // Some(Stmt::Decl(Decl::Var( - // v - // @ - // VarDecl { - // kind: VarDeclKind::Var, - // .. - // }, - // ))) => { - // if v.decls.iter().any(|v| v.init.is_none()) { - // if found_other { - // need_work = true; - // } - // } else { - // found_other = true; - // } - // } + for stmt in &*stmts { + match stmt.as_stmt() { + Some(Stmt::Decl(Decl::Var( + v + @ + VarDecl { + kind: VarDeclKind::Var, + .. + }, + ))) => { + if v.decls.iter().all(|v| v.init.is_none()) { + if found_other { + need_work = true; + } + } else { + found_other = true; + } + } - // _ => { - // found_other = true; - // } - // } - // } + // Directives + Some(Stmt::Expr(s)) => match &*s.expr { + Expr::Lit(Lit::Str(..)) => {} + _ => { + found_other = true; + } + }, + + _ => { + found_other = true; + } + } + } // Check for nested variable declartions. let mut v = VarWithOutInitCounter::default(); stmts.visit_with(&Invalid { span: DUMMY_SP }, &mut v); - if !v.need_work { + if !need_work && !v.need_work { return; } } diff --git a/ecmascript/minifier/tests/compress/fixture/issues/vercel/001/input.js b/ecmascript/minifier/tests/compress/fixture/issues/vercel/001/input.js new file mode 100644 index 00000000000..40e7ee7895a --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/issues/vercel/001/input.js @@ -0,0 +1 @@ +const re = new RegExp('^/(?!_next).*$') \ No newline at end of file diff --git a/ecmascript/minifier/tests/compress/fixture/issues/vercel/001/output.js b/ecmascript/minifier/tests/compress/fixture/issues/vercel/001/output.js new file mode 100644 index 00000000000..0bcdc4f67a3 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/issues/vercel/001/output.js @@ -0,0 +1 @@ +const re = new RegExp("^/(?!_next).*$"); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/mootools/7/output.js b/ecmascript/minifier/tests/compress/fixture/projects/mootools/7/output.js index 5e73e21e55e..f9ceaaddf3b 100644 --- a/ecmascript/minifier/tests/compress/fixture/projects/mootools/7/output.js +++ b/ecmascript/minifier/tests/compress/fixture/projects/mootools/7/output.js @@ -2,13 +2,12 @@ export const exported = { toQueryString: function(object, base) { var queryString = []; return Object.each(object, function(value, key) { - var result; switch(base && (key = base + "[" + key + "]"), typeOf(value)){ case "object": result = Object.toQueryString(value, key); break; case "array": - var qs = { + var result, qs = { }; value.each(function(val, i) { qs[i] = val; diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js deleted file mode 100644 index 1c9c5e479ff..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js +++ /dev/null @@ -1,989 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [403,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 284: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var Hello = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return Promise.all( - [ - __webpack_require__.e( - 774 - ), - __webpack_require__.e( - 689 - ), - ] - ).then( - __webpack_require__.bind( - __webpack_require__, - 4090 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [4090,]; - }, - modules: [ - "dynamic/chunkfilename.js -> ../../components/hello-chunkfilename", - ], - }, - } - ); - __webpack_exports__.default = Hello; - }, - 4196: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/chunkfilename", - function ( - ) { - return __webpack_require__( - 284 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 4196), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js deleted file mode 100644 index 14b4cec7651..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js +++ /dev/null @@ -1,989 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [610,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 1118: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var Hello = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return Promise.all( - [ - __webpack_require__.e( - 774 - ), - __webpack_require__.e( - 974 - ), - ] - ).then( - __webpack_require__.bind( - __webpack_require__, - 6974 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [6974,]; - }, - modules: [ - "dynamic/function.js -> ../../components/hello1", - ], - }, - } - ); - __webpack_exports__.default = Hello; - }, - 6994: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/function", - function ( - ) { - return __webpack_require__( - 1118 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 6994), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js deleted file mode 100644 index cebdff774c6..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js +++ /dev/null @@ -1,1158 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [499,], - { - 6086: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function asyncGeneratorStep( - gen, - resolve, - reject, - _next, - _throw, - key, - arg - ) { - try { - var info = gen[key]( - arg - ), - value = info.value; - } catch (error) { - return void reject( - error - ); - } - info.done - ? resolve( - value - ) - : Promise.resolve( - value - ).then( - _next, - _throw - ); - } - function _asyncToGenerator( - fn - ) { - return function ( - ) { - var self = this, - args = arguments; - return new Promise( - function ( - resolve, reject - ) { - var gen = fn.apply( - self, - args - ); - function _next( - value - ) { - asyncGeneratorStep( - gen, - resolve, - reject, - _next, - _throw, - "next", - value - ); - } - function _throw( - err - ) { - asyncGeneratorStep( - gen, - resolve, - reject, - _next, - _throw, - "throw", - err - ); - } - _next( - void 0 - ); - } - ); - }; - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _asyncToGenerator; - }, - } - ); - }, - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 1804: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var _loader, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = - __webpack_require__( - 7945 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = - __webpack_require__.n( - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ - ), - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = - __webpack_require__( - 4512 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4__ = - __webpack_require__( - 6086 - ), - next_dynamic__WEBPACK_IMPORTED_MODULE_2__ = - __webpack_require__( - 4652 - ), - next_head__WEBPACK_IMPORTED_MODULE_3__ = - __webpack_require__( - 1843 - ), - Test = (0, next_dynamic__WEBPACK_IMPORTED_MODULE_2__.default)( - { - loader: - ((_loader = (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4__.Z)( - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default( - ).mark( - function _callee( - ) { - return _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default( - ).wrap( - function ( - _context - ) { - for (;;) - switch ( - (_context.prev = - _context.next) - ) { - case 0: - return _context.abrupt( - "return", - function ( - ) { - return (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)( - "div", - { - className: - "dynamic-style", - children: - [ - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)( - next_head__WEBPACK_IMPORTED_MODULE_3__.default, - { - children: - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)( - "style", - { - dangerouslySetInnerHTML: - { - __html: "\n .dynamic-style {\n background-color: green;\n height: 200px;\n }\n ", - }, - } - ), - } - ), - "test", - ], - } - ); - } - ); - case 1: - case "end": - return _context.stop( - ); - } - }, - _callee - ); - } - ) - )), - function ( - ) { - return _loader.apply( - this, - arguments - ); - }), - ssr: !1, - } - ); - __webpack_exports__.default = Test; - }, - 2250: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/head", - function ( - ) { - return __webpack_require__( - 1804 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - 1843: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 3396 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 2250), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js deleted file mode 100644 index ccbe4c98f26..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js +++ /dev/null @@ -1,1067 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [594,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 3483: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = - __webpack_require__( - 4512 - ), - next_dynamic__WEBPACK_IMPORTED_MODULE_1__ = - __webpack_require__( - 4652 - ), - Hello = (0, next_dynamic__WEBPACK_IMPORTED_MODULE_1__.default)( - function ( - ) { - return __webpack_require__ - .e( - 358 - ) - .then( - __webpack_require__.bind( - __webpack_require__, - 1901 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [1901,]; - }, - modules: [ - "dynamic/multiple-modules.js -> ../../components/hello3", - ], - }, - } - ); - (0, next_dynamic__WEBPACK_IMPORTED_MODULE_1__.default)( - function ( - ) { - return __webpack_require__ - .e( - 367 - ) - .then( - __webpack_require__.bind( - __webpack_require__, - 4416 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [4416,]; - }, - modules: [ - "dynamic/multiple-modules.js -> ../../components/hello4", - ], - }, - } - ); - __webpack_exports__.default = function ( - ) { - return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)( - "div", - { - children: [ - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Hello, - { - } - ), - ], - } - ); - }; - }, - 5717: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/multiple-modules", - function ( - ) { - return __webpack_require__( - 3483 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 5717), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js deleted file mode 100644 index 75fcf740e9b..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js +++ /dev/null @@ -1,989 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [354,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 5561: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var DynamicComponent = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return Promise.all( - [ - __webpack_require__.e( - 774 - ), - __webpack_require__.e( - 808 - ), - ] - ).then( - __webpack_require__.bind( - __webpack_require__, - 2808 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [2808,]; - }, - modules: [ - "dynamic/nested.js -> ../../components/nested1", - ], - }, - } - ); - __webpack_exports__.default = DynamicComponent; - }, - 4136: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/nested", - function ( - ) { - return __webpack_require__( - 5561 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 4136), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js deleted file mode 100644 index 26966490c62..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js +++ /dev/null @@ -1,1481 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [732,], - { - 2911: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _assertThisInitialized( - self - ) { - if (void 0 === self) - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called" - ); - return self; - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _assertThisInitialized; - }, - } - ); - }, - 8436: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _classCallCheck( - instance, Constructor - ) { - if (!(instance instanceof Constructor)) - throw new TypeError( - "Cannot call a class as a function" - ); - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _classCallCheck; - }, - } - ); - }, - 8370: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _defineProperties( - target, props - ) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - (descriptor.enumerable = descriptor.enumerable || !1), - (descriptor.configurable = !0), - "value" in descriptor && (descriptor.writable = !0), - Object.defineProperty( - target, - descriptor.key, - descriptor - ); - } - } - function _createClass( - Constructor, protoProps, staticProps - ) { - return ( - protoProps && - _defineProperties( - Constructor.prototype, - protoProps - ), - staticProps && _defineProperties( - Constructor, - staticProps - ), - Constructor - ); - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _createClass; - }, - } - ); - }, - 9178: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _defineProperty( - obj, key, value - ) { - return ( - key in obj - ? Object.defineProperty( - obj, - key, - { - value: value, - enumerable: !0, - configurable: !0, - writable: !0, - } - ) - : (obj[key] = value), - obj - ); - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _defineProperty; - }, - } - ); - }, - 2374: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _getPrototypeOf( - o - ) { - return (_getPrototypeOf = Object.setPrototypeOf - ? Object.getPrototypeOf - : function ( - o - ) { - return o.__proto__ || Object.getPrototypeOf( - o - ); - })( - o - ); - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _getPrototypeOf; - }, - } - ); - }, - 3001: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _setPrototypeOf( - o, p - ) { - return (_setPrototypeOf = - Object.setPrototypeOf || - function ( - o, p - ) { - return (o.__proto__ = p), o; - })( - o, - p - ); - } - function _inherits( - subClass, superClass - ) { - if ("function" != typeof superClass && null !== superClass) - throw new TypeError( - "Super expression must either be null or a function" - ); - (subClass.prototype = Object.create( - superClass && superClass.prototype, - { - constructor: { - value: subClass, - writable: !0, - configurable: !0, - }, - } - )), - superClass && _setPrototypeOf( - subClass, - superClass - ); - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _inherits; - }, - } - ); - }, - 7130: function ( - __unused_webpack___webpack_module__, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - function _typeof( - obj - ) { - return (_typeof = - "function" == typeof Symbol && - "symbol" == typeof Symbol.iterator - ? function ( - obj - ) { - return typeof obj; - } - : function ( - obj - ) { - return obj && - "function" == typeof Symbol && - obj.constructor === Symbol && - obj !== Symbol.prototype - ? "symbol" - : typeof obj; - })( - obj - ); - } - __webpack_require__.d( - __webpack_exports__, - { - Z: function ( - ) { - return _possibleConstructorReturn; - }, - } - ); - var assertThisInitialized = __webpack_require__( - 2911 - ); - function _possibleConstructorReturn( - self, call - ) { - return !call || - ("object" !== _typeof( - call - ) && "function" != typeof call) - ? (0, assertThisInitialized.Z)( - self - ) - : call; - } - }, - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 9087: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ), - __webpack_require__.d( - __webpack_exports__, - { - default: function ( - ) { - return Welcome; - }, - } - ); - var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = - __webpack_require__( - 4512 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__ = - __webpack_require__( - 8436 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_8__ = - __webpack_require__( - 8370 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_7__ = - __webpack_require__( - 2911 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = - __webpack_require__( - 3001 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = - __webpack_require__( - 7130 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__ = - __webpack_require__( - 2374 - ), - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = - __webpack_require__( - 9178 - ); - function _createSuper( - Derived - ) { - var hasNativeReflectConstruct = (function ( - ) { - if ("undefined" == typeof Reflect || !Reflect.construct) - return !1; - if (Reflect.construct.sham) return !1; - if ("function" == typeof Proxy) return !0; - try { - return ( - Date.prototype.toString.call( - Reflect.construct( - Date, - [], - function ( - ) {} - ) - ), - !0 - ); - } catch (e) { - return !1; - } - })( - ); - return function ( - ) { - var result, - Super = (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__.Z)( - Derived - ); - if (hasNativeReflectConstruct) { - var NewTarget = (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__.Z)( - this - ).constructor; - result = Reflect.construct( - Super, - arguments, - NewTarget - ); - } else result = Super.apply( - this, - arguments - ); - return (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__.Z)( - this, - result - ); - }; - } - var Welcome = (function ( - _React$Component - ) { - (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__.Z)( - Welcome, - _React$Component - ); - var _super = _createSuper( - Welcome - ); - function Welcome( - ) { - var _this; - (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__.Z)( - this, - Welcome - ); - for ( - var _len = arguments.length, - args = new Array( - _len - ), - _key = 0; - _key < _len; - _key++ - ) - args[_key] = arguments[_key]; - return ( - (_this = _super.call.apply( - _super, - [this,].concat( - args - ) - )), - (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__.Z)( - (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_7__.Z)( - _this - ), - "state", - { - name: null, - } - ), - _this - ); - } - return ( - (0, - _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_8__.Z)( - Welcome, - [ - { - key: "componentDidMount", - value: function ( - ) { - var name = this.props.name; - this.setState( - { - name: name, - } - ); - }, - }, - { - key: "render", - value: function ( - ) { - var name = this.state.name; - return name - ? (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)( - "p", - { - children: ["Welcome, ", name,], - } - ) - : null; - }, - }, - ] - ), - Welcome - ); - })( - __webpack_require__( - 2735 - ).Component - ); - }, - 8837: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = - __webpack_require__( - 4512 - ), - next_dynamic__WEBPACK_IMPORTED_MODULE_1__ = - __webpack_require__( - 4652 - ), - _components_welcome__WEBPACK_IMPORTED_MODULE_2__ = - __webpack_require__( - 9087 - ), - Welcome2 = (0, - next_dynamic__WEBPACK_IMPORTED_MODULE_1__.default)( - function ( - ) { - return Promise.resolve( - ).then( - __webpack_require__.bind( - __webpack_require__, - 9087 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [9087,]; - }, - modules: [ - "dynamic/no-chunk.js -> ../../components/welcome", - ], - }, - } - ); - __webpack_exports__.default = function ( - ) { - return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)( - "div", - { - children: [ - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - _components_welcome__WEBPACK_IMPORTED_MODULE_2__.default, - { - name: "normal", - } - ), - (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - Welcome2, - { - name: "dynamic", - } - ), - ], - } - ); - }; - }, - 5279: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/no-chunk", - function ( - ) { - return __webpack_require__( - 8837 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 5279), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js deleted file mode 100644 index f10edd2e8aa..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js +++ /dev/null @@ -1,990 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [374,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 6318: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var Hello = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return Promise.all( - [ - __webpack_require__.e( - 774 - ), - __webpack_require__.e( - 974 - ), - ] - ).then( - __webpack_require__.bind( - __webpack_require__, - 6974 - ) - ); - }, - { - ssr: !1, - loadableGenerated: { - webpack: function ( - ) { - return [6974,]; - }, - modules: [ - "dynamic/no-ssr.js -> ../../components/hello1", - ], - }, - } - ); - __webpack_exports__.default = Hello; - }, - 8996: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/no-ssr", - function ( - ) { - return __webpack_require__( - 6318 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 8996), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js deleted file mode 100644 index 41bfcecafe2..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js +++ /dev/null @@ -1,999 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [618,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 6502: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = - __webpack_require__( - 4512 - ), - Hello = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return __webpack_require__ - .e( - 916 - ) - .then( - __webpack_require__.bind( - __webpack_require__, - 6974 - ) - ); - }, - { - ssr: !1, - loading: function ( - ) { - return (0, - react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)( - "p", - { - children: "LOADING", - } - ); - }, - loadableGenerated: { - webpack: function ( - ) { - return [6974,]; - }, - modules: [ - "dynamic/no-ssr-custom-loading.js -> ../../components/hello1", - ], - }, - } - ); - __webpack_exports__.default = Hello; - }, - 6637: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/no-ssr-custom-loading", - function ( - ) { - return __webpack_require__( - 6502 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 6637), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js deleted file mode 100644 index cc5ada59940..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js +++ /dev/null @@ -1,987 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [985,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 8584: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var Hello = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return Promise.all( - [ - __webpack_require__.e( - 774 - ), - __webpack_require__.e( - 974 - ), - ] - ).then( - __webpack_require__.bind( - __webpack_require__, - 6974 - ) - ); - }, - { - loadableGenerated: { - webpack: function ( - ) { - return [6974,]; - }, - modules: ["dynamic/ssr.js -> ../../components/hello1",], - }, - } - ); - __webpack_exports__.default = Hello; - }, - 5006: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/ssr", - function ( - ) { - return __webpack_require__( - 8584 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 5006), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js deleted file mode 100644 index 00fe9d6d8ca..00000000000 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js +++ /dev/null @@ -1,990 +0,0 @@ -(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push( - [ - [14,], - { - 8551: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - exports.default = function ( - dynamicOptions, options - ) { - var loadableFn = _loadable.default, - loadableOptions = { - loading: function ( - _ref - ) { - _ref.error, _ref.isLoading; - return _ref.pastDelay, null; - }, - }; - dynamicOptions instanceof Promise - ? (loadableOptions.loader = function ( - ) { - return dynamicOptions; - }) - : "function" == typeof dynamicOptions - ? (loadableOptions.loader = dynamicOptions) - : "object" == typeof dynamicOptions && - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - dynamicOptions - )); - (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - options - )).loadableGenerated && - delete (loadableOptions = _objectSpread( - _objectSpread( - { - }, - loadableOptions - ), - loadableOptions.loadableGenerated - )).loadableGenerated; - if ("boolean" == typeof loadableOptions.ssr) { - if (!loadableOptions.ssr) - return ( - delete loadableOptions.ssr, - noSSR( - loadableFn, - loadableOptions - ) - ); - delete loadableOptions.ssr; - } - return loadableFn( - loadableOptions - ); - }; - _interopRequireDefault( - __webpack_require__( - 2735 - ) - ); - var _loadable = _interopRequireDefault( - __webpack_require__( - 880 - ) - ); - function _interopRequireDefault( - obj - ) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; - } - function noSSR( - LoadableInitializer, loadableOptions - ) { - return ( - delete loadableOptions.webpack, - delete loadableOptions.modules, - LoadableInitializer( - loadableOptions - ) - ); - } - }, - 8183: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var obj; - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.LoadableContext = void 0); - var LoadableContext = ( - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - } - ).default.createContext( - null - ); - exports.LoadableContext = LoadableContext; - }, - 880: function ( - __unused_webpack_module, exports, __webpack_require__ - ) { - "use strict"; - var _defineProperty = __webpack_require__( - 566 - ), - _classCallCheck = __webpack_require__( - 4988 - ), - _createClass = __webpack_require__( - 9590 - ); - function ownKeys( - object, enumerableOnly - ) { - var keys = Object.keys( - object - ); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols( - object - ); - enumerableOnly && - (symbols = symbols.filter( - function ( - sym - ) { - return Object.getOwnPropertyDescriptor( - object, - sym - ).enumerable; - } - )), - keys.push.apply( - keys, - symbols - ); - } - return keys; - } - function _objectSpread( - target - ) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] - ? arguments[i] - : { - }; - i % 2 - ? ownKeys( - Object( - source - ), - !0 - ).forEach( - function ( - key - ) { - _defineProperty( - target, - key, - source[key] - ); - } - ) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties( - target, - Object.getOwnPropertyDescriptors( - source - ) - ) - : ownKeys( - Object( - source - ) - ).forEach( - function ( - key - ) { - Object.defineProperty( - target, - key, - Object.getOwnPropertyDescriptor( - source, - key - ) - ); - } - ); - } - return target; - } - function _createForOfIteratorHelper( - o, allowArrayLike - ) { - var it; - if ( - "undefined" == typeof Symbol || - null == o[Symbol.iterator] - ) { - if ( - Array.isArray( - o - ) || - (it = (function ( - o, minLen - ) { - if (!o) return; - if ("string" == typeof o) - return _arrayLikeToArray( - o, - minLen - ); - var n = Object.prototype.toString - .call( - o - ) - .slice( - 8, - -1 - ); - "Object" === n && - o.constructor && - (n = o.constructor.name); - if ("Map" === n || "Set" === n) - return Array.from( - o - ); - if ( - "Arguments" === n || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( - n - ) - ) - return _arrayLikeToArray( - o, - minLen - ); - })( - o - )) || - (allowArrayLike && o && "number" == typeof o.length) - ) { - it && (o = it); - var i = 0, - F = function ( - ) {}; - return { - s: F, - n: function ( - ) { - return i >= o.length - ? { - done: !0, - } - : { - done: !1, - value: o[i++], - }; - }, - e: function ( - _e - ) { - throw _e; - }, - f: F, - }; - } - throw new TypeError( - "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." - ); - } - var err, - normalCompletion = !0, - didErr = !1; - return { - s: function ( - ) { - it = o[Symbol.iterator]( - ); - }, - n: function ( - ) { - var step = it.next( - ); - return (normalCompletion = step.done), step; - }, - e: function ( - _e2 - ) { - (didErr = !0), (err = _e2); - }, - f: function ( - ) { - try { - normalCompletion || - null == it.return || - it.return( - ); - } finally { - if (didErr) throw err; - } - }, - }; - } - function _arrayLikeToArray( - arr, len - ) { - (null == len || len > arr.length) && (len = arr.length); - for (var i = 0, arr2 = new Array( - len - ); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - Object.defineProperty( - exports, - "__esModule", - { - value: !0, - } - ), - (exports.default = void 0); - var obj, - _react = - (obj = __webpack_require__( - 2735 - )) && obj.__esModule - ? obj - : { - default: obj, - }, - _useSubscription = __webpack_require__( - 4234 - ), - _loadableContext = __webpack_require__( - 8183 - ); - var ALL_INITIALIZERS = [], - READY_INITIALIZERS = [], - initialized = !1; - function load( - loader - ) { - var promise = loader( - ), - state = { - loading: !0, - loaded: null, - error: null, - }; - return ( - (state.promise = promise - .then( - function ( - loaded - ) { - return ( - (state.loading = !1), - (state.loaded = loaded), - loaded - ); - } - ) - .catch( - function ( - err - ) { - throw ( - ((state.loading = !1), (state.error = err), err) - ); - } - )), - state - ); - } - var LoadableSubscription = (function ( - ) { - function LoadableSubscription( - loadFn, opts - ) { - _classCallCheck( - this, - LoadableSubscription - ), - (this._loadFn = loadFn), - (this._opts = opts), - (this._callbacks = new Set( - )), - (this._delay = null), - (this._timeout = null), - this.retry( - ); - } - return ( - _createClass( - LoadableSubscription, - [ - { - key: "promise", - value: function ( - ) { - return this._res.promise; - }, - }, - { - key: "retry", - value: function ( - ) { - var _this = this; - this._clearTimeouts( - ), - (this._res = this._loadFn( - this._opts.loader - )), - (this._state = { - pastDelay: !1, - timedOut: !1, - }); - var res = this._res, - opts1 = this._opts; - res.loading && - ("number" == typeof opts1.delay && - (0 === opts1.delay - ? (this._state.pastDelay = !0) - : (this._delay = setTimeout( - function ( - ) { - _this._update( - { - pastDelay: !0, - } - ); - }, - opts1.delay - ))), - "number" == typeof opts1.timeout && - (this._timeout = setTimeout( - function ( - ) { - _this._update( - { - timedOut: !0, - } - ); - }, - opts1.timeout - ))), - this._res.promise - .then( - function ( - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ) - .catch( - function ( - _err - ) { - _this._update( - { - } - ), - _this._clearTimeouts( - ); - } - ), - this._update( - { - } - ); - }, - }, - { - key: "_update", - value: function ( - partial - ) { - (this._state = _objectSpread( - _objectSpread( - { - }, - this._state - ), - { - }, - { - error: this._res.error, - loaded: this._res.loaded, - loading: this._res.loading, - }, - partial - )), - this._callbacks.forEach( - function ( - callback - ) { - return callback( - ); - } - ); - }, - }, - { - key: "_clearTimeouts", - value: function ( - ) { - clearTimeout( - this._delay - ), - clearTimeout( - this._timeout - ); - }, - }, - { - key: "getCurrentValue", - value: function ( - ) { - return this._state; - }, - }, - { - key: "subscribe", - value: function ( - callback - ) { - var _this2 = this; - return ( - this._callbacks.add( - callback - ), - function ( - ) { - _this2._callbacks.delete( - callback - ); - } - ); - }, - }, - ] - ), - LoadableSubscription - ); - })( - ); - function Loadable( - opts1 - ) { - return (function ( - loadFn, options - ) { - var opts = Object.assign( - { - loader: null, - loading: null, - delay: 200, - timeout: null, - webpack: null, - modules: null, - }, - options - ), - subscription = null; - function init( - ) { - if (!subscription) { - var sub = new LoadableSubscription( - loadFn, - opts - ); - subscription = { - getCurrentValue: sub.getCurrentValue.bind( - sub - ), - subscribe: sub.subscribe.bind( - sub - ), - retry: sub.retry.bind( - sub - ), - promise: sub.promise.bind( - sub - ), - }; - } - return subscription.promise( - ); - } - if (!initialized && "function" == typeof opts.webpack) { - var moduleIds = opts.webpack( - ); - READY_INITIALIZERS.push( - function ( - ids - ) { - var _step, - _iterator = - _createForOfIteratorHelper( - moduleIds - ); - try { - for ( - _iterator.s( - ); - !(_step = _iterator.n( - )).done; - - ) { - var moduleId = _step.value; - if (-1 !== ids.indexOf( - moduleId - )) - return init( - ); - } - } catch (err) { - _iterator.e( - err - ); - } finally { - _iterator.f( - ); - } - } - ); - } - var LoadableComponent = function ( - props, ref - ) { - init( - ); - var context = _react.default.useContext( - _loadableContext.LoadableContext - ), - state = - _useSubscription.useSubscription( - subscription - ); - return ( - _react.default.useImperativeHandle( - ref, - function ( - ) { - return { - retry: subscription.retry, - }; - }, - [] - ), - context && - Array.isArray( - opts.modules - ) && - opts.modules.forEach( - function ( - moduleName - ) { - context( - moduleName - ); - } - ), - _react.default.useMemo( - function ( - ) { - return state.loading || state.error - ? _react.default.createElement( - opts.loading, - { - isLoading: state.loading, - pastDelay: state.pastDelay, - timedOut: state.timedOut, - error: state.error, - retry: subscription.retry, - } - ) - : state.loaded - ? _react.default.createElement( - (function ( - obj - ) { - return obj && obj.__esModule - ? obj.default - : obj; - })( - state.loaded - ), - props - ) - : null; - }, - [props, state,] - ) - ); - }; - return ( - (LoadableComponent.preload = function ( - ) { - return init( - ); - }), - (LoadableComponent.displayName = "LoadableComponent"), - _react.default.forwardRef( - LoadableComponent - ) - ); - })( - load, - opts1 - ); - } - function flushInitializers( - initializers, ids - ) { - for (var promises = []; initializers.length; ) { - var init = initializers.pop( - ); - promises.push( - init( - ids - ) - ); - } - return Promise.all( - promises - ).then( - function ( - ) { - if (initializers.length) - return flushInitializers( - initializers, - ids - ); - } - ); - } - (Loadable.preloadAll = function ( - ) { - return new Promise( - function ( - resolveInitializers, reject - ) { - flushInitializers( - ALL_INITIALIZERS - ).then( - resolveInitializers, - reject - ); - } - ); - }), - (Loadable.preloadReady = function ( - ) { - var ids = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : []; - return new Promise( - function ( - resolvePreload - ) { - var res = function ( - ) { - return (initialized = !0), resolvePreload( - ); - }; - flushInitializers( - READY_INITIALIZERS, - ids - ).then( - res, - res - ); - } - ); - }), - (window.__NEXT_PRELOADREADY = Loadable.preloadReady); - var _default = Loadable; - exports.default = _default; - }, - 6403: function ( - __unused_webpack_module, - __webpack_exports__, - __webpack_require__ - ) { - "use strict"; - __webpack_require__.r( - __webpack_exports__ - ); - var Hello = (0, __webpack_require__( - 4652 - ).default)( - function ( - ) { - return Promise.all( - [ - __webpack_require__.e( - 774 - ), - __webpack_require__.e( - 974 - ), - ] - ).then( - __webpack_require__.bind( - __webpack_require__, - 6974 - ) - ); - }, - { - ssr: !0, - loadableGenerated: { - webpack: function ( - ) { - return [6974,]; - }, - modules: [ - "dynamic/ssr-true.js -> ../../components/hello1", - ], - }, - } - ); - __webpack_exports__.default = Hello; - }, - 4420: function ( - __unused_webpack_module, - __unused_webpack_exports, - __webpack_require__ - ) { - (window.__NEXT_P = window.__NEXT_P || []).push( - [ - "/dynamic/ssr-true", - function ( - ) { - return __webpack_require__( - 6403 - ); - }, - ] - ); - }, - 4652: function ( - module, __unused_webpack_exports, __webpack_require__ - ) { - module.exports = __webpack_require__( - 8551 - ); - }, - }, - function ( - __webpack_require__ - ) { - __webpack_require__.O( - 0, - [774, 888, 179,], - function ( - ) { - return ( - (moduleId = 4420), - __webpack_require__( - (__webpack_require__.s = moduleId) - ) - ); - var moduleId; - } - ); - var __webpack_exports__ = __webpack_require__.O( - ); - _N_E = __webpack_exports__; - }, - ] -); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/266-aee26c928109d49d6151/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/266-aee26c928109d49d6151/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/266-aee26c928109d49d6151/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/266-aee26c928109d49d6151/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/266-aee26c928109d49d6151/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/266-aee26c928109d49d6151/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/266-aee26c928109d49d6151/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/266-aee26c928109d49d6151/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/framework-054ead69ea8124b4cb27/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/framework-054ead69ea8124b4cb27/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/framework-054ead69ea8124b4cb27/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/framework-054ead69ea8124b4cb27/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/framework-054ead69ea8124b4cb27/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/framework-054ead69ea8124b4cb27/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/framework-054ead69ea8124b4cb27/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/framework-054ead69ea8124b4cb27/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/main-2953d6142ff4a439dbc0/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/main-2953d6142ff4a439dbc0/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/main-2953d6142ff4a439dbc0/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/main-2953d6142ff4a439dbc0/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/main-2953d6142ff4a439dbc0/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/main-2953d6142ff4a439dbc0/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/main-2953d6142ff4a439dbc0/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/main-2953d6142ff4a439dbc0/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-no-prefetch-53313deb99cf94686856/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/pages/development-logs/link-with-prefetch-false-13db3186d6589f014e19/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/polyfills-6437a4964f697e5b0b3e/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/polyfills-6437a4964f697e5b0b3e/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/polyfills-6437a4964f697e5b0b3e/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/polyfills-6437a4964f697e5b0b3e/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/polyfills-6437a4964f697e5b0b3e/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/polyfills-6437a4964f697e5b0b3e/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/polyfills-6437a4964f697e5b0b3e/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/polyfills-6437a4964f697e5b0b3e/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/webpack-eb940a9a97802b481f9b/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/webpack-eb940a9a97802b481f9b/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/webpack-eb940a9a97802b481f9b/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/webpack-eb940a9a97802b481f9b/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/webpack-eb940a9a97802b481f9b/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/webpack-eb940a9a97802b481f9b/output.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/webpack-eb940a9a97802b481f9b/output.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/.archive-4/webpack-eb940a9a97802b481f9b/output.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-1/383.5942fafdbede773d29c7/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-1/383.5942fafdbede773d29c7/output.js index 1e99cc7fc06..23b81647e2e 100644 --- a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-1/383.5942fafdbede773d29c7/output.js +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-1/383.5942fafdbede773d29c7/output.js @@ -9,7 +9,8 @@ try { var info = gen[key](arg), value = info.value; } catch (error) { - return void reject(error); + reject(error); + return; } info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); } diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js new file mode 100644 index 00000000000..dcefb1066e3 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/output.js @@ -0,0 +1,370 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 403, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 284: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var Hello = (0, __webpack_require__(4652).default)(function() { + return Promise.all([ + __webpack_require__.e(774), + __webpack_require__.e(689), + ]).then(__webpack_require__.bind(__webpack_require__, 4090)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 4090, + ]; + }, + modules: [ + "dynamic/chunkfilename.js -> ../../components/hello-chunkfilename", + ] + } + }); + __webpack_exports__.default = Hello; + }, + 4196: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/chunkfilename", function() { + return __webpack_require__(284); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 4196); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/function-7fe8439c89afccb77983/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/function-7fe8439c89afccb77983/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js new file mode 100644 index 00000000000..ff0fb97d227 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/output.js @@ -0,0 +1,370 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 610, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 1118: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var Hello = (0, __webpack_require__(4652).default)(function() { + return Promise.all([ + __webpack_require__.e(774), + __webpack_require__.e(974), + ]).then(__webpack_require__.bind(__webpack_require__, 6974)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 6974, + ]; + }, + modules: [ + "dynamic/function.js -> ../../components/hello1", + ] + } + }); + __webpack_exports__.default = Hello; + }, + 6994: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/function", function() { + return __webpack_require__(1118); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 6994); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js new file mode 100644 index 00000000000..3cd9060e26c --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/output.js @@ -0,0 +1,421 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 499, + ], + { + 6086: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg), value = info.value; + } catch (error) { + reject(error); + return; + } + info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw); + } + function _asyncToGenerator(fn) { + return function() { + var self = this, args = arguments; + return new Promise(function(resolve, reject) { + var gen = fn.apply(self, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(void 0); + }); + }; + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _asyncToGenerator; + } + }); + }, + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 1804: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7945), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__), react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4512), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6086), next_dynamic__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4652), next_head__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1843), Test = (0, next_dynamic__WEBPACK_IMPORTED_MODULE_2__.default)({ + loader: function() { + var _loader = (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4__.Z)(_Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee() { + return _Users_timneutkens_projects_next_js_node_modules_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function(_context) { + for(;;)switch(_context.prev = _context.next){ + case 0: + return _context.abrupt("return", function() { + return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div", { + className: "dynamic-style", + children: [ + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(next_head__WEBPACK_IMPORTED_MODULE_3__.default, { + children: (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("style", { + dangerouslySetInnerHTML: { + __html: "\n .dynamic-style {\n background-color: green;\n height: 200px;\n }\n " + } + }) + }), + "test", + ] + }); + }); + case 1: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function() { + return _loader.apply(this, arguments); + }; + }(), + ssr: !1 + }); + __webpack_exports__.default = Test; + }, + 2250: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/head", function() { + return __webpack_require__(1804); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + }, + 1843: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(3396); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 2250); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js new file mode 100644 index 00000000000..845c52545fd --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/output.js @@ -0,0 +1,399 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 594, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 3483: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), next_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4652), Hello = (0, next_dynamic__WEBPACK_IMPORTED_MODULE_1__.default)(function() { + return __webpack_require__.e(358).then(__webpack_require__.bind(__webpack_require__, 1901)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 1901 + ]; + }, + modules: [ + "dynamic/multiple-modules.js -> ../../components/hello3", + ] + } + }); + (0, next_dynamic__WEBPACK_IMPORTED_MODULE_1__.default)(function() { + return __webpack_require__.e(367).then(__webpack_require__.bind(__webpack_require__, 4416)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 4416 + ]; + }, + modules: [ + "dynamic/multiple-modules.js -> ../../components/hello4", + ] + } + }), __webpack_exports__.default = function() { + return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { + children: [ + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Hello, { + }), + ] + }); + }; + }, + 5717: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/multiple-modules", function() { + return __webpack_require__(3483); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179 + ], function() { + return __webpack_require__(__webpack_require__.s = 5717); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js new file mode 100644 index 00000000000..a61d99154a6 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/output.js @@ -0,0 +1,370 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 354, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 5561: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var DynamicComponent = (0, __webpack_require__(4652).default)(function() { + return Promise.all([ + __webpack_require__.e(774), + __webpack_require__.e(808), + ]).then(__webpack_require__.bind(__webpack_require__, 2808)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 2808, + ]; + }, + modules: [ + "dynamic/nested.js -> ../../components/nested1", + ] + } + }); + __webpack_exports__.default = DynamicComponent; + }, + 4136: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/nested", function() { + return __webpack_require__(5561); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 4136); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js new file mode 100644 index 00000000000..a561ee154ae --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js @@ -0,0 +1,554 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 732, + ], + { + 2911: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _assertThisInitialized(self) { + if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return self; + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _assertThisInitialized; + } + }); + }, + 8436: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _classCallCheck; + } + }); + }, + 8370: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _defineProperties(target, props) { + for(var i = 0; i < props.length; i++){ + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor; + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _createClass; + } + }); + }, + 9178: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _defineProperty(obj, key, value) { + return key in obj ? Object.defineProperty(obj, key, { + value: value, + enumerable: !0, + configurable: !0, + writable: !0 + }) : obj[key] = value, obj; + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _defineProperty; + } + }); + }, + 2374: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _getPrototypeOf(o) { + return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(o) { + return o.__proto__ || Object.getPrototypeOf(o); + })(o); + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _getPrototypeOf; + } + }); + }, + 3001: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _setPrototypeOf(o, p) { + return (_setPrototypeOf = Object.setPrototypeOf || function(o, p) { + return o.__proto__ = p, o; + })(o, p); + } + function _inherits(subClass, superClass) { + if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function"); + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: !0, + configurable: !0 + } + }), superClass && _setPrototypeOf(subClass, superClass); + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _inherits; + } + }); + }, + 7130: function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + "use strict"; + function _typeof(obj) { + return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { + return typeof obj; + } : function(obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + })(obj); + } + __webpack_require__.d(__webpack_exports__, { + Z: function() { + return _possibleConstructorReturn; + } + }); + var assertThisInitialized = __webpack_require__(2911); + function _possibleConstructorReturn(self, call) { + return call && ("object" === _typeof(call) || "function" == typeof call) ? call : (0, assertThisInitialized.Z)(self); + } + }, + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 9087: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { + default: function() { + return Welcome; + } + }); + var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8436), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(8370), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2911), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3001), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7130), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2374), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9178), Welcome = function(_React$Component) { + (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__.Z)(Welcome, _React$Component); + var _super = function(Derived) { + var hasNativeReflectConstruct = function() { + if ("undefined" == typeof Reflect || !Reflect.construct) return !1; + if (Reflect.construct.sham) return !1; + if ("function" == typeof Proxy) return !0; + try { + return Date.prototype.toString.call(Reflect.construct(Date, [], function() { + })), !0; + } catch (e) { + return !1; + } + }(); + return function() { + var result, Super = (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__.Z)(Welcome); + if (hasNativeReflectConstruct) { + var NewTarget = (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__.Z)(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else result = Super.apply(this, arguments); + return (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__.Z)(this, result); + }; + }(Welcome); + function Welcome() { + var _this; + (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__.Z)(this, Welcome); + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + return _this = _super.call.apply(_super, [ + this, + ].concat(args)), (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__.Z)((0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_7__.Z)(_this), "state", { + name: null + }), _this; + } + return (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_8__.Z)(Welcome, [ + { + key: "componentDidMount", + value: function() { + var name = this.props.name; + this.setState({ + name: name + }); + } + }, + { + key: "render", + value: function() { + var name = this.state.name; + return name ? (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p", { + children: [ + "Welcome, ", + name, + ] + }) : null; + } + }, + ]), Welcome; + }(__webpack_require__(2735).Component); + }, + 8837: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), next_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4652), _components_welcome__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9087), Welcome2 = (0, next_dynamic__WEBPACK_IMPORTED_MODULE_1__.default)(function() { + return Promise.resolve().then(__webpack_require__.bind(__webpack_require__, 9087)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 9087, + ]; + }, + modules: [ + "dynamic/no-chunk.js -> ../../components/welcome", + ] + } + }); + __webpack_exports__.default = function() { + return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { + children: [ + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_welcome__WEBPACK_IMPORTED_MODULE_2__.default, { + name: "normal" + }), + (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(Welcome2, { + name: "dynamic" + }), + ] + }); + }; + }, + 5279: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/no-chunk", function() { + return __webpack_require__(8837); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 5279); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js new file mode 100644 index 00000000000..7fe475b4d5d --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/output.js @@ -0,0 +1,371 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 374, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 6318: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var Hello = (0, __webpack_require__(4652).default)(function() { + return Promise.all([ + __webpack_require__.e(774), + __webpack_require__.e(974), + ]).then(__webpack_require__.bind(__webpack_require__, 6974)); + }, { + ssr: !1, + loadableGenerated: { + webpack: function() { + return [ + 6974, + ]; + }, + modules: [ + "dynamic/no-ssr.js -> ../../components/hello1", + ] + } + }); + __webpack_exports__.default = Hello; + }, + 8996: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/no-ssr", function() { + return __webpack_require__(6318); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 8996); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js new file mode 100644 index 00000000000..094238f875f --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/output.js @@ -0,0 +1,373 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 618, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 6502: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), Hello = (0, __webpack_require__(4652).default)(function() { + return __webpack_require__.e(916).then(__webpack_require__.bind(__webpack_require__, 6974)); + }, { + ssr: !1, + loading: function() { + return (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("p", { + children: "LOADING" + }); + }, + loadableGenerated: { + webpack: function() { + return [ + 6974, + ]; + }, + modules: [ + "dynamic/no-ssr-custom-loading.js -> ../../components/hello1", + ] + } + }); + __webpack_exports__.default = Hello; + }, + 6637: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/no-ssr-custom-loading", function() { + return __webpack_require__(6502); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 6637); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js new file mode 100644 index 00000000000..8779f9dac9f --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/output.js @@ -0,0 +1,370 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 985, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 8584: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var Hello = (0, __webpack_require__(4652).default)(function() { + return Promise.all([ + __webpack_require__.e(774), + __webpack_require__.e(974), + ]).then(__webpack_require__.bind(__webpack_require__, 6974)); + }, { + loadableGenerated: { + webpack: function() { + return [ + 6974, + ]; + }, + modules: [ + "dynamic/ssr.js -> ../../components/hello1", + ] + } + }); + __webpack_exports__.default = Hello; + }, + 5006: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/ssr", function() { + return __webpack_require__(8584); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 5006); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/input.js similarity index 100% rename from ecmascript/minifier/tests/compress/fixture/projects/next/.archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/input.js rename to ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/input.js diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js new file mode 100644 index 00000000000..2e156db5b69 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/output.js @@ -0,0 +1,371 @@ +(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ + [ + 14, + ], + { + 8551: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + exports.default = function(dynamicOptions, options) { + var loadableFn = _loadable.default, loadableOptions = { + loading: function(_ref) { + return _ref.error, _ref.isLoading, _ref.pastDelay, null; + } + }; + if (dynamicOptions instanceof Promise ? loadableOptions.loader = function() { + return dynamicOptions; + } : "function" == typeof dynamicOptions ? loadableOptions.loader = dynamicOptions : "object" == typeof dynamicOptions && (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), dynamicOptions)), (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), options)).loadableGenerated && delete (loadableOptions = _objectSpread(_objectSpread({ + }, loadableOptions), loadableOptions.loadableGenerated)).loadableGenerated, "boolean" == typeof loadableOptions.ssr) { + if (!loadableOptions.ssr) return delete loadableOptions.ssr, noSSR(loadableFn, loadableOptions); + delete loadableOptions.ssr; + } + return loadableFn(loadableOptions); + }, _interopRequireDefault(__webpack_require__(2735)); + var _loadable = _interopRequireDefault(__webpack_require__(880)); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; + } + function noSSR(LoadableInitializer, loadableOptions) { + return delete loadableOptions.webpack, delete loadableOptions.modules, LoadableInitializer(loadableOptions); + } + }, + 8183: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.LoadableContext = void 0; + var obj, LoadableContext = ((obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }).default.createContext(null); + exports.LoadableContext = LoadableContext; + }, + 880: function(__unused_webpack_module, exports, __webpack_require__) { + "use strict"; + var _defineProperty = __webpack_require__(566), _classCallCheck = __webpack_require__(4988), _createClass = __webpack_require__(9590); + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = null != arguments[i] ? arguments[i] : { + }; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; + } + function _arrayLikeToArray(arr, len) { + (null == len || len > arr.length) && (len = arr.length); + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; + } + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = void 0; + var obj, _react = (obj = __webpack_require__(2735)) && obj.__esModule ? obj : { + default: obj + }, _useSubscription = __webpack_require__(4234), _loadableContext = __webpack_require__(8183), ALL_INITIALIZERS = [], READY_INITIALIZERS = [], initialized = !1; + function load(loader) { + var promise = loader(), state = { + loading: !0, + loaded: null, + error: null + }; + return state.promise = promise.then(function(loaded) { + return state.loading = !1, state.loaded = loaded, loaded; + }).catch(function(err) { + throw state.loading = !1, state.error = err, err; + }), state; + } + var LoadableSubscription = function() { + function LoadableSubscription(loadFn, opts) { + _classCallCheck(this, LoadableSubscription), this._loadFn = loadFn, this._opts = opts, this._callbacks = new Set(), this._delay = null, this._timeout = null, this.retry(); + } + return _createClass(LoadableSubscription, [ + { + key: "promise", + value: function() { + return this._res.promise; + } + }, + { + key: "retry", + value: function() { + var _this = this; + this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = { + pastDelay: !1, + timedOut: !1 + }; + var res = this._res, opts1 = this._opts; + res.loading && ("number" == typeof opts1.delay && (0 === opts1.delay ? this._state.pastDelay = !0 : this._delay = setTimeout(function() { + _this._update({ + pastDelay: !0 + }); + }, opts1.delay)), "number" == typeof opts1.timeout && (this._timeout = setTimeout(function() { + _this._update({ + timedOut: !0 + }); + }, opts1.timeout))), this._res.promise.then(function() { + _this._update({ + }), _this._clearTimeouts(); + }).catch(function(_err) { + _this._update({ + }), _this._clearTimeouts(); + }), this._update({ + }); + } + }, + { + key: "_update", + value: function(partial) { + this._state = _objectSpread(_objectSpread({ + }, this._state), { + }, { + error: this._res.error, + loaded: this._res.loaded, + loading: this._res.loading + }, partial), this._callbacks.forEach(function(callback) { + return callback(); + }); + } + }, + { + key: "_clearTimeouts", + value: function() { + clearTimeout(this._delay), clearTimeout(this._timeout); + } + }, + { + key: "getCurrentValue", + value: function() { + return this._state; + } + }, + { + key: "subscribe", + value: function(callback) { + var _this2 = this; + return this._callbacks.add(callback), function() { + _this2._callbacks.delete(callback); + }; + } + }, + ]), LoadableSubscription; + }(); + function Loadable(opts1) { + return (function(loadFn, options) { + var opts = Object.assign({ + loader: null, + loading: null, + delay: 200, + timeout: null, + webpack: null, + modules: null + }, opts1), subscription = null; + function init() { + if (!subscription) { + var sub = new LoadableSubscription(load, opts); + subscription = { + getCurrentValue: sub.getCurrentValue.bind(sub), + subscribe: sub.subscribe.bind(sub), + retry: sub.retry.bind(sub), + promise: sub.promise.bind(sub) + }; + } + return subscription.promise(); + } + if (!initialized && "function" == typeof opts.webpack) { + var moduleIds = opts.webpack(); + READY_INITIALIZERS.push(function(ids) { + var _step, _iterator = function(o, allowArrayLike) { + if ("undefined" == typeof Symbol || null == o[Symbol.iterator]) { + if (Array.isArray(o) || (it = (function(o, minLen) { + if (o) { + if ("string" == typeof o) return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if ("Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n) return Array.from(o); + if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + })(o)) || 0) { + it && (o = it); + var i = 0, F = function() { + }; + return { + s: F, + n: function() { + return i >= o.length ? { + done: !0 + } : { + done: !1, + value: o[i++] + }; + }, + e: function(_e) { + throw _e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var it, err, normalCompletion = !0, didErr = !1; + return { + s: function() { + it = o[Symbol.iterator](); + }, + n: function() { + var step = it.next(); + return normalCompletion = step.done, step; + }, + e: function(_e2) { + didErr = !0, err = _e2; + }, + f: function() { + try { + normalCompletion || null == it.return || it.return(); + } finally{ + if (didErr) throw err; + } + } + }; + }(moduleIds); + try { + for(_iterator.s(); !(_step = _iterator.n()).done;){ + var moduleId = _step.value; + if (-1 !== ids.indexOf(moduleId)) return init(); + } + } catch (err) { + _iterator.e(err); + } finally{ + _iterator.f(); + } + }); + } + var LoadableComponent = function(props, ref) { + init(); + var context = _react.default.useContext(_loadableContext.LoadableContext), state = _useSubscription.useSubscription(subscription); + return _react.default.useImperativeHandle(ref, function() { + return { + retry: subscription.retry + }; + }, []), context && Array.isArray(opts.modules) && opts.modules.forEach(function(moduleName) { + context(moduleName); + }), _react.default.useMemo(function() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; + }, [ + props, + state, + ]); + }; + return LoadableComponent.preload = function() { + return init(); + }, LoadableComponent.displayName = "LoadableComponent", _react.default.forwardRef(LoadableComponent); + })(load, opts1); + } + function flushInitializers(initializers, ids) { + for(var promises = []; initializers.length;){ + var init = initializers.pop(); + promises.push(init(ids)); + } + return Promise.all(promises).then(function() { + if (initializers.length) return flushInitializers(initializers, ids); + }); + } + Loadable.preloadAll = function() { + return new Promise(function(resolveInitializers, reject) { + flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject); + }); + }, Loadable.preloadReady = function() { + var ids = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; + return new Promise(function(resolvePreload) { + var res = function() { + return initialized = !0, resolvePreload(); + }; + flushInitializers(READY_INITIALIZERS, ids).then(res, res); + }); + }, window.__NEXT_PRELOADREADY = Loadable.preloadReady, exports.default = Loadable; + }, + 6403: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.r(__webpack_exports__); + var Hello = (0, __webpack_require__(4652).default)(function() { + return Promise.all([ + __webpack_require__.e(774), + __webpack_require__.e(974), + ]).then(__webpack_require__.bind(__webpack_require__, 6974)); + }, { + ssr: !0, + loadableGenerated: { + webpack: function() { + return [ + 6974, + ]; + }, + modules: [ + "dynamic/ssr-true.js -> ../../components/hello1", + ] + } + }); + __webpack_exports__.default = Hello; + }, + 4420: function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { + (window.__NEXT_P = window.__NEXT_P || []).push([ + "/dynamic/ssr-true", function() { + return __webpack_require__(6403); + }, ]); + }, + 4652: function(module, __unused_webpack_exports, __webpack_require__) { + module.exports = __webpack_require__(8551); + } + }, function(__webpack_require__) { + __webpack_require__.O(0, [ + 774, + 888, + 179, + ], function() { + return __webpack_require__(__webpack_require__.s = 4420); + }), _N_E = __webpack_require__.O(); + }, ]); diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/input.js new file mode 100644 index 00000000000..9e19469ae14 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/input.js @@ -0,0 +1,63 @@ +__webpack_require__.O = function ( + result, chunkIds, fn, priority +) { + /******/ if (chunkIds) { + /******/ priority = priority || 0; + /******/ for ( + var i = deferred.length; + i > 0 && deferred[i - 1][2] > priority; + i-- + ) + deferred[i] = deferred[i - 1]; + /******/ deferred[i] = [chunkIds, fn, priority,]; + /******/ return; + /******/ + } + /******/ var notFulfilled = Infinity; + /******/ for (var i = 0; i < deferred.length; i++) { + /******/ var chunkIds = deferred[i][0]; + /******/ var fn = deferred[i][1]; + /******/ var priority = deferred[i][2]; + /******/ var fulfilled = true; + /******/ for (var j = 0; j < chunkIds.length; j++) { + /******/ if ( + (priority & (1 === 0) || notFulfilled >= priority) && + Object.keys( + __webpack_require__.O + ).every( + function ( + key + ) { + return __webpack_require__.O[key]( + chunkIds[j] + ); + } + ) + ) { + /******/ chunkIds.splice( + j--, + 1 + ); + /******/ + } else { + /******/ fulfilled = false; + /******/ if (priority < notFulfilled) notFulfilled = priority; + /******/ + } + /******/ + } + /******/ if (fulfilled) { + /******/ deferred.splice( + i--, + 1 + ); + /******/ var r = fn( + ); + /******/ if (r !== undefined) result = r; + /******/ + } + /******/ + } + /******/ return result; + /******/ +}; diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/output.js new file mode 100644 index 00000000000..314f28b591f --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.3/output.js @@ -0,0 +1,45 @@ +__webpack_require__.O = function ( + result, chunkIds, fn, priority +) { + if (!chunkIds) { + var notFulfilled = 1 / 0; + for (i = 0; i < deferred.length; i++) { + (chunkIds = deferred[i][0]), + (fn = deferred[i][1]), + (priority = deferred[i][2]); + for (var fulfilled = !0, j = 0; j < chunkIds.length; j++) + (!1 & priority || notFulfilled >= priority) && + Object.keys( + __webpack_require__.O + ).every( + function ( + key + ) { + return __webpack_require__.O[key]( + chunkIds[j] + ); + } + ) + ? chunkIds.splice( + j--, + 1 + ) + : ((fulfilled = !1), + priority < notFulfilled && (notFulfilled = priority)); + if (fulfilled) { + deferred.splice( + i--, + 1 + ); + var r = fn( + ); + void 0 !== r && (result = r); + } + } + return result; + } + priority = priority || 0; + for (var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) + deferred[i] = deferred[i - 1]; + deferred[i] = [chunkIds, fn, priority,]; +}; diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/input.js new file mode 100644 index 00000000000..a491d4890d5 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/input.js @@ -0,0 +1,106 @@ +__webpack_require__.l = function ( + url, done, key, chunkId +) { + /******/ if (inProgress[url]) { + inProgress[url].push( + done + ); + return; + } + /******/ var script, needAttach; + /******/ if (key !== undefined) { + /******/ var scripts = document.getElementsByTagName( + "script" + ); + /******/ for (var i = 0; i < scripts.length; i++) { + /******/ var s = scripts[i]; + /******/ if ( + s.getAttribute( + "src" + ) == url || + s.getAttribute( + "data-webpack" + ) == dataWebpackPrefix + key + ) { + script = s; + break; + } + /******/ + } + /******/ + } + /******/ if (!script) { + /******/ needAttach = true; + /******/ script = document.createElement( + "script" + ); + /******/ + /******/ script.charset = "utf-8"; + /******/ script.timeout = 120; + /******/ if (__webpack_require__.nc) { + /******/ script.setAttribute( + "nonce", + __webpack_require__.nc + ); + /******/ + } + /******/ script.setAttribute( + "data-webpack", + dataWebpackPrefix + key + ); + /******/ script.src = url; + /******/ + } + /******/ inProgress[url] = [done,]; + /******/ var onScriptComplete = function ( + prev, event + ) { + /******/ // avoid mem leaks in IE. + /******/ script.onerror = script.onload = null; + /******/ clearTimeout( + timeout + ); + /******/ var doneFns = inProgress[url]; + /******/ delete inProgress[url]; + /******/ script.parentNode && script.parentNode.removeChild( + script + ); + /******/ doneFns && + doneFns.forEach( + function ( + fn + ) { + return fn( + event + ); + } + ); + /******/ if (prev) return prev( + event + ); + /******/ + }; + /******/ /******/ var timeout = setTimeout( + onScriptComplete.bind( + null, + undefined, + { + type: "timeout", + target: script, + } + ), + 120000 + ); + /******/ script.onerror = onScriptComplete.bind( + null, + script.onerror + ); + /******/ script.onload = onScriptComplete.bind( + null, + script.onload + ); + /******/ needAttach && document.head.appendChild( + script + ); + /******/ +}; diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/output.js new file mode 100644 index 00000000000..2a4cd0cfc71 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/.4/output.js @@ -0,0 +1,98 @@ +__webpack_require__.l = function ( + url, done, key, chunkId +) { + if (inProgress[url]) inProgress[url].push( + done + ); + else { + var script, needAttach; + if (void 0 !== key) + for ( + var scripts = document.getElementsByTagName( + "script" + ), i = 0; + i < scripts.length; + i++ + ) { + var s = scripts[i]; + if ( + s.getAttribute( + "src" + ) == url || + s.getAttribute( + "data-webpack" + ) == dataWebpackPrefix + key + ) { + script = s; + break; + } + } + script || + ((needAttach = !0), + ((script = document.createElement( + "script" + )).charset = "utf-8"), + (script.timeout = 120), + __webpack_require__.nc && + script.setAttribute( + "nonce", + __webpack_require__.nc + ), + script.setAttribute( + "data-webpack", + dataWebpackPrefix + key + ), + (script.src = url)), + (inProgress[url] = [done,]); + var onScriptComplete = function ( + prev, event + ) { + (script.onerror = script.onload = null), clearTimeout( + timeout + ); + var doneFns = inProgress[url]; + if ( + (delete inProgress[url], + script.parentNode && script.parentNode.removeChild( + script + ), + doneFns && + doneFns.forEach( + function ( + fn + ) { + return fn( + event + ); + } + ), + prev) + ) + return prev( + event + ); + }, + timeout = setTimeout( + onScriptComplete.bind( + null, + void 0, + { + type: "timeout", + target: script, + } + ), + 12e4 + ); + (script.onerror = onScriptComplete.bind( + null, + script.onerror + )), + (script.onload = onScriptComplete.bind( + null, + script.onload + )), + needAttach && document.head.appendChild( + script + ); + } +}; diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/input.js new file mode 100644 index 00000000000..3e0aeb661de --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/input.js @@ -0,0 +1,20 @@ +export function foo( +) { + if (state.loading || state.error) + return _react.default.createElement( + opts.loading, + { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry, + } + ); + if (!state.loaded) return null; + var obj; + return _react.default.createElement( + (obj = state.loaded) && obj.__esModule ? obj.default : obj, + props + ); +} diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/output.js new file mode 100644 index 00000000000..c5a7b0cd269 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/1/output.js @@ -0,0 +1,10 @@ +export function foo() { + var obj; + return state.loading || state.error ? _react.default.createElement(opts.loading, { + isLoading: state.loading, + pastDelay: state.pastDelay, + timedOut: state.timedOut, + error: state.error, + retry: subscription.retry + }) : state.loaded ? _react.default.createElement((obj = state.loaded) && obj.__esModule ? obj.default : obj, props) : null; +} diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/input.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/input.js new file mode 100644 index 00000000000..5357d9dc811 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/input.js @@ -0,0 +1,62 @@ +export function insertRule( + rule, index +) { + invariant( + isString( + rule + ), + "`insertRule` accepts only strings" + ); + + if (!this._isBrowser) { + if (typeof index !== "number") { + index = this._serverSheet.cssRules.length; + } + + this._serverSheet.insertRule( + rule, + index + ); + + return this._rulesCount++; + } + + if (this._optimizeForSpeed) { + var sheet = this.getSheet( + ); + + if (typeof index !== "number") { + index = sheet.cssRules.length; + } // this weirdness for perf, and chrome's weird bug + // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule + + try { + sheet.insertRule( + rule, + index + ); + } catch (error) { + if (!isProd) { + console.warn( + "StyleSheet: illegal rule: \n\n" + + rule + + "\n\nSee https://stackoverflow.com/q/20007992 for more info" + ); + } + + return -1; + } + } else { + var insertionPoint = this._tags[index]; + + this._tags.push( + this.makeStyleTag( + this._name, + rule, + insertionPoint + ) + ); + } + + return this._rulesCount++; +} diff --git a/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/output.js b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/output.js new file mode 100644 index 00000000000..622c1681780 --- /dev/null +++ b/ecmascript/minifier/tests/compress/fixture/projects/next/extra/if_return/2/output.js @@ -0,0 +1,16 @@ +export function insertRule(rule, index) { + if (invariant(isString(rule), "`insertRule` accepts only strings"), !this._isBrowser) return "number" != typeof index && (index = this._serverSheet.cssRules.length), this._serverSheet.insertRule(rule, index), this._rulesCount++; + if (this._optimizeForSpeed) { + var sheet = this.getSheet(); + "number" != typeof index && (index = sheet.cssRules.length); + try { + sheet.insertRule(rule, index); + } catch (error) { + return isProd || console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info"), -1; + } + } else { + var insertionPoint = this._tags[index]; + this._tags.push(this.makeStyleTag(this._name, rule, insertionPoint)); + } + return this._rulesCount++; +} diff --git a/ecmascript/minifier/tests/golden.txt b/ecmascript/minifier/tests/golden.txt index f9cc8e60b57..e2346cc5fb3 100644 --- a/ecmascript/minifier/tests/golden.txt +++ b/ecmascript/minifier/tests/golden.txt @@ -402,6 +402,7 @@ evaluate/string_charCodeAt/input.js evaluate/unary_prefix/input.js evaluate/unsafe_array_bad_index/input.js evaluate/unsafe_constant/input.js +evaluate/unsafe_object_accessor/input.js evaluate/unsafe_string/input.js evaluate/unsafe_string_bad_index/input.js expansions/avoid_spread_holes_call/input.js @@ -468,6 +469,7 @@ functions/issue_2663_3/input.js functions/issue_2737_1/input.js functions/issue_2737_2/input.js functions/issue_3054/input.js +functions/issue_485_crashing_1530/input.js functions/no_webkit/input.js functions/recursive_inline_1/input.js functions/webkit/input.js @@ -595,6 +597,7 @@ issue_1044/issue_1044/input.js issue_1105/Infinity_not_in_with_scope/input.js issue_1105/with_in_global_scope/input.js issue_12/keep_name_of_getter/input.js +issue_12/keep_name_of_setter/input.js issue_12/setter_with_operator_keys/input.js issue_1212/issue_1212_debug_false/input.js issue_1212/issue_1212_debug_true/input.js diff --git a/ecmascript/minifier/tests/ignored.txt b/ecmascript/minifier/tests/ignored.txt index cb46d2a8505..72f2a0853bb 100644 --- a/ecmascript/minifier/tests/ignored.txt +++ b/ecmascript/minifier/tests/ignored.txt @@ -130,7 +130,6 @@ evaluate/delete_expr_1/input.js evaluate/delete_expr_2/input.js evaluate/issue_2535_1/input.js evaluate/issue_2916_2/input.js -evaluate/unsafe_object_accessor/input.js expansions/avoid_spread_getset_object/input.js expansions/avoid_spread_hole/input.js export/export_default_named_async_function/input.js @@ -155,7 +154,6 @@ functions/issue_3016_3/input.js functions/issue_3018/input.js functions/issue_3076/input.js functions/issue_3166/input.js -functions/issue_485_crashing_1530/input.js functions/loop_init_arg/input.js functions/unsafe_apply_2/input.js functions/unsafe_call_2/input.js @@ -206,7 +204,6 @@ issue_1052/defun_if_return/input.js issue_1052/multiple_functions/input.js issue_1052/not_hoisted_when_already_nested/input.js issue_1052/single_function/input.js -issue_12/keep_name_of_setter/input.js issue_1202/mangle_keep_fnames_false/input.js issue_1202/mangle_keep_fnames_true/input.js issue_1261/pure_function_calls/input.js diff --git a/ecmascript/minifier/tests/projects/output/angular-1.2.5.js b/ecmascript/minifier/tests/projects/output/angular-1.2.5.js index 5dfea9061ce..c93dc0f75ae 100644 --- a/ecmascript/minifier/tests/projects/output/angular-1.2.5.js +++ b/ecmascript/minifier/tests/projects/output/angular-1.2.5.js @@ -385,7 +385,10 @@ function jqLiteRemoveData(element, name) { var expandoId = element[jqName], expandoStore = jqCache[expandoId]; if (expandoStore) { - if (name) return void delete jqCache[expandoId].data[name]; + if (name) { + delete jqCache[expandoId].data[name]; + return; + } expandoStore.handle && (expandoStore.events.$destroy && expandoStore.handle({ }, "$destroy"), jqLiteOff(element)), delete jqCache[expandoId], element[jqName] = undefined; } @@ -1640,7 +1643,6 @@ var parts = []; return (function(obj, iterator, context) { for(var keys = sortedKeys(obj), i = 0; i < keys.length; i++)iterator.call(void 0, obj[keys[i]], keys[i]); - return keys; })(params, function(value, key) { null === value || isUndefined(value) || (isArray(value) || (value = [ value @@ -1918,7 +1920,10 @@ } }), $location.absUrl() != initialUrl && $browser.url($location.absUrl(), !0), $browser.onUrlChange(function(newUrl) { if ($location.absUrl() != newUrl) { - if ($rootScope.$broadcast("$locationChangeStart", newUrl, $location.absUrl()).defaultPrevented) return void $browser.url($location.absUrl()); + if ($rootScope.$broadcast("$locationChangeStart", newUrl, $location.absUrl()).defaultPrevented) { + $browser.url($location.absUrl()); + return; + } $rootScope.$evalAsync(function() { var oldUrl = $location.absUrl(); $location.$$parse(newUrl), afterLocationChange(oldUrl); @@ -2235,8 +2240,8 @@ } escape = !1; } else if ("\\" === ch) escape = !0; - else { - if (ch === quote) return this.index++, void this.tokens.push({ + else if (ch === quote) { + this.index++, this.tokens.push({ index: start, text: rawString, string: string, @@ -2245,8 +2250,8 @@ return string; } }); - string += ch; - } + return; + } else string += ch; this.index++; } this.throwError("Unterminated quote", start); @@ -2714,7 +2719,7 @@ }; return forEach(promises, function(promise, key) { counter++, ref(promise).then(function(value) { - !results.hasOwnProperty(key) && (results[key] = value, --counter || deferred.resolve(results)); + results.hasOwnProperty(key) || (results[key] = value, --counter || deferred.resolve(results)); }, function(reason) { results.hasOwnProperty(key) || deferred.reject(reason); }); @@ -2772,10 +2777,9 @@ var oldValue, newValue, self = this, changeDetected = 0, objGetter = $parse(obj), internalArray = [], internalObject = { }, oldLength = 0; return this.$watch(function() { - var newLength, key; if (isObject(newValue = objGetter(self))) if (isArrayLike(newValue)) { oldValue !== internalArray && (oldLength = (oldValue = internalArray).length = 0, changeDetected++), oldLength !== (newLength = newValue.length) && (changeDetected++, oldValue.length = oldLength = newLength); - for(var i = 0; i < newLength; i++)oldValue[i] !== newValue[i] && (changeDetected++, oldValue[i] = newValue[i]); + for(var newLength, key, i = 0; i < newLength; i++)oldValue[i] !== newValue[i] && (changeDetected++, oldValue[i] = newValue[i]); } else { for(key in oldValue !== internalObject && (oldValue = internalObject = { }, oldLength = 0, changeDetected++), newLength = 0, newValue)newValue.hasOwnProperty(key) && (newLength++, oldValue.hasOwnProperty(key) ? oldValue[key] !== newValue[key] && (changeDetected++, oldValue[key] = newValue[key]) : (oldLength++, oldValue[key] = newValue[key], changeDetected++)); @@ -3532,38 +3536,44 @@ number: function(scope, element, attr, ctrl, $sniffer, $browser) { if (textInputType(scope, element, attr, ctrl, $sniffer, $browser), ctrl.$parsers.push(function(value) { var empty = ctrl.$isEmpty(value); - return empty || NUMBER_REGEXP.test(value) ? (ctrl.$setValidity("number", !0), "" === value ? null : empty ? value : parseFloat(value)) : void ctrl.$setValidity("number", !1); + if (empty || NUMBER_REGEXP.test(value)) return ctrl.$setValidity("number", !0), "" === value ? null : empty ? value : parseFloat(value); + ctrl.$setValidity("number", !1); }), ctrl.$formatters.push(function(value) { return ctrl.$isEmpty(value) ? "" : "" + value; }), attr.min) { var minValidator = function(value) { var min = parseFloat(attr.min); - return !ctrl.$isEmpty(value) && value < min ? void ctrl.$setValidity("min", !1) : (ctrl.$setValidity("min", !0), value); + if (ctrl.$isEmpty(value) || !(value < min)) return ctrl.$setValidity("min", !0), value; + ctrl.$setValidity("min", !1); }; ctrl.$parsers.push(minValidator), ctrl.$formatters.push(minValidator); } if (attr.max) { var maxValidator = function(value) { var max = parseFloat(attr.max); - return !ctrl.$isEmpty(value) && value > max ? void ctrl.$setValidity("max", !1) : (ctrl.$setValidity("max", !0), value); + if (ctrl.$isEmpty(value) || !(value > max)) return ctrl.$setValidity("max", !0), value; + ctrl.$setValidity("max", !1); }; ctrl.$parsers.push(maxValidator), ctrl.$formatters.push(maxValidator); } ctrl.$formatters.push(function(value) { - return ctrl.$isEmpty(value) || isNumber(value) ? (ctrl.$setValidity("number", !0), value) : void ctrl.$setValidity("number", !1); + if (ctrl.$isEmpty(value) || isNumber(value)) return ctrl.$setValidity("number", !0), value; + ctrl.$setValidity("number", !1); }); }, url: function(scope, element, attr, ctrl, $sniffer, $browser) { textInputType(scope, element, attr, ctrl, $sniffer, $browser); var urlValidator = function(value) { - return ctrl.$isEmpty(value) || URL_REGEXP.test(value) ? (ctrl.$setValidity("url", !0), value) : void ctrl.$setValidity("url", !1); + if (ctrl.$isEmpty(value) || URL_REGEXP.test(value)) return ctrl.$setValidity("url", !0), value; + ctrl.$setValidity("url", !1); }; ctrl.$formatters.push(urlValidator), ctrl.$parsers.push(urlValidator); }, email: function(scope, element, attr, ctrl, $sniffer, $browser) { textInputType(scope, element, attr, ctrl, $sniffer, $browser); var emailValidator = function(value) { - return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value) ? (ctrl.$setValidity("email", !0), value) : void ctrl.$setValidity("email", !1); + if (ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value)) return ctrl.$setValidity("email", !0), value; + ctrl.$setValidity("email", !1); }; ctrl.$formatters.push(emailValidator), ctrl.$parsers.push(emailValidator); }, @@ -3629,7 +3639,8 @@ element.val(ctrl.$isEmpty(ctrl.$viewValue) ? "" : ctrl.$viewValue); }; var timeout, patternValidator, match, pattern = attr.ngPattern, validate = function(regexp, value) { - return ctrl.$isEmpty(value) || regexp.test(value) ? (ctrl.$setValidity("pattern", !0), value) : void ctrl.$setValidity("pattern", !1); + if (ctrl.$isEmpty(value) || regexp.test(value)) return ctrl.$setValidity("pattern", !0), value; + ctrl.$setValidity("pattern", !1); }; if (pattern && (patternValidator = (match = pattern.match(/^\/(.*)\/([gim]*)$/)) ? function(value) { return validate(pattern = new RegExp(match[1], match[2]), value); @@ -3639,13 +3650,15 @@ return validate(patternObj, value); }, ctrl.$formatters.push(patternValidator), ctrl.$parsers.push(patternValidator)), attr.ngMinlength) { var minlength = int(attr.ngMinlength), minLengthValidator = function(value) { - return !ctrl.$isEmpty(value) && value.length < minlength ? void ctrl.$setValidity("minlength", !1) : (ctrl.$setValidity("minlength", !0), value); + if (ctrl.$isEmpty(value) || !(value.length < minlength)) return ctrl.$setValidity("minlength", !0), value; + ctrl.$setValidity("minlength", !1); }; ctrl.$parsers.push(minLengthValidator), ctrl.$formatters.push(minLengthValidator); } if (attr.ngMaxlength) { var maxlength = int(attr.ngMaxlength), maxLengthValidator = function(value) { - return !ctrl.$isEmpty(value) && value.length > maxlength ? void ctrl.$setValidity("maxlength", !1) : (ctrl.$setValidity("maxlength", !0), value); + if (ctrl.$isEmpty(value) || !(value.length > maxlength)) return ctrl.$setValidity("maxlength", !0), value; + ctrl.$setValidity("maxlength", !1); }; ctrl.$parsers.push(maxLengthValidator), ctrl.$formatters.push(maxLengthValidator); } @@ -3730,7 +3743,8 @@ if (ctrl) { attr.required = !0; var validator = function(value) { - return attr.required && ctrl.$isEmpty(value) ? void ctrl.$setValidity("required", !1) : (ctrl.$setValidity("required", !0), value); + if (!(attr.required && ctrl.$isEmpty(value))) return ctrl.$setValidity("required", !0), value; + ctrl.$setValidity("required", !1); }; ctrl.$formatters.push(validator), ctrl.$parsers.unshift(validator), attr.$observe("required", function() { validator(ctrl.$viewValue); diff --git a/ecmascript/minifier/tests/projects/output/jquery-1.9.1.js b/ecmascript/minifier/tests/projects/output/jquery-1.9.1.js index c133a3c18f8..43ce555df09 100644 --- a/ecmascript/minifier/tests/projects/output/jquery-1.9.1.js +++ b/ecmascript/minifier/tests/projects/output/jquery-1.9.1.js @@ -125,13 +125,13 @@ return null == obj ? String(obj) : "object" == typeof obj || "function" == typeof obj ? class2type[core_toString.call(obj)] || "object" : typeof obj; }, isPlainObject: function(obj) { + var key; if (!obj || "object" !== jQuery.type(obj) || obj.nodeType || jQuery.isWindow(obj)) return !1; try { if (obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) return !1; } catch (e) { return !1; } - var key; for(key in obj); return key === undefined || core_hasOwn.call(obj, key); }, @@ -730,7 +730,7 @@ }, prop: function(elem, name, value) { var ret, hooks, nType = elem.nodeType; - if (elem && 3 !== nType && 8 !== nType && 2 !== nType) return (1 === nType && jQuery.isXMLDoc(elem) || (name = jQuery.propFix[name] || name, hooks = jQuery.propHooks[name]), value !== undefined) ? hooks && "set" in hooks && undefined !== (ret = hooks.set(elem, value, name)) ? ret : elem[name] = value : hooks && "get" in hooks && null !== (ret = hooks.get(elem, name)) ? ret : elem[name]; + return elem && 3 !== nType && 8 !== nType && 2 !== nType ? (1 === nType && jQuery.isXMLDoc(elem) || (name = jQuery.propFix[name] || name, hooks = jQuery.propHooks[name]), value !== undefined) ? hooks && "set" in hooks && undefined !== (ret = hooks.set(elem, value, name)) ? ret : elem[name] = value : hooks && "get" in hooks && null !== (ret = hooks.get(elem, name)) ? ret : elem[name] : void 0; }, propHooks: { tabIndex: { @@ -3006,10 +3006,10 @@ top: 0, left: 0 }, elem = this[0], doc = elem && elem.ownerDocument; - if (doc) return (docElem = doc.documentElement, jQuery.contains(docElem, elem)) ? (void 0 !== elem.getBoundingClientRect && (box = elem.getBoundingClientRect()), win = getWindow(doc), { + return doc ? (docElem = doc.documentElement, jQuery.contains(docElem, elem)) ? (void 0 !== elem.getBoundingClientRect && (box = elem.getBoundingClientRect()), win = getWindow(doc), { top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0), left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0) - }) : box; + }) : box : void 0; }, jQuery.offset = { setOffset: function(elem, options, i) { var position = jQuery.css(elem, "position"); diff --git a/ecmascript/minifier/tests/projects/output/jquery.mobile-1.4.2.js b/ecmascript/minifier/tests/projects/output/jquery.mobile-1.4.2.js index 6f33f0940ae..6573a6de167 100644 --- a/ecmascript/minifier/tests/projects/output/jquery.mobile-1.4.2.js +++ b/ecmascript/minifier/tests/projects/output/jquery.mobile-1.4.2.js @@ -349,7 +349,10 @@ _childConstructors: [] }), (basePrototype = new base()).options = $.widget.extend({ }, basePrototype.options), $.each(prototype, function(prop, value) { - if (!$.isFunction(value)) return void (proxiedPrototype[prop] = value); + if (!$.isFunction(value)) { + proxiedPrototype[prop] = value; + return; + } proxiedPrototype[prop] = (function() { return function() { var returnValue, __super = this._super, __superApply = this._superApply; @@ -918,10 +921,22 @@ popstate: function(event) { var hash, state; if ($5.event.special.navigate.isPushStateEnabled()) { - if (this.preventHashAssignPopState) return this.preventHashAssignPopState = !1, void event.stopImmediatePropagation(); - if (this.ignorePopState) return void (this.ignorePopState = !1); - if (!event.originalEvent.state && 1 === this.history.stack.length && this.ignoreInitialHashChange && (this.ignoreInitialHashChange = !1, location.href === initialHref)) return void event.preventDefault(); - if (hash = path1.parseLocation().hash, !event.originalEvent.state && hash) return state = this.squash(hash), this.history.add(state.url, state), void (event.historyState = state); + if (this.preventHashAssignPopState) { + this.preventHashAssignPopState = !1, event.stopImmediatePropagation(); + return; + } + if (this.ignorePopState) { + this.ignorePopState = !1; + return; + } + if (!event.originalEvent.state && 1 === this.history.stack.length && this.ignoreInitialHashChange && (this.ignoreInitialHashChange = !1, location.href === initialHref)) { + event.preventDefault(); + return; + } + if (hash = path1.parseLocation().hash, !event.originalEvent.state && hash) { + state = this.squash(hash), this.history.add(state.url, state), event.historyState = state; + return; + } this.history.direct({ url: (event.originalEvent.state || { }).url || hash, @@ -935,7 +950,10 @@ hashchange: function(event) { var history, hash; if (!(!$5.event.special.navigate.isHashChangeEnabled() || $5.event.special.navigate.isPushStateEnabled())) { - if (this.preventNextHashChange) return this.preventNextHashChange = !1, void event.stopImmediatePropagation(); + if (this.preventNextHashChange) { + this.preventNextHashChange = !1, event.stopImmediatePropagation(); + return; + } history = this.history, hash = path1.parseLocation().hash, this.history.direct({ url: hash, present: function(historyEntry, direction) { @@ -1087,7 +1105,10 @@ eventCaptureSupported && document.addEventListener("click", function(e) { var x, y, ele, i, o, cnt = clickBlockList.length, target = e.target; if (cnt) for(x = e.clientX, y = e.clientY, threshold = $.vmouse.clickDistanceThreshold, ele = target; ele;){ - for(i = 0; i < cnt; i++)if (o = clickBlockList[i], ele === target && Math.abs(o.x - x) < threshold && Math.abs(o.y - y) < threshold || $.data(ele, "virtualTouchID") === o.touchID) return e.preventDefault(), void e.stopPropagation(); + for(i = 0; i < cnt; i++)if (o = clickBlockList[i], ele === target && Math.abs(o.x - x) < threshold && Math.abs(o.y - y) < threshold || $.data(ele, "virtualTouchID") === o.touchID) { + e.preventDefault(), e.stopPropagation(); + return; + } ele = ele.parentNode; } }, !0); @@ -1552,8 +1573,14 @@ load: function(url, options) { var fileUrl, dataUrl, pblEvent, triggerData, deferred = options && options.deferred || $.Deferred(), settings = $.extend({ }, this._loadDefaults, options), content = null, absUrl = $.mobile.path.makeUrlAbsolute(url, this._findBaseWithDefault()); - if (settings.reload = settings.reloadPage, settings.data && "get" === settings.type && (absUrl = $.mobile.path.addSearchParams(absUrl, settings.data), settings.data = undefined), settings.data && "post" === settings.type && (settings.reload = !0), fileUrl = this._createFileUrl(absUrl), dataUrl = this._createDataUrl(absUrl), 0 === (content = this._find(absUrl)).length && $.mobile.path.isEmbeddedPage(fileUrl) && !$.mobile.path.isFirstPageUrl(fileUrl)) return void deferred.reject(absUrl, settings); - if (this._getBase().reset(), content.length && !settings.reload) return this._enhance(content, settings.role), deferred.resolve(absUrl, settings, content), void (settings.prefetch || this._getBase().set(url)); + if (settings.reload = settings.reloadPage, settings.data && "get" === settings.type && (absUrl = $.mobile.path.addSearchParams(absUrl, settings.data), settings.data = undefined), settings.data && "post" === settings.type && (settings.reload = !0), fileUrl = this._createFileUrl(absUrl), dataUrl = this._createDataUrl(absUrl), 0 === (content = this._find(absUrl)).length && $.mobile.path.isEmbeddedPage(fileUrl) && !$.mobile.path.isFirstPageUrl(fileUrl)) { + deferred.reject(absUrl, settings); + return; + } + if (this._getBase().reset(), content.length && !settings.reload) { + this._enhance(content, settings.role), deferred.resolve(absUrl, settings, content), settings.prefetch || this._getBase().set(url); + return; + } if (triggerData = { url: url, absUrl: absUrl, @@ -1561,7 +1588,10 @@ deferred: deferred, options: settings }, !((pblEvent = this._triggerWithDeprecated("beforeload", triggerData)).deprecatedEvent.isDefaultPrevented() || pblEvent.event.isDefaultPrevented())) { - if (settings.showLoadMsg && this._showLoading(settings.loadMsgDelay), undefined === settings.prefetch && this._getBase().reset(), !($.mobile.allowCrossDomainPages || $.mobile.path.isSameDomain($.mobile.path.documentUrl, absUrl))) return void deferred.reject(absUrl, settings); + if (settings.showLoadMsg && this._showLoading(settings.loadMsgDelay), undefined === settings.prefetch && this._getBase().reset(), !($.mobile.allowCrossDomainPages || $.mobile.path.isSameDomain($.mobile.path.documentUrl, absUrl))) { + deferred.reject(absUrl, settings); + return; + } $.ajax({ url: fileUrl, type: settings.type, @@ -1621,7 +1651,10 @@ }), "string" === $.type(to) ? triggerData.absUrl = $.mobile.path.makeUrlAbsolute(to, this._findBaseWithDefault()) : triggerData.absUrl = settings.absUrl, this.element.trigger(pbcEvent, triggerData), !pbcEvent.isDefaultPrevented(); }, change: function(to, options) { - if (isPageTransitioning) return void pageTransitionQueue.unshift(arguments); + if (isPageTransitioning) { + pageTransitionQueue.unshift(arguments); + return; + } var settings = $.extend({ }, $.mobile.changePage.defaults, options), triggerData = { }; @@ -1629,14 +1662,20 @@ }, transition: function(toPage, triggerData, settings) { var fromPage, url, pageUrl, active, activeIsInitialPage, historyDir, pageTitle, isDialog, alreadyThere, newPageTitle, params, cssTransitionDeferred, beforeTransition; - if (isPageTransitioning) return void pageTransitionQueue.unshift([ - toPage, - settings - ]); + if (isPageTransitioning) { + pageTransitionQueue.unshift([ + toPage, + settings + ]); + return; + } if (this._triggerPageBeforeChange(toPage, triggerData, settings) && !((beforeTransition = this._triggerWithDeprecated("beforetransition", triggerData)).deprecatedEvent.isDefaultPrevented() || beforeTransition.event.isDefaultPrevented())) { - if (isPageTransitioning = !0, toPage[0] !== $.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, pageUrl = url = settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), $.mobile.path.getFilePath(url), active = $.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) return isPageTransitioning = !1, this._triggerWithDeprecated("transition", triggerData), this.element.trigger("pagechange", triggerData), void (settings.fromHashChange && $.mobile.navigate.history.direct({ - url: url - })); + if (isPageTransitioning = !0, toPage[0] !== $.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, pageUrl = url = settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), $.mobile.path.getFilePath(url), active = $.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) { + isPageTransitioning = !1, this._triggerWithDeprecated("transition", triggerData), this.element.trigger("pagechange", triggerData), settings.fromHashChange && $.mobile.navigate.history.direct({ + url: url + }); + return; + } toPage.page({ role: settings.role }), settings.fromHashChange && (historyDir = "back" === settings.direction ? -1 : 1); @@ -1681,7 +1720,10 @@ this.phonegapNavigationEnabled && nav && nav.app && nav.app.backHistory ? nav.app.backHistory() : $.mobile.pageContainer.pagecontainer("back"); }, $.mobile.focusPage = function(page) { var autofocus = page.find("[autofocus]"), pageTitle = page.find(".ui-title:eq(0)"); - if (autofocus.length) return void autofocus.focus(); + if (autofocus.length) { + autofocus.focus(); + return; + } pageTitle.length ? pageTitle.focus() : page.focus(); }, $.mobile._maybeDegradeTransition = $.mobile._maybeDegradeTransition || function(transition) { return transition; @@ -1742,12 +1784,19 @@ }; if ($.mobile.activeClickedLink && $.mobile.activeClickedLink[0] === event.target.parentNode && httpCleanup(), link && !(event.which > 1) && $link.jqmHijackable().length) { if ($link.is(":jqmData(rel='back')")) return $.mobile.back(), !1; - if (baseUrl = $.mobile.getClosestBaseUrl($link), href = $.mobile.path.makeUrlAbsolute($link.attr("href") || "#", baseUrl), !$.mobile.ajaxEnabled && !$.mobile.path.isEmbeddedPage(href)) return void httpCleanup(); - if (-1 !== href.search("#")) { - if (!(href = href.replace(/[^#]*#/, ""))) return void event.preventDefault(); - href = $.mobile.path.isPath(href) ? $.mobile.path.makeUrlAbsolute(href, baseUrl) : $.mobile.path.makeUrlAbsolute("#" + href, documentUrl.hrefNoHash); + if (baseUrl = $.mobile.getClosestBaseUrl($link), href = $.mobile.path.makeUrlAbsolute($link.attr("href") || "#", baseUrl), !$.mobile.ajaxEnabled && !$.mobile.path.isEmbeddedPage(href)) { + httpCleanup(); + return; + } + if (-1 !== href.search("#")) if (href = href.replace(/[^#]*#/, "")) href = $.mobile.path.isPath(href) ? $.mobile.path.makeUrlAbsolute(href, baseUrl) : $.mobile.path.makeUrlAbsolute("#" + href, documentUrl.hrefNoHash); + else { + event.preventDefault(); + return; + } + if ($link.is("[rel='external']") || $link.is(":jqmData(ajax='false')") || $link.is("[target]") || $.mobile.path.isExternal(href) && !$.mobile.path.isPermittedCrossDomainRequest(documentUrl, href)) { + httpCleanup(); + return; } - if ($link.is("[rel='external']") || $link.is(":jqmData(ajax='false')") || $link.is("[target]") || $.mobile.path.isExternal(href) && !$.mobile.path.isPermittedCrossDomainRequest(documentUrl, href)) return void httpCleanup(); transition = $link.jqmData("transition"), reverse = "reverse" === $link.jqmData("direction") || $link.jqmData("back"), role = $link.attr("data-" + $.mobile.ns + "rel") || undefined, $.mobile.changePage(href, { transition: transition, reverse: reverse, @@ -2299,7 +2348,11 @@ }, _handleLabelVClick: function(event) { var input = this.element; - return input.is(":disabled") ? void event.preventDefault() : (this._cacheVals(), input.prop("checked", "radio" === this.inputtype || !input.prop("checked")), input.triggerHandler("click"), this._getInputSet().not(input).prop("checked", !1), this._updateAll(), !1); + if (input.is(":disabled")) { + event.preventDefault(); + return; + } + return this._cacheVals(), input.prop("checked", "radio" === this.inputtype || !input.prop("checked")), input.triggerHandler("click"), this._getInputSet().not(input).prop("checked", !1), this._updateAll(), !1; }, _cacheVals: function() { this._getInputSet().each(function() { @@ -3299,7 +3352,10 @@ }), self._prerequisites = prerequisites; }, _animate: function(args) { - if (this._ui.screen.removeClass(args.classToRemove).addClass(args.screenClassToAdd), args.prerequisites.screen.resolve(), args.transition && "none" !== args.transition && (args.applyTransition && this._applyTransition(args.transition), this._fallbackTransition)) return void this._ui.container.addClass(args.containerClassToAdd).removeClass(args.classToRemove).animationComplete($.proxy(args.prerequisites.container, "resolve")); + if (this._ui.screen.removeClass(args.classToRemove).addClass(args.screenClassToAdd), args.prerequisites.screen.resolve(), args.transition && "none" !== args.transition && (args.applyTransition && this._applyTransition(args.transition), this._fallbackTransition)) { + this._ui.container.addClass(args.containerClassToAdd).removeClass(args.classToRemove).animationComplete($.proxy(args.prerequisites.container, "resolve")); + return; + } this._ui.container.removeClass(args.classToRemove), args.prerequisites.container.resolve(); }, _desiredCoords: function(openOptions) { @@ -3521,7 +3577,7 @@ }); }, close: function() { - !this.options.disabled && this.isOpen && ("page" === this.menuType ? (this.menuPage.dialog("close"), this.list.appendTo(this.listbox)) : this.listbox.popup("close"), this._focusButton(), this.isOpen = !1); + this.options.disabled || !this.isOpen || ("page" === this.menuType ? (this.menuPage.dialog("close"), this.list.appendTo(this.listbox)) : this.listbox.popup("close"), this._focusButton(), this.isOpen = !1); }, open: function() { this.button.click(); @@ -4010,7 +4066,10 @@ _setOptions: function(opts) { var newTheme, oldTheme = this.options.theme, ar = this._ui.arrow, ret = this._super(opts); if (undefined !== opts.arrow) { - if (!ar && opts.arrow) return void (this._ui.arrow = this._addArrow()); + if (!ar && opts.arrow) { + this._ui.arrow = this._addArrow(); + return; + } ar && !opts.arrow && (ar.arEls.remove(), this._ui.arrow = null); } return (ar = this._ui.arrow) && (undefined !== opts.theme && (oldTheme = this._themeClassFromOption("ui-body-", oldTheme), newTheme = this._themeClassFromOption("ui-body-", opts.theme), ar.ar.removeClass(oldTheme).addClass(newTheme)), undefined !== opts.shadow && ar.ar.toggleClass("ui-overlay-shadow", opts.shadow)), ret; @@ -4530,9 +4589,11 @@ selectedIndex = 0; break; case $.ui.keyCode.SPACE: - return event.preventDefault(), clearTimeout(this.activating), void this._activate(selectedIndex); + event.preventDefault(), clearTimeout(this.activating), this._activate(selectedIndex); + return; case $.ui.keyCode.ENTER: - return event.preventDefault(), clearTimeout(this.activating), void this._activate(selectedIndex !== this.options.active && selectedIndex); + event.preventDefault(), clearTimeout(this.activating), this._activate(selectedIndex !== this.options.active && selectedIndex); + return; default: return; } @@ -4559,7 +4620,15 @@ return index = this._findNextTab(index, goingForward), this.tabs.eq(index).focus(), index; }, _setOption: function(key, value) { - return "active" === key ? void this._activate(value) : "disabled" === key ? void this._setupDisabled(value) : void (this._super(key, value), "collapsible" !== key || (this.element.toggleClass("ui-tabs-collapsible", value), value || !1 !== this.options.active || this._activate(0)), "event" === key && this._setupEvents(value), "heightStyle" === key && this._setupHeightStyle(value)); + if ("active" === key) { + this._activate(value); + return; + } + if ("disabled" === key) { + this._setupDisabled(value); + return; + } + this._super(key, value), "collapsible" !== key || (this.element.toggleClass("ui-tabs-collapsible", value), value || !1 !== this.options.active || this._activate(0)), "event" === key && this._setupEvents(value), "heightStyle" === key && this._setupHeightStyle(value); }, _tabId: function(tab) { return tab.attr("aria-controls") || "ui-tabs-" + ++tabId; @@ -4757,7 +4826,10 @@ })(jQuery), (function($, window) { $.mobile.iosorientationfixEnabled = !0; var zoom, evt, x, y, z, aig, ua = navigator.userAgent; - if (!(/iPhone|iPad|iPod/.test(navigator.platform) && /OS [1-5]_[0-9_]* like Mac OS X/i.test(ua) && ua.indexOf("AppleWebKit") > -1)) return void ($.mobile.iosorientationfixEnabled = !1); + if (!(/iPhone|iPad|iPod/.test(navigator.platform) && /OS [1-5]_[0-9_]* like Mac OS X/i.test(ua) && ua.indexOf("AppleWebKit") > -1)) { + $.mobile.iosorientationfixEnabled = !1; + return; + } function checkTilt(e) { x = Math.abs((aig = (evt = e.originalEvent).accelerationIncludingGravity).x), y = Math.abs(aig.y), z = Math.abs(aig.z), !window.orientation && (x > 7 || (z > 6 && y < 8 || z < 8 && y > 6) && x > 5) ? zoom.enabled && zoom.disable() : zoom.enabled || zoom.enable(); } diff --git a/ecmascript/minifier/tests/projects/output/mootools-1.4.5.js b/ecmascript/minifier/tests/projects/output/mootools-1.4.5.js index 4715096a74a..57ff3df1907 100644 --- a/ecmascript/minifier/tests/projects/output/mootools-1.4.5.js +++ b/ecmascript/minifier/tests/projects/output/mootools-1.4.5.js @@ -683,13 +683,12 @@ var $try = Function.attempt; toQueryString: function(object, base) { var queryString = []; return Object.each(object, function(value, key) { - var result; switch(base && (key = base + "[" + key + "]"), typeOf(value)){ case "object": result = Object.toQueryString(value, key); break; case "array": - var qs = { + var result, qs = { }; value.each(function(val, i) { qs[i] = val; @@ -1545,7 +1544,8 @@ Event.Keys = { if (this.contains(this.root, node)) return; break getById; } - return void this.push(item, tag, null, classes, attributes, pseudos); + this.push(item, tag, null, classes, attributes, pseudos); + return; } getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN) { if (!((children = node.getElementsByClassName(classList.join(" "))) && children.length)) break getByClass; @@ -1743,7 +1743,7 @@ var Element = function(tag, props) { var parsed = Slick.parse(tag).expressions[0][0]; tag = "*" == parsed.tag ? "div" : parsed.tag, parsed.id && null == props.id && (props.id = parsed.id); var attributes = parsed.attributes; - if (attributes) for(var attr, i = 0, l = attributes.length; i < l; i++)null == props[(attr = attributes[i]).key] && (null != attr.value && "=" == attr.operator ? props[attr.key] = attr.value : attr.value || attr.operator || (props[attr.key] = !0)); + if (attributes) for(var attr, i = 0, l = attributes.length; i < l; i++)null != props[(attr = attributes[i]).key] || (null != attr.value && "=" == attr.operator ? props[attr.key] = attr.value : attr.value || attr.operator || (props[attr.key] = !0)); parsed.classList && null == props.class && (props.class = parsed.classList.join(" ")); } return document.newElement(tag, props); @@ -3186,7 +3186,7 @@ Elements.prototype = { return m.toLowerCase(); }) : null; selectorText && selectorTest.test(selectorText) && Object.each(Element.Styles, function(value, style) { - rule.style[style] && !Element.ShortStyles[style] && (value = String(rule.style[style]), to[style] = /^rgb/.test(value) ? value.rgbToHex() : value); + !rule.style[style] || Element.ShortStyles[style] || (value = String(rule.style[style]), to[style] = /^rgb/.test(value) ? value.rgbToHex() : value); }); } }); @@ -3705,10 +3705,11 @@ Elements.prototype = { try { json = this.response.json = JSON.decode(text, this.options.secure); } catch (error) { - return void this.fireEvent("error", [ + this.fireEvent("error", [ text, error ]); + return; } null == json ? this.onFailure() : this.onSuccess(json, text); } diff --git a/ecmascript/minifier/tests/projects/output/react-17.0.2.js b/ecmascript/minifier/tests/projects/output/react-17.0.2.js index eccf240e2f0..fba72c71ec0 100644 --- a/ecmascript/minifier/tests/projects/output/react-17.0.2.js +++ b/ecmascript/minifier/tests/projects/output/react-17.0.2.js @@ -680,7 +680,10 @@ return getCurrentTime() >= deadline; }, requestPaint = function() { }, forceFrameRate = function(fps) { - if (fps < 0 || fps > 125) return void console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"); + if (fps < 0 || fps > 125) { + console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"); + return; + } yieldInterval = fps > 0 ? Math.floor(1000 / fps) : 5; }; var performWorkUntilDeadline = function() { diff --git a/ecmascript/minifier/tests/projects/output/react-dom-17.0.2.js b/ecmascript/minifier/tests/projects/output/react-dom-17.0.2.js index 236ccb06769..627d3715de4 100644 --- a/ecmascript/minifier/tests/projects/output/react-dom-17.0.2.js +++ b/ecmascript/minifier/tests/projects/output/react-dom-17.0.2.js @@ -725,7 +725,10 @@ node._wrapperState.controlled || !controlled || didWarnUncontrolledToControlled || (error("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"), didWarnUncontrolledToControlled = !0), !node._wrapperState.controlled || controlled || didWarnControlledToUncontrolled || (error("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"), didWarnControlledToUncontrolled = !0), updateChecked(element, props); var value = getToStringValue(props.value), type = props.type; if (null != value) "number" === type ? (0 === value && "" === node.value || node.value != value) && (node.value = toString(value)) : node.value !== toString(value) && (node.value = toString(value)); - else if ("submit" === type || "reset" === type) return void node.removeAttribute("value"); + else if ("submit" === type || "reset" === type) { + node.removeAttribute("value"); + return; + } props.hasOwnProperty("value") ? setDefaultValue(node, props.type, value) : props.hasOwnProperty("defaultValue") && setDefaultValue(node, props.type, getToStringValue(props.defaultValue)), null == props.checked && null != props.defaultChecked && (node.defaultChecked = !!props.defaultChecked); } function postMountWrapper(element, props, isHydrating) { @@ -776,7 +779,10 @@ } } else { for(var _selectedValue = toString(getToStringValue(propValue)), defaultSelected = null, _i2 = 0; _i2 < options.length; _i2++){ - if (options[_i2].value === _selectedValue) return options[_i2].selected = !0, void (setDefaultSelected && (options[_i2].defaultSelected = !0)); + if (options[_i2].value === _selectedValue) { + options[_i2].selected = !0, setDefaultSelected && (options[_i2].defaultSelected = !0); + return; + } null !== defaultSelected || options[_i2].disabled || (defaultSelected = options[_i2]); } null !== defaultSelected && (defaultSelected.selected = !0); @@ -875,7 +881,10 @@ }), setTextContent = function(node, text) { if (text) { var firstChild = node.firstChild; - if (firstChild && firstChild === node.lastChild && 3 === firstChild.nodeType) return void (firstChild.nodeValue = text); + if (firstChild && firstChild === node.lastChild && 3 === firstChild.nodeType) { + firstChild.nodeValue = text; + return; + } } node.textContent = text; }, shorthandToLonghand = { @@ -2230,12 +2239,18 @@ var tag = nearestMounted.tag; if (13 === tag) { var instance = getSuspenseInstanceFromFiber(nearestMounted); - if (null !== instance) return queuedTarget.blockedOn = instance, void attemptHydrationAtPriority(queuedTarget.lanePriority, function() { - unstable_runWithPriority(queuedTarget.priority, function() { - attemptHydrationAtCurrentPriority(nearestMounted); + if (null !== instance) { + queuedTarget.blockedOn = instance, attemptHydrationAtPriority(queuedTarget.lanePriority, function() { + unstable_runWithPriority(queuedTarget.priority, function() { + attemptHydrationAtCurrentPriority(nearestMounted); + }); }); - }); - } else if (3 === tag && nearestMounted.stateNode.hydrate) return void (queuedTarget.blockedOn = getContainerFromFiber(nearestMounted)); + return; + } + } else if (3 === tag && nearestMounted.stateNode.hydrate) { + queuedTarget.blockedOn = getContainerFromFiber(nearestMounted); + return; + } } } queuedTarget.blockedOn = null; @@ -2492,11 +2507,20 @@ function dispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) { if (_enabled) { var allowReplay = !0; - if ((allowReplay = (4 & eventSystemFlags) == 0) && queuedDiscreteEvents.length > 0 && isReplayableDiscreteEvent(domEventName)) return void queueDiscreteEvent(null, domEventName, eventSystemFlags, targetContainer, nativeEvent); + if ((allowReplay = (4 & eventSystemFlags) == 0) && queuedDiscreteEvents.length > 0 && isReplayableDiscreteEvent(domEventName)) { + queueDiscreteEvent(null, domEventName, eventSystemFlags, targetContainer, nativeEvent); + return; + } var blockedOn = attemptToDispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent); - if (null === blockedOn) return void (allowReplay && clearIfContinuousEvent(domEventName, nativeEvent)); + if (null === blockedOn) { + allowReplay && clearIfContinuousEvent(domEventName, nativeEvent); + return; + } if (allowReplay) { - if (isReplayableDiscreteEvent(domEventName)) return void queueDiscreteEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent); + if (isReplayableDiscreteEvent(domEventName)) { + queueDiscreteEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent); + return; + } if ((function(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { switch(domEventName){ case "focusin": @@ -2615,9 +2639,8 @@ return void 0 === event.relatedTarget ? event.fromElement === event.srcElement ? event.toElement : event.fromElement : event.relatedTarget; }, movementX: function(event) { - if ("movementX" in event) return event.movementX; var event1; - return (event1 = event) !== lastMouseEvent && (lastMouseEvent && "mousemove" === event1.type ? (lastMovementX = event1.screenX - lastMouseEvent.screenX, lastMovementY = event1.screenY - lastMouseEvent.screenY) : (lastMovementX = 0, lastMovementY = 0), lastMouseEvent = event1), lastMovementX; + return "movementX" in event ? event.movementX : ((event1 = event) !== lastMouseEvent && (lastMouseEvent && "mousemove" === event1.type ? (lastMovementX = event1.screenX - lastMouseEvent.screenX, lastMovementY = event1.screenY - lastMouseEvent.screenY) : (lastMovementX = 0, lastMovementY = 0), lastMouseEvent = event1), lastMovementX); }, movementY: function(event) { return "movementY" in event ? event.movementY : lastMovementY; @@ -3464,7 +3487,10 @@ var node, state, getTargetInstFunc, handleEventFunc, elem, nodeName, elem1, nodeName1, targetNode = targetInst ? getNodeFromInstance(targetInst) : window; if ("select" === (nodeName = (elem = targetNode).nodeName && elem.nodeName.toLowerCase()) || "input" === nodeName && "file" === elem.type ? getTargetInstFunc = getTargetInstForChangeEvent : isTextInputElement(targetNode) ? isInputEventSupported ? getTargetInstFunc = getTargetInstForInputOrChangeEvent : (getTargetInstFunc = getTargetInstForInputEventPolyfill, handleEventFunc = handleEventsForInputEventPolyfill) : (nodeName1 = (elem1 = targetNode).nodeName) && "input" === nodeName1.toLowerCase() && ("checkbox" === elem1.type || "radio" === elem1.type) && (getTargetInstFunc = getTargetInstForClickEvent), getTargetInstFunc) { var inst = getTargetInstFunc(domEventName, targetInst); - if (inst) return void createAndAccumulateChangeEvent(dispatchQueue1, inst, nativeEvent1, nativeEventTarget1); + if (inst) { + createAndAccumulateChangeEvent(dispatchQueue1, inst, nativeEvent1, nativeEventTarget1); + return; + } } handleEventFunc && handleEventFunc(domEventName, targetNode, targetInst), "focusout" === domEventName && (state = (node = targetNode)._wrapperState) && state.controlled && "number" === node.type && setDefaultValue(node, "number", node.value); })(dispatchQueue1, domEventName, targetInst, nativeEvent1, nativeEventTarget1), (function(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { @@ -4138,7 +4164,10 @@ }; } function pop(cursor, fiber) { - if (index < 0) return void error("Unexpected pop."); + if (index < 0) { + error("Unexpected pop."); + return; + } fiber !== fiberStack[index] && error("Unexpected Fiber popped."), cursor.current = valueStack[index], valueStack[index] = null, fiberStack[index] = null, index--; } function push(cursor, value, fiber) { @@ -4341,7 +4370,10 @@ } ReactStrictModeWarnings.recordLegacyContextWarning = function(fiber, instance) { var strictRoot = findStrictRoot(fiber); - if (null === strictRoot) return void error("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue."); + if (null === strictRoot) { + error("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue."); + return; + } if (!didWarnAboutLegacyContext.has(fiber.type)) { var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); (null != fiber.type.contextTypes || null != fiber.type.childContextTypes || null !== instance && "function" == typeof instance.getChildContext) && (void 0 === warningsForRoot && (warningsForRoot = [], pendingLegacyContextWarning.set(strictRoot, warningsForRoot)), warningsForRoot.push(fiber)); @@ -4485,13 +4517,14 @@ }while (null !== update) null === newLast ? newFirst = newLast = capturedUpdate : (newLast.next = capturedUpdate, newLast = capturedUpdate); } else newFirst = newLast = capturedUpdate; - return queue = { + queue = { baseState: currentQueue.baseState, firstBaseUpdate: newFirst, lastBaseUpdate: newLast, shared: currentQueue.shared, effects: currentQueue.effects - }, void (workInProgress.updateQueue = queue); + }, workInProgress.updateQueue = queue; + return; } } var lastBaseUpdate = queue.lastBaseUpdate; @@ -5239,10 +5272,16 @@ function tryToClaimNextHydratableInstance(fiber) { if (isHydrating) { var nextInstance = nextHydratableInstance; - if (!nextInstance) return insertNonHydratedInstance(hydrationParentFiber, fiber), isHydrating = !1, void (hydrationParentFiber = fiber); + if (!nextInstance) { + insertNonHydratedInstance(hydrationParentFiber, fiber), isHydrating = !1, hydrationParentFiber = fiber; + return; + } var firstAttemptedInstance = nextInstance; if (!tryHydrate(fiber, nextInstance)) { - if (!(nextInstance = getNextHydratableSibling(firstAttemptedInstance)) || !tryHydrate(fiber, nextInstance)) return insertNonHydratedInstance(hydrationParentFiber, fiber), isHydrating = !1, void (hydrationParentFiber = fiber); + if (!(nextInstance = getNextHydratableSibling(firstAttemptedInstance)) || !tryHydrate(fiber, nextInstance)) { + insertNonHydratedInstance(hydrationParentFiber, fiber), isHydrating = !1, hydrationParentFiber = fiber; + return; + } deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance); } hydrationParentFiber = fiber, nextHydratableInstance = getFirstHydratableChild(nextInstance); @@ -5601,7 +5640,10 @@ var hook = updateWorkInProgressHook(), nextDeps = void 0 === deps ? null : deps, destroy = void 0; if (null !== currentHook) { var prevEffect = currentHook.memoizedState; - if (destroy = prevEffect.destroy, null !== nextDeps && areHookInputsEqual(nextDeps, prevEffect.deps)) return void pushEffect(hookFlags, create, destroy, nextDeps); + if (destroy = prevEffect.destroy, null !== nextDeps && areHookInputsEqual(nextDeps, prevEffect.deps)) { + pushEffect(hookFlags, create, destroy, nextDeps); + return; + } } currentlyRenderingFiber$1.flags |= fiberFlags, hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, nextDeps); } @@ -7547,9 +7589,11 @@ var update = createUpdate(-1, SyncLane); update.tag = 2, enqueueUpdate(sourceFiber, update); } - return void (sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane)); + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); + return; } - return attachPingListener(root, wakeable, rootRenderLanes), _workInProgress.flags |= 4096, void (_workInProgress.lanes = rootRenderLanes); + attachPingListener(root, wakeable, rootRenderLanes), _workInProgress.flags |= 4096, _workInProgress.lanes = rootRenderLanes; + return; } _workInProgress = _workInProgress.return; }while (null !== _workInProgress) @@ -7563,13 +7607,15 @@ var _errorInfo = value; workInProgress.flags |= 4096; var lane = pickArbitraryLane(rootRenderLanes); - return workInProgress.lanes = mergeLanes(workInProgress.lanes, lane), void enqueueCapturedUpdate(workInProgress, createRootErrorUpdate(workInProgress, _errorInfo, lane)); + workInProgress.lanes = mergeLanes(workInProgress.lanes, lane), enqueueCapturedUpdate(workInProgress, createRootErrorUpdate(workInProgress, _errorInfo, lane)); + return; case 1: var errorInfo = value, ctor = workInProgress.type, instance = workInProgress.stateNode; if ((workInProgress.flags & DidCapture) === NoFlags && ("function" == typeof ctor.getDerivedStateFromError || null !== instance && "function" == typeof instance.componentDidCatch && !isAlreadyFailedLegacyErrorBoundary(instance))) { workInProgress.flags |= 4096; var _lane = pickArbitraryLane(rootRenderLanes); - return workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane), void enqueueCapturedUpdate(workInProgress, createClassErrorUpdate(workInProgress, errorInfo, _lane)); + workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane), enqueueCapturedUpdate(workInProgress, createClassErrorUpdate(workInProgress, errorInfo, _lane)); + return; } break; } @@ -7604,7 +7650,8 @@ } return; case 3: - return void (256 & finishedWork.flags && clearContainer(finishedWork.stateNode.containerInfo)); + 256 & finishedWork.flags && clearContainer(finishedWork.stateNode.containerInfo); + return; case 5: case 6: case 4: @@ -7619,7 +7666,7 @@ case 11: case 15: case 22: - return !function(tag, finishedWork1) { + !function(tag, finishedWork1) { var updateQueue = finishedWork.updateQueue, lastEffect = null !== updateQueue ? updateQueue.lastEffect : null; if (null !== lastEffect) { var firstEffect = lastEffect.next, effect = firstEffect; @@ -7633,7 +7680,7 @@ effect = effect.next; }while (effect !== firstEffect) } - }(3, finishedWork), void function(finishedWork) { + }(3, finishedWork), (function(finishedWork) { var updateQueue = finishedWork.updateQueue, lastEffect = null !== updateQueue ? updateQueue.lastEffect : null; if (null !== lastEffect) { var firstEffect = lastEffect.next, effect = firstEffect; @@ -7642,7 +7689,8 @@ (4 & tag) != 0 && (1 & tag) != 0 && (enqueuePendingPassiveHookEffectUnmount(finishedWork, effect), enqueuePendingPassiveHookEffectMount(finishedWork, effect)), effect = next; }while (effect !== firstEffect) } - }(finishedWork); + })(finishedWork); + return; case 1: var instance = finishedWork.stateNode; if (finishedWork.flags & Update) if (null === current) finishedWork.type !== finishedWork.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork.memoizedProps && error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"), instance.state !== finishedWork.memoizedState && error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance")), instance.componentDidMount(); @@ -7651,7 +7699,8 @@ finishedWork.type !== finishedWork.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork.memoizedProps && error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"), instance.state !== finishedWork.memoizedState && error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance")), instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); } var updateQueue = finishedWork.updateQueue; - return void (null !== updateQueue && (finishedWork.type !== finishedWork.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork.memoizedProps && error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"), instance.state !== finishedWork.memoizedState && error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance")), commitUpdateQueue(finishedWork, updateQueue, instance))); + null !== updateQueue && (finishedWork.type !== finishedWork.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork.memoizedProps && error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"), instance.state !== finishedWork.memoizedState && error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance")), commitUpdateQueue(finishedWork, updateQueue, instance)); + return; case 3: var _updateQueue = finishedWork.updateQueue; if (null !== _updateQueue) { @@ -7668,7 +7717,8 @@ } return; case 5: - return void (null === current && finishedWork.flags & Update && shouldAutoFocusHostComponent(finishedWork.type, finishedWork.memoizedProps) && finishedWork.stateNode.focus()); + null === current && finishedWork.flags & Update && shouldAutoFocusHostComponent(finishedWork.type, finishedWork.memoizedProps) && finishedWork.stateNode.focus(); + return; case 6: return; case 4: @@ -7677,9 +7727,11 @@ var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender; finishedWork.stateNode.effectDuration; var commitTime1 = commitTime; - return void ("function" == typeof onRender && onRender(finishedWork.memoizedProps.id, null === current ? "mount" : "update", finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime1, finishedRoot.memoizedInteractions)); + "function" == typeof onRender && onRender(finishedWork.memoizedProps.id, null === current ? "mount" : "update", finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime1, finishedRoot.memoizedInteractions); + return; case 13: - return void commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); + commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); + return; case 19: case 17: case 20: @@ -7757,11 +7809,14 @@ case 1: safelyDetachRef(current); var current1, instance = current.stateNode; - return void ("function" != typeof instance.componentWillUnmount || (invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current1 = current, instance), hasCaughtError(), captureCommitPhaseError(current1, clearCaughtError()))); + "function" != typeof instance.componentWillUnmount || (invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current1 = current, instance), hasCaughtError() && captureCommitPhaseError(current1, clearCaughtError())); + return; case 5: - return void safelyDetachRef(current); + safelyDetachRef(current); + return; case 4: - return void unmountHostComponents(finishedRoot, current); + unmountHostComponents(finishedRoot, current); + return; case 20: return; case 18: @@ -7910,7 +7965,7 @@ case 14: case 15: case 22: - return void !function(tag, finishedWork1) { + !function(tag, finishedWork1) { var updateQueue = finishedWork.updateQueue, lastEffect = null !== updateQueue ? updateQueue.lastEffect : null; if (null !== lastEffect) { var firstEffect = lastEffect.next, effect = firstEffect; @@ -7923,6 +7978,7 @@ }while (effect !== firstEffect) } }(3, finishedWork); + return; case 1: return; case 5: @@ -7954,18 +8010,22 @@ case 6: if (!(null !== finishedWork.stateNode)) throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."); var textInstance = finishedWork.stateNode, newText = finishedWork.memoizedProps; - return null !== current && current.memoizedProps, void (textInstance.nodeValue = newText); + null !== current && current.memoizedProps, textInstance.nodeValue = newText; + return; case 3: var _root = finishedWork.stateNode; - return void (_root.hydrate && (_root.hydrate = !1, function(container) { + _root.hydrate && (_root.hydrate = !1, (function(container) { retryIfBlockedOn(container); - }(_root.containerInfo))); + })(_root.containerInfo)); + return; case 12: return; case 13: - return commitSuspenseComponent(finishedWork), void attachSuspenseRetryListeners(finishedWork); + commitSuspenseComponent(finishedWork), attachSuspenseRetryListeners(finishedWork); + return; case 19: - return void attachSuspenseRetryListeners(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; case 17: return; case 20: @@ -7974,7 +8034,8 @@ break; case 23: case 24: - return void hideOrUnhideAllChildren(finishedWork, null !== finishedWork.memoizedState); + hideOrUnhideAllChildren(finishedWork, null !== finishedWork.memoizedState); + return; } throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."); } @@ -8083,7 +8144,10 @@ } }(root, currentTime); var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes), newCallbackPriority = return_highestLanePriority; - if (nextLanes === NoLanes) return void (null !== existingCallbackNode && (cancelCallback(existingCallbackNode), root.callbackNode = null, root.callbackPriority = 0)); + if (nextLanes === NoLanes) { + null !== existingCallbackNode && (cancelCallback(existingCallbackNode), root.callbackNode = null, root.callbackPriority = 0); + return; + } if (null !== existingCallbackNode) { if (root.callbackPriority === newCallbackPriority) return; cancelCallback(existingCallbackNode); @@ -8247,7 +8311,10 @@ for(;;){ var erroredWork = workInProgress; try { - if (resetContextDependencies(), resetHooksAfterThrow(), resetCurrentFiber(), ReactCurrentOwner$2.current = null, null === erroredWork || null === erroredWork.return) return workInProgressRootExitStatus = 1, workInProgressRootFatalError = thrownValue, void (workInProgress = null); + if (resetContextDependencies(), resetHooksAfterThrow(), resetCurrentFiber(), ReactCurrentOwner$2.current = null, null === erroredWork || null === erroredWork.return) { + workInProgressRootExitStatus = 1, workInProgressRootFatalError = thrownValue, workInProgress = null; + return; + } enableProfilerTimer && 8 & erroredWork.mode && stopProfilerTimerIfRunningAndRecordDelta(erroredWork, !0), throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes), completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { thrownValue = yetAnotherThrownValue, workInProgress === erroredWork && null !== erroredWork ? workInProgress = erroredWork = erroredWork.return : erroredWork = workInProgress; @@ -8332,11 +8399,17 @@ if ((2048 & completedWork.flags) === NoFlags) { setCurrentFiber(completedWork); var next = void 0; - if ((8 & completedWork.mode) == 0 ? next = completeWork(current, completedWork, subtreeRenderLanes) : (startProfilerTimer(completedWork), next = completeWork(current, completedWork, subtreeRenderLanes), stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)), resetCurrentFiber(), null !== next) return void (workInProgress = next); + if ((8 & completedWork.mode) == 0 ? next = completeWork(current, completedWork, subtreeRenderLanes) : (startProfilerTimer(completedWork), next = completeWork(current, completedWork, subtreeRenderLanes), stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)), resetCurrentFiber(), null !== next) { + workInProgress = next; + return; + } resetChildLanes(completedWork), null !== returnFiber && (2048 & returnFiber.flags) === NoFlags && (null === returnFiber.firstEffect && (returnFiber.firstEffect = completedWork.firstEffect), null !== completedWork.lastEffect && (null !== returnFiber.lastEffect && (returnFiber.lastEffect.nextEffect = completedWork.firstEffect), returnFiber.lastEffect = completedWork.lastEffect), completedWork.flags > 1 && (null !== returnFiber.lastEffect ? returnFiber.lastEffect.nextEffect = completedWork : returnFiber.firstEffect = completedWork, returnFiber.lastEffect = completedWork)); } else { var _next = unwindWork(completedWork); - if (null !== _next) return _next.flags &= 2047, void (workInProgress = _next); + if (null !== _next) { + _next.flags &= 2047, workInProgress = _next; + return; + } if ((8 & completedWork.mode) != 0) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1); for(var actualDuration = completedWork.actualDuration, child = completedWork.child; null !== child;)actualDuration += child.actualDuration, child = child.sibling; @@ -8345,7 +8418,10 @@ null !== returnFiber && (returnFiber.firstEffect = returnFiber.lastEffect = null, returnFiber.flags |= 2048); } var siblingFiber = completedWork.sibling; - if (null !== siblingFiber) return void (workInProgress = siblingFiber); + if (null !== siblingFiber) { + workInProgress = siblingFiber; + return; + } workInProgress = completedWork = returnFiber; }while (null !== completedWork) 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); @@ -8630,9 +8706,15 @@ null !== root && (markRootUpdated(root, SyncLane, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, SyncLane)); } function captureCommitPhaseError(sourceFiber, error) { - if (3 === sourceFiber.tag) return void captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + if (3 === sourceFiber.tag) { + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + return; + } for(var fiber = sourceFiber.return; null !== fiber;){ - if (3 === fiber.tag) return void captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + if (3 === fiber.tag) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + return; + } if (1 === fiber.tag) { var ctor = fiber.type, instance = fiber.stateNode; if ("function" == typeof ctor.getDerivedStateFromError || "function" == typeof instance.componentDidCatch && !isAlreadyFailedLegacyErrorBoundary(instance)) { @@ -8937,11 +9019,14 @@ if (!findChildHostInstancesForFiberShallowly(fiber, hostInstances)) for(var node = fiber;;){ switch(node.tag){ case 5: - return void hostInstances.add(node.stateNode); + hostInstances.add(node.stateNode); + return; case 4: - return void hostInstances.add(node.stateNode.containerInfo); + hostInstances.add(node.stateNode.containerInfo); + return; case 3: - return void hostInstances.add(node.stateNode.containerInfo); + hostInstances.add(node.stateNode.containerInfo); + return; } if (null === node.return) throw new Error("Expected to reach root first."); node = node.return; @@ -9260,8 +9345,14 @@ }, obj); return index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], Array.isArray(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1), updated; }, copyWithRename = function(obj, oldPath, newPath) { - if (oldPath.length !== newPath.length) return void warn("copyWithRename() expects paths of the same length"); - for(var i = 0; i < newPath.length - 1; i++)if (oldPath[i] !== newPath[i]) return void warn("copyWithRename() expects paths to be the same except for the deepest key"); + if (oldPath.length !== newPath.length) { + warn("copyWithRename() expects paths of the same length"); + return; + } + for(var i = 0; i < newPath.length - 1; i++)if (oldPath[i] !== newPath[i]) { + warn("copyWithRename() expects paths to be the same except for the deepest key"); + return; + } return copyWithRenameImpl(obj, oldPath, newPath, 0); }, copyWithSetImpl = function(obj, path, index, value) { if (index >= path.length) return value; @@ -9425,7 +9516,7 @@ var props15, node, props16, value; switch(tag){ case "input": - return void (props15 = props, updateWrapper(node = domElement, props15), function(rootNode, props) { + props15 = props, updateWrapper(node = domElement, props15), (function(rootNode, props) { var name = props.name; if ("radio" === props.type && null != name) { for(var queryRoot = rootNode; queryRoot.parentNode;)queryRoot = queryRoot.parentNode; @@ -9438,11 +9529,14 @@ } } } - }(node, props15)); + })(node, props15); + return; case "textarea": - return void updateWrapper$1(domElement, props); + updateWrapper$1(domElement, props); + return; case "select": - return void (null != (value = (props16 = props).value) && updateOptions(domElement, !!props16.multiple, value, !1)); + null != (value = (props16 = props).value) && updateOptions(domElement, !!props16.multiple, value, !1); + return; } }), (function(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) { batchedUpdatesImpl = batchedUpdates$1, discreteUpdatesImpl = _discreteUpdatesImpl, flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl, batchedEventUpdatesImpl = _batchedEventUpdatesImpl; @@ -9455,7 +9549,10 @@ 0 === (executionContext = prevExecutionContext) && (resetRenderTimer(), flushSyncCallbackQueue()); } }, function() { - if ((49 & executionContext) != 0) return void ((16 & executionContext) != 0 && error("unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.")); + if ((49 & executionContext) != 0) { + (16 & executionContext) != 0 && error("unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering."); + return; + } (function() { if (null !== rootsWithPendingDiscreteUpdates) { var roots = rootsWithPendingDiscreteUpdates; diff --git a/ecmascript/minifier/tests/projects/output/underscore-1.5.2.js b/ecmascript/minifier/tests/projects/output/underscore-1.5.2.js index 03f6d7cea8e..bce52438e53 100644 --- a/ecmascript/minifier/tests/projects/output/underscore-1.5.2.js +++ b/ecmascript/minifier/tests/projects/output/underscore-1.5.2.js @@ -172,7 +172,8 @@ }, _.initial = function(array, n, guard) { return slice.call(array, 0, array.length - (null == n || guard ? 1 : n)); }, _.last = function(array, n, guard) { - if (null != array) return null == n || guard ? array[array.length - 1] : slice.call(array, Math.max(array.length - n, 0)); + if (null != array) if (null == n || guard) return array[array.length - 1]; + else return slice.call(array, Math.max(array.length - n, 0)); }, _.rest = _.tail = _.drop = function(array, n, guard) { return slice.call(array, null == n || guard ? 1 : n); }, _.compact = function(array) { diff --git a/ecmascript/minifier/tests/projects/output/yui-3.12.0.js b/ecmascript/minifier/tests/projects/output/yui-3.12.0.js index d81df3b9d56..aea5f2324b5 100644 --- a/ecmascript/minifier/tests/projects/output/yui-3.12.0.js +++ b/ecmascript/minifier/tests/projects/output/yui-3.12.0.js @@ -942,7 +942,7 @@ var YUI = function() { !this._pending && (item = this._queue.shift()) && (this._pending = item, item.transaction.execute(item.callback)); }, _purge: function(nodes) { - for(var index, node, purgeNodes = this._purgeNodes, isTransaction = nodes !== purgeNodes; node = nodes.pop();)node._yuiget_finished && (node.parentNode && node.parentNode.removeChild(node), isTransaction && (index = Y.Array.indexOf(purgeNodes, node)) > -1 && purgeNodes.splice(index, 1)); + for(var index, node, purgeNodes = this._purgeNodes, isTransaction = nodes !== purgeNodes; node = nodes.pop();)!!node._yuiget_finished && (node.parentNode && node.parentNode.removeChild(node), isTransaction && (index = Y.Array.indexOf(purgeNodes, node)) > -1 && purgeNodes.splice(index, 1)); } }, Get.script = Get.js, Get.Transaction = Transaction = function(requests, options) { this.id = Transaction._lastId += 1, this.data = options.data, this.errors = [], this.nodes = [], this.options = options, this.requests = requests, this._callbacks = [], this._queue = [], this._reqsWaiting = 0, this.tId = this.id, this.win = options.win || Y.config.win; @@ -955,7 +955,10 @@ var YUI = function() { }, execute: function(callback) { var i, len, queue, req, self = this, requests = self.requests, state = self._state; - if ("done" === state) return void (callback && callback(self.errors.length ? self.errors : null, self)); + if ("done" === state) { + callback && callback(self.errors.length ? self.errors : null, self); + return; + } if (callback && self._callbacks.push(callback), "executing" !== state) { for(self._state = "executing", self._queue = queue = [], self.options.timeout && (self._timeout = setTimeout(function() { self.abort("Timeout"); @@ -1711,9 +1714,12 @@ var YUI = function() { } d && d.fn && (fn = d.fn, delete d.fn, fn.call(self, d)); } - }, this._loading = !0, !modules.js.length && !modules.css.length) return actions = -1, void complete({ - fn: self._onSuccess - }); + }, this._loading = !0, !modules.js.length && !modules.css.length) { + actions = -1, complete({ + fn: self._onSuccess + }); + return; + } modules.css.length && Y.Get.css(modules.css, { data: modules.cssMods, attributes: self.cssAttributes, diff --git a/ecmascript/minifier/tests/terser/compress/issue-611/issue_611/output.js b/ecmascript/minifier/tests/terser/compress/issue-611/issue_611/output.js index a8181e17934..11579db6786 100644 --- a/ecmascript/minifier/tests/terser/compress/issue-611/issue_611/output.js +++ b/ecmascript/minifier/tests/terser/compress/issue-611/issue_611/output.js @@ -1,4 +1,8 @@ -define(function () { - function fn() {} - if (fn()) return void fn(); +define(function() { + function fn() { + } + if (fn()) { + fn(); + return; + } }); diff --git a/ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/config.json b/ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/config.json similarity index 100% rename from ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/config.json rename to ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/config.json diff --git a/ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/expected.stdout b/ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/expected.stdout similarity index 100% rename from ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/expected.stdout rename to ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/expected.stdout diff --git a/ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/input.js b/ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/input.js similarity index 100% rename from ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/input.js rename to ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/input.js diff --git a/ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/output.js b/ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/output.js similarity index 100% rename from ecmascript/minifier/tests/terser/compress/logical-assignment/assignment_in_left_part/output.js rename to ecmascript/minifier/tests/terser/compress/logical-assignment/.assignment_in_left_part/output.js diff --git a/ecmascript/minifier/yarn.lock b/ecmascript/minifier/yarn.lock index 711d0f2a86f..6876b0c3307 100644 --- a/ecmascript/minifier/yarn.lock +++ b/ecmascript/minifier/yarn.lock @@ -2,6 +2,40 @@ # yarn lockfile v1 +"@ant-design/colors@^6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-6.0.0.tgz#9b9366257cffcc47db42b9d0203bb592c13c0298" + integrity sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ== + dependencies: + "@ctrl/tinycolor" "^3.4.0" + +"@ant-design/icons-svg@^4.0.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@ant-design/icons-svg/-/icons-svg-4.1.0.tgz#480b025f4b20ef7fe8f47d4a4846e4fee84ea06c" + integrity sha512-Fi03PfuUqRs76aI3UWYpP864lkrfPo0hluwGqh7NJdLhvH4iRDc3jbJqZIvRDLHKbXrvAfPPV3+zjUccfFvWOQ== + +"@ant-design/icons@^4.6.3": + version "4.6.4" + resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-4.6.4.tgz#21b037dbb90ee1bb7c632cca057006e57d992fd9" + integrity sha512-li02J8ym721E24N3bw1oXRzFDV7m2MYQWs+WtJgVVjhNRv4sc6vL2a2M7SS8rWX3Uc/3GJfrokIJnMrmbIMuXQ== + dependencies: + "@ant-design/colors" "^6.0.0" + "@ant-design/icons-svg" "^4.0.0" + "@babel/runtime" "^7.11.2" + classnames "^2.2.6" + rc-util "^5.9.4" + +"@ant-design/react-slick@~0.28.1": + version "0.28.4" + resolved "https://registry.yarnpkg.com/@ant-design/react-slick/-/react-slick-0.28.4.tgz#8b296b87ad7c7ae877f2a527b81b7eebd9dd29a9" + integrity sha512-j9eAHTn7GxbXUFNknJoHS2ceAsqrQi2j8XykjZE1IXCD8kJF+t28EvhBLniDpbOsBk/3kjalnhriTfZcjBHNqg== + dependencies: + "@babel/runtime" "^7.10.4" + classnames "^2.2.5" + json2mq "^0.2.0" + lodash "^4.17.21" + resize-observer-polyfill "^1.5.0" + "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" @@ -74,6 +108,13 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.3.tgz#3416d9bea748052cfcb63dbcc27368105b1ed862" integrity sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA== +"@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.8.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a" + integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.14.5.tgz#a9bc9d8b33354ff6e55a9c60d1109200a68974f4" @@ -106,6 +147,11 @@ "@babel/helper-validator-identifier" "^7.14.9" to-fast-properties "^2.0.0" +"@ctrl/tinycolor@^3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f" + integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ== + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -189,6 +235,53 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +antd@^4.16.13: + version "4.16.13" + resolved "https://registry.yarnpkg.com/antd/-/antd-4.16.13.tgz#e9b9b4a590db28747aae1cab98981649a35880af" + integrity sha512-EMPD3fzKe7oayx9keD/GA1oKatcx7j5CGlkJj5eLS0/eEDDEkxVj3DFmKOPuHYt4BK7ltTzMFS+quSTmqUXPiw== + dependencies: + "@ant-design/colors" "^6.0.0" + "@ant-design/icons" "^4.6.3" + "@ant-design/react-slick" "~0.28.1" + "@babel/runtime" "^7.12.5" + array-tree-filter "^2.1.0" + classnames "^2.2.6" + copy-to-clipboard "^3.2.0" + lodash "^4.17.21" + moment "^2.25.3" + rc-cascader "~1.4.0" + rc-checkbox "~2.3.0" + rc-collapse "~3.1.0" + rc-dialog "~8.6.0" + rc-drawer "~4.3.0" + rc-dropdown "~3.2.0" + rc-field-form "~1.20.0" + rc-image "~5.2.5" + rc-input-number "~7.1.0" + rc-mentions "~1.6.1" + rc-menu "~9.0.12" + rc-motion "^2.4.0" + rc-notification "~4.5.7" + rc-pagination "~3.1.9" + rc-picker "~2.5.10" + rc-progress "~3.1.0" + rc-rate "~2.9.0" + rc-resize-observer "^1.0.0" + rc-select "~12.1.6" + rc-slider "~9.7.1" + rc-steps "~4.1.0" + rc-switch "~3.2.0" + rc-table "~7.15.1" + rc-tabs "~11.10.0" + rc-textarea "~0.3.0" + rc-tooltip "~5.1.1" + rc-tree "~4.2.1" + rc-tree-select "~4.3.0" + rc-trigger "^5.2.10" + rc-upload "~4.3.0" + rc-util "^5.13.1" + scroll-into-view-if-needed "^2.2.25" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -196,11 +289,21 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +array-tree-filter@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-tree-filter/-/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190" + integrity sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw== + astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== +async-validator@^3.0.3: + version "3.5.2" + resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-3.5.2.tgz#68e866a96824e8b2694ff7a831c1a25c44d5e500" + integrity sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ== + babel-eslint@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" @@ -248,6 +351,11 @@ chalk@^4.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6: + version "2.3.1" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e" + integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA== + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -272,11 +380,23 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +compute-scroll-into-view@^1.0.17: + version "1.0.17" + resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz#6a88f18acd9d42e9cf4baa6bec7e0522607ab7ab" + integrity sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= +copy-to-clipboard@^3.2.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae" + integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw== + dependencies: + toggle-selection "^1.0.6" + cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -286,6 +406,16 @@ cross-spawn@^7.0.2: shebang-command "^2.0.0" which "^2.0.1" +date-fns@2.x: + version "2.23.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.23.0.tgz#4e886c941659af0cf7b30fafdd1eaa37e88788a9" + integrity sha512-5ycpauovVyAk0kXNZz6ZoB9AYMZB4DObse7P3BPWmyEjXNORTI8EJ6X0uaSAq4sCHzM1uajzrkr6HnsLQpxGXA== + +dayjs@1.x: + version "1.10.7" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468" + integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig== + debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.3.2" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" @@ -305,6 +435,11 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dom-align@^1.7.0: + version "1.12.2" + resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.12.2.tgz#0f8164ebd0c9c21b0c790310493cd855892acd4b" + integrity sha512-pHuazgqrsTFrGU2WLDdXxCFabkdQDx72ddkraZNih1KsMcN5qsRSTR9O4VJRlwTPCPb5COYg3LOfiMHHcPInHg== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -599,7 +734,7 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= -js-tokens@^4.0.0: +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== @@ -632,6 +767,13 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= +json2mq@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/json2mq/-/json2mq-0.2.0.tgz#b637bd3ba9eabe122c83e9720483aeb10d2c904a" + integrity sha1-tje9O6nqvhIsg+lyBIOusQ0skEo= + dependencies: + string-convert "^0.2.0" + levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -655,6 +797,18 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -669,6 +823,11 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" +moment@^2.24.0, moment@^2.25.3: + version "2.29.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" + integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -735,6 +894,360 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +rc-align@^4.0.0: + version "4.0.11" + resolved "https://registry.yarnpkg.com/rc-align/-/rc-align-4.0.11.tgz#8198c62db266bc1b8ef05e56c13275bf72628a5e" + integrity sha512-n9mQfIYQbbNTbefyQnRHZPWuTEwG1rY4a9yKlIWHSTbgwI+XUMGRYd0uJ5pE2UbrNX0WvnMBA1zJ3Lrecpra/A== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + dom-align "^1.7.0" + lodash "^4.17.21" + rc-util "^5.3.0" + resize-observer-polyfill "^1.5.1" + +rc-cascader@~1.4.0: + version "1.4.3" + resolved "https://registry.yarnpkg.com/rc-cascader/-/rc-cascader-1.4.3.tgz#d91b0dcf8157b60ebe9ec3e58b4db054d5299464" + integrity sha512-Q4l9Mv8aaISJ+giVnM9IaXxDeMqHUGLvi4F+LksS6pHlaKlN4awop/L+IMjIXpL+ug/ojaCyv/ixcVopJYYCVA== + dependencies: + "@babel/runtime" "^7.12.5" + array-tree-filter "^2.1.0" + rc-trigger "^5.0.4" + rc-util "^5.0.1" + warning "^4.0.1" + +rc-checkbox@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/rc-checkbox/-/rc-checkbox-2.3.2.tgz#f91b3678c7edb2baa8121c9483c664fa6f0aefc1" + integrity sha512-afVi1FYiGv1U0JlpNH/UaEXdh6WUJjcWokj/nUN2TgG80bfG+MDdbfHKlLcNNba94mbjy2/SXJ1HDgrOkXGAjg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + +rc-collapse@~3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rc-collapse/-/rc-collapse-3.1.2.tgz#76028a811b845d03d9460ccc409c7ea8ad09db14" + integrity sha512-HujcKq7mghk/gVKeI6EjzTbb8e19XUZpakrYazu1MblEZ3Hu3WBMSN4A3QmvbF6n1g7x6lUlZvsHZ5shABWYOQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.3.4" + rc-util "^5.2.1" + shallowequal "^1.1.0" + +rc-dialog@~8.6.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/rc-dialog/-/rc-dialog-8.6.0.tgz#3b228dac085de5eed8c6237f31162104687442e7" + integrity sha512-GSbkfqjqxpZC5/zc+8H332+q5l/DKUhpQr0vdX2uDsxo5K0PhvaMEVjyoJUTkZ3+JstEADQji1PVLVb/2bJeOQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-motion "^2.3.0" + rc-util "^5.6.1" + +rc-drawer@~4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-4.3.1.tgz#356333a7af01b777abd685c96c2ce62efb44f3f3" + integrity sha512-GMfFy4maqxS9faYXEhQ+0cA1xtkddEQzraf6SAdzWbn444DrrLogwYPk1NXSpdXjLCLxgxOj9MYtyYG42JsfXg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-util "^5.7.0" + +rc-dropdown@^3.2.0, rc-dropdown@~3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/rc-dropdown/-/rc-dropdown-3.2.0.tgz#da6c2ada403842baee3a9e909a0b1a91ba3e1090" + integrity sha512-j1HSw+/QqlhxyTEF6BArVZnTmezw2LnSmRk6I9W7BCqNCKaRwleRmMMs1PHbuaG8dKHVqP6e21RQ7vPBLVnnNw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-trigger "^5.0.4" + +rc-field-form@~1.20.0: + version "1.20.1" + resolved "https://registry.yarnpkg.com/rc-field-form/-/rc-field-form-1.20.1.tgz#d1c51888107cf075b42704b7b575bef84c359291" + integrity sha512-f64KEZop7zSlrG4ef/PLlH12SLn6iHDQ3sTG+RfKBM45hikwV1i8qMf53xoX12NvXXWg1VwchggX/FSso4bWaA== + dependencies: + "@babel/runtime" "^7.8.4" + async-validator "^3.0.3" + rc-util "^5.8.0" + +rc-image@~5.2.5: + version "5.2.5" + resolved "https://registry.yarnpkg.com/rc-image/-/rc-image-5.2.5.tgz#44e6ffc842626827960e7ab72e1c0d6f3a8ce440" + integrity sha512-qUfZjYIODxO0c8a8P5GeuclYXZjzW4hV/5hyo27XqSFo1DmTCs2HkVeQObkcIk5kNsJtgsj1KoPThVsSc/PXOw== + dependencies: + "@babel/runtime" "^7.11.2" + classnames "^2.2.6" + rc-dialog "~8.6.0" + rc-util "^5.0.6" + +rc-input-number@~7.1.0: + version "7.1.4" + resolved "https://registry.yarnpkg.com/rc-input-number/-/rc-input-number-7.1.4.tgz#9d7410c91ff8dc6384d0233c20df278982989f9a" + integrity sha512-EG4iqkqyqzLRu/Dq+fw2od7nlgvXLEatE+J6uhi3HXE1qlM3C7L6a7o/hL9Ly9nimkES2IeQoj3Qda3I0izj3Q== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.9.8" + +rc-mentions@~1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/rc-mentions/-/rc-mentions-1.6.1.tgz#46035027d64aa33ef840ba0fbd411871e34617ae" + integrity sha512-LDzGI8jJVGnkhpTZxZuYBhMz3avcZZqPGejikchh97xPni/g4ht714Flh7DVvuzHQ+BoKHhIjobHnw1rcP8erg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-menu "^9.0.0" + rc-textarea "^0.3.0" + rc-trigger "^5.0.4" + rc-util "^5.0.1" + +rc-menu@^9.0.0, rc-menu@~9.0.12: + version "9.0.12" + resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-9.0.12.tgz#492c4bb07a596e2ce07587c669b27ee28c3810c5" + integrity sha512-8uy47DL36iDEwVZdUO/fjhhW5+4j0tYlrCsOzw6iy8MJqKL7/HC2pj7sL/S9ayp2+hk9fYQYB9Tu+UN+N2OOOQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.4.3" + rc-overflow "^1.2.0" + rc-trigger "^5.1.2" + rc-util "^5.12.0" + shallowequal "^1.1.0" + +rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.0, rc-motion@^2.4.3: + version "2.4.4" + resolved "https://registry.yarnpkg.com/rc-motion/-/rc-motion-2.4.4.tgz#e995d5fa24fc93065c24f714857cf2677d655bb0" + integrity sha512-ms7n1+/TZQBS0Ydd2Q5P4+wJTSOrhIrwNxLXCZpR7Fa3/oac7Yi803HDALc2hLAKaCTQtw9LmQeB58zcwOsqlQ== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.2.1" + +rc-notification@~4.5.7: + version "4.5.7" + resolved "https://registry.yarnpkg.com/rc-notification/-/rc-notification-4.5.7.tgz#265e6e6a0c1a0fac63d6abd4d832eb8ff31522f1" + integrity sha512-zhTGUjBIItbx96SiRu3KVURcLOydLUHZCPpYEn1zvh+re//Tnq/wSxN4FKgp38n4HOgHSVxcLEeSxBMTeBBDdw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.2.0" + rc-util "^5.0.1" + +rc-overflow@^1.0.0, rc-overflow@^1.2.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/rc-overflow/-/rc-overflow-1.2.2.tgz#95b0222016c0cdbdc0db85f569c262e7706a5f22" + integrity sha512-X5kj9LDU1ue5wHkqvCprJWLKC+ZLs3p4He/oxjZ1Q4NKaqKBaYf5OdSzRSgh3WH8kSdrfU8LjvlbWnHgJOEkNQ== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-resize-observer "^1.0.0" + rc-util "^5.5.1" + +rc-pagination@~3.1.9: + version "3.1.9" + resolved "https://registry.yarnpkg.com/rc-pagination/-/rc-pagination-3.1.9.tgz#797ad75d85b1ef7a82801207ead410110337fdd6" + integrity sha512-IKBKaJ4icVPeEk9qRHrFBJmHxBUrCp3+nENBYob4Ofqsu3RXjBOy4N36zONO7oubgLyiG3PxVmyAuVlTkoc7Jg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + +rc-picker@~2.5.10: + version "2.5.18" + resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-2.5.18.tgz#f84859815ef3f874ade689714a41151e709292c3" + integrity sha512-XyieTl8GOC5TeQFEvYbjx/Mtc0/CjruS7mKFT6Fy65FbGXmoFsWoWvIi+ylFx/BQHPGQi7a7vCNoZJ2TTqcZoA== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + date-fns "2.x" + dayjs "1.x" + moment "^2.24.0" + rc-trigger "^5.0.4" + rc-util "^5.4.0" + shallowequal "^1.1.0" + +rc-progress@~3.1.0: + version "3.1.4" + resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-3.1.4.tgz#66040d0fae7d8ced2b38588378eccb2864bad615" + integrity sha512-XBAif08eunHssGeIdxMXOmRQRULdHaDdIFENQ578CMb4dyewahmmfJRyab+hw4KH4XssEzzYOkAInTLS7JJG+Q== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + +rc-rate@~2.9.0: + version "2.9.1" + resolved "https://registry.yarnpkg.com/rc-rate/-/rc-rate-2.9.1.tgz#e43cb95c4eb90a2c1e0b16ec6614d8c43530a731" + integrity sha512-MmIU7FT8W4LYRRHJD1sgG366qKtSaKb67D0/vVvJYR0lrCuRrCiVQ5qhfT5ghVO4wuVIORGpZs7ZKaYu+KMUzA== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.0.1" + +rc-resize-observer@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/rc-resize-observer/-/rc-resize-observer-1.0.1.tgz#ccd0986543ff1bf49f8a581e8ac4bb714ed24dcd" + integrity sha512-OxO2mJI9e8610CAWBFfm52SPvWib0eNKjaSsRbbKHmLaJIxw944P+D61DlLJ/w2vuOjGNcalJu8VdqyNm/XCRg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-util "^5.0.0" + resize-observer-polyfill "^1.5.1" + +rc-select@^12.0.0, rc-select@~12.1.6: + version "12.1.13" + resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-12.1.13.tgz#c33560ccb9339d30695b52458f55efc35af35273" + integrity sha512-cPI+aesP6dgCAaey4t4upDbEukJe+XN0DK6oO/6flcCX5o28o7KNZD7JAiVtC/6fCwqwI/kSs7S/43dvHmBl+A== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.0.1" + rc-overflow "^1.0.0" + rc-trigger "^5.0.4" + rc-util "^5.9.8" + rc-virtual-list "^3.2.0" + +rc-slider@~9.7.1: + version "9.7.2" + resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-9.7.2.tgz#282f571f7582752ebaa33964e441184f4e79ad74" + integrity sha512-mVaLRpDo6otasBs6yVnG02ykI3K6hIrLTNfT5eyaqduFv95UODI9PDS6fWuVVehVpdS4ENgOSwsTjrPVun+k9g== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-tooltip "^5.0.1" + rc-util "^5.0.0" + shallowequal "^1.1.0" + +rc-steps@~4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/rc-steps/-/rc-steps-4.1.3.tgz#208580e22db619e3830ddb7fa41bc886c65d9803" + integrity sha512-GXrMfWQOhN3sVze3JnzNboHpQdNHcdFubOETUHyDpa/U3HEKBZC3xJ8XK4paBgF4OJ3bdUVLC+uBPc6dCxvDYA== + dependencies: + "@babel/runtime" "^7.10.2" + classnames "^2.2.3" + rc-util "^5.0.1" + +rc-switch@~3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/rc-switch/-/rc-switch-3.2.2.tgz#d001f77f12664d52595b4f6fb425dd9e66fba8e8" + integrity sha512-+gUJClsZZzvAHGy1vZfnwySxj+MjLlGRyXKXScrtCTcmiYNPzxDFOxdQ/3pK1Kt/0POvwJ/6ALOR8gwdXGhs+A== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-util "^5.0.1" + +rc-table@~7.15.1: + version "7.15.2" + resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.15.2.tgz#f6ab73b2cfb1c76f3cf9682c855561423c6b5b22" + integrity sha512-TAs7kCpIZwc2mtvD8CMrXSM6TqJDUsy0rUEV1YgRru33T8bjtAtc+9xW/KC1VWROJlHSpU0R0kXjFs9h/6+IzQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-resize-observer "^1.0.0" + rc-util "^5.13.0" + shallowequal "^1.1.0" + +rc-tabs@~11.10.0: + version "11.10.1" + resolved "https://registry.yarnpkg.com/rc-tabs/-/rc-tabs-11.10.1.tgz#7b112f78bac998480c777ae160adc425e3fdb7cb" + integrity sha512-ey1i2uMyfnRNYbViLcUYGH+Y7hueJbdCVSLaXnXki9hxBcGqxJMPy9t5xR0n/3QFQspj7Tf6+2VTXVtmO7Yaug== + dependencies: + "@babel/runtime" "^7.11.2" + classnames "2.x" + rc-dropdown "^3.2.0" + rc-menu "^9.0.0" + rc-resize-observer "^1.0.0" + rc-util "^5.5.0" + +rc-textarea@^0.3.0, rc-textarea@~0.3.0: + version "0.3.5" + resolved "https://registry.yarnpkg.com/rc-textarea/-/rc-textarea-0.3.5.tgz#07ed445dddb94e5ae6764676923a49bddad9b2ec" + integrity sha512-qa+k5vDn9ct65qr+SgD2KwJ9Xz6P84lG2z+TDht/RBr71WnM/K61PqHUAcUyU6YqTJD26IXgjPuuhZR7HMw7eA== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-resize-observer "^1.0.0" + rc-util "^5.7.0" + +rc-tooltip@^5.0.1, rc-tooltip@~5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-5.1.1.tgz#94178ed162d0252bc4993b725f5dc2ac0fccf154" + integrity sha512-alt8eGMJulio6+4/uDm7nvV+rJq9bsfxFDCI0ljPdbuoygUscbsMYb6EQgwib/uqsXQUvzk+S7A59uYHmEgmDA== + dependencies: + "@babel/runtime" "^7.11.2" + rc-trigger "^5.0.0" + +rc-tree-select@~4.3.0: + version "4.3.3" + resolved "https://registry.yarnpkg.com/rc-tree-select/-/rc-tree-select-4.3.3.tgz#28eba4d8a8dc8c0f9b61d83ce465842a6915eca4" + integrity sha512-0tilOHLJA6p+TNg4kD559XnDX3PTEYuoSF7m7ryzFLAYvdEEPtjn0QZc5z6L0sMKBiBlj8a2kf0auw8XyHU3lA== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-select "^12.0.0" + rc-tree "^4.0.0" + rc-util "^5.0.5" + +rc-tree@^4.0.0, rc-tree@~4.2.1: + version "4.2.2" + resolved "https://registry.yarnpkg.com/rc-tree/-/rc-tree-4.2.2.tgz#4429187cbbfbecbe989714a607e3de8b3ab7763f" + integrity sha512-V1hkJt092VrOVjNyfj5IYbZKRMHxWihZarvA5hPL/eqm7o2+0SNkeidFYm7LVVBrAKBpOpa0l8xt04uiqOd+6w== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.0.1" + rc-util "^5.0.0" + rc-virtual-list "^3.0.1" + +rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.10: + version "5.2.10" + resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-5.2.10.tgz#8a0057a940b1b9027eaa33beec8a6ecd85cce2b1" + integrity sha512-FkUf4H9BOFDaIwu42fvRycXMAvkttph9AlbCZXssZDVzz2L+QZ0ERvfB/4nX3ZFPh1Zd+uVGr1DEDeXxq4J1TA== + dependencies: + "@babel/runtime" "^7.11.2" + classnames "^2.2.6" + rc-align "^4.0.0" + rc-motion "^2.0.0" + rc-util "^5.5.0" + +rc-upload@~4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-4.3.1.tgz#d6ee66b8bd1e1dd2f78526c486538423f7e7ed84" + integrity sha512-W8Iyv0LRyEnFEzpv90ET/i1XG2jlPzPxKkkOVtDfgh9c3f4lZV770vgpUfiyQza+iLtQLVco3qIvgue8aDiOsQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.2.0" + +rc-util@^5.0.0, rc-util@^5.0.1, rc-util@^5.0.5, rc-util@^5.0.6, rc-util@^5.0.7, rc-util@^5.12.0, rc-util@^5.13.0, rc-util@^5.13.1, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.3.0, rc-util@^5.4.0, rc-util@^5.5.0, rc-util@^5.5.1, rc-util@^5.6.1, rc-util@^5.7.0, rc-util@^5.8.0, rc-util@^5.9.4, rc-util@^5.9.8: + version "5.13.2" + resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.13.2.tgz#a8a0bb77743351841ba8bed6393e03b8d2f685c8" + integrity sha512-eYc71XXGlp96RMzg01Mhq/T3BL6OOVTDSS0urFEuvpi+e7slhJRhaHGCKy2hqJm18m9ff7VoRoptplKu60dYog== + dependencies: + "@babel/runtime" "^7.12.5" + react-is "^16.12.0" + shallowequal "^1.1.0" + +rc-virtual-list@^3.0.1, rc-virtual-list@^3.2.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/rc-virtual-list/-/rc-virtual-list-3.4.1.tgz#1f3b41391acf033a6c7e84c2f4e8a4ee0dc72807" + integrity sha512-YexJy+Cx8qjnQdV8+0JBeM65VF2kvO9lnsfrIvHsL3lIH1adMZ85HqmePGUzKkKMZC+CRAJc2K4g2iJS1dOjPw== + dependencies: + classnames "^2.2.6" + rc-resize-observer "^1.0.0" + rc-util "^5.0.7" + +react-is@^16.12.0: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +regenerator-runtime@^0.13.4: + version "0.13.9" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" + integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== + regexpp@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" @@ -745,6 +1258,11 @@ require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== +resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -765,6 +1283,13 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +scroll-into-view-if-needed@^2.2.25: + version "2.2.28" + resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.28.tgz#5a15b2f58a52642c88c8eca584644e01703d645a" + integrity sha512-8LuxJSuFVc92+0AdNv4QOxRL4Abeo1DgLnGNkn1XlaujPH/3cCFz3QI60r2VNu4obJJROzgnIUw5TKQkZvZI1w== + dependencies: + compute-scroll-into-view "^1.0.17" + semver@^7.2.1: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" @@ -772,6 +1297,11 @@ semver@^7.2.1: dependencies: lru-cache "^6.0.0" +shallowequal@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" + integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -803,6 +1333,11 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +string-convert@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/string-convert/-/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" + integrity sha1-aYLMMEn7tM2F+LJFaLnZvznu/5c= + string-width@^4.2.0: version "4.2.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" @@ -860,6 +1395,11 @@ to-fast-properties@^2.0.0: resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI= + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -884,6 +1424,13 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== +warning@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" + integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== + dependencies: + loose-envify "^1.0.0" + which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" diff --git a/package.json b/package.json index 904cf4b09e2..e9434f196d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swc/core", - "version": "1.2.87", + "version": "1.2.88", "description": "Super-fast alternative for babel", "homepage": "https://swc.rs", "main": "./index.js", diff --git a/tests/fixture/issue-2011/reduced/output/index.js b/tests/fixture/issue-2011/reduced/output/index.js index b2b2b7d164f..04e7eb1826b 100644 --- a/tests/fixture/issue-2011/reduced/output/index.js +++ b/tests/fixture/issue-2011/reduced/output/index.js @@ -14,10 +14,10 @@ var ClassA = function() { module.exports = (function() { var g, h, i = function() { "use strict"; + var b, j, k; function i() { _classCallCheck(this, i); } - var b, j, k; return b = i, j = [ { key: "it", diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index a05d72c9aa1..a0c1b43a965 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0 AND MIT" name = "wasm" publish = false repository = "https://github.com/swc-project/swc.git" -version = "1.2.87" +version = "1.2.88" [lib] crate-type = ["cdylib"]