From 1b2abf0be9d2faa8a5cdbbc37847c4eb272b9545 Mon Sep 17 00:00:00 2001 From: Chess Luo Date: Sat, 2 Apr 2022 20:12:09 +0800 Subject: [PATCH 1/7] modularization and more organized project structure --- README.md | 11 +- demo/test.html | 2 +- scoped.js => dist/scoped.js | 85 +- dist/scoped.min.js | 1 + lib/index.js | 518 ++++++++ lib/polyfill.js | 538 +++++++++ package-lock.json | 2215 ++++++++++++++++++++++++++++++++--- package.json | 24 +- rollup.umd.config.js | 23 + scoped.min.js | 9 - src/index.js | 517 ++++++++ src/polyfill.js | 29 + src/regex.js | 6 + test.js | 2 +- 14 files changed, 3756 insertions(+), 224 deletions(-) rename scoped.js => dist/scoped.js (94%) create mode 100644 dist/scoped.min.js create mode 100644 lib/index.js create mode 100644 lib/polyfill.js create mode 100644 rollup.umd.config.js delete mode 100644 scoped.min.js create mode 100644 src/index.js create mode 100644 src/polyfill.js create mode 100644 src/regex.js diff --git a/README.md b/README.md index f128228..99352c2 100644 --- a/README.md +++ b/README.md @@ -75,13 +75,4 @@ If this is _actually something you need_, I will eat my hat. 🎩 # Release -Compile code with [Closure Compiler](https://closure-compiler.appspot.com/home). - -``` -// ==ClosureCompiler== -// @compilation_level ADVANCED_OPTIMIZATIONS -// @output_file_name scoped.min.js -// ==/ClosureCompiler== - -// code here -``` +Compile code with `npm run build`. \ No newline at end of file diff --git a/demo/test.html b/demo/test.html index 69c8cd0..48fbb37 100644 --- a/demo/test.html +++ b/demo/test.html @@ -122,6 +122,6 @@

The following should not be colored (not scoped)

}); - + diff --git a/scoped.js b/dist/scoped.js similarity index 94% rename from scoped.js rename to dist/scoped.js index d01ad68..ba9434e 100644 --- a/scoped.js +++ b/dist/scoped.js @@ -1,35 +1,16 @@ -/* - * Copyright 2017 Google Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -/** - * @fileoverview Polyfill for `