diff --git a/src/JShrink/Minifier.php b/src/JShrink/Minifier.php index 088d264..3f07ad8 100644 --- a/src/JShrink/Minifier.php +++ b/src/JShrink/Minifier.php @@ -201,6 +201,7 @@ protected function initialize($js, $options) '-' => true, '+' => true, '[' => true, + '#' => true, '@' => true]; diff --git a/tests/Resources/jshrink/input/private_methods.js b/tests/Resources/jshrink/input/private_methods.js new file mode 100644 index 0000000..92f685e --- /dev/null +++ b/tests/Resources/jshrink/input/private_methods.js @@ -0,0 +1,30 @@ +export default class Example { + #prop + + set prop (value) { + this.#prop = value + + this.#event(value) + } + get prop () { + return this.#prop + } + + constructor (arg) { + this.#prop = arg + + if (arg) { + this.#method() + } + } + + #event = f => { + if (typeof f === 'function') { + f() + } + } + + #method = async _ => { + return fetch(param) + } +} diff --git a/tests/Resources/jshrink/output/private_methods.js b/tests/Resources/jshrink/output/private_methods.js new file mode 100644 index 0000000..d6f5a7e --- /dev/null +++ b/tests/Resources/jshrink/output/private_methods.js @@ -0,0 +1,8 @@ +export default class Example{#prop +set prop(value){this.#prop=value +this.#event(value)} +get prop(){return this.#prop} +constructor(arg){this.#prop=arg +if(arg){this.#method()}} +#event=f=>{if(typeof f==='function'){f()}} +#method=async _=>{return fetch(param)}} \ No newline at end of file