diff --git a/dist/assembler.cjs.js b/dist/assembler.cjs.js index dc95b02..18aa65d 100644 --- a/dist/assembler.cjs.js +++ b/dist/assembler.cjs.js @@ -1443,9 +1443,6 @@ function cssStyleSheet() { } return styleHandler.style; } -if (typeof window !== 'undefined') { - init(); -} exports.cssStyleSheet = cssStyleSheet; exports.handleShadowRoot = handleShadowRoot; diff --git a/dist/assembler.es.js b/dist/assembler.es.js index 817333f..b87847c 100644 --- a/dist/assembler.es.js +++ b/dist/assembler.es.js @@ -1439,8 +1439,5 @@ function cssStyleSheet() { } return styleHandler.style; } -if (typeof window !== 'undefined') { - init(); -} export { cssStyleSheet, handleShadowRoot, init, registerMixin, style }; diff --git a/dist/assembler.js b/dist/assembler.js index f85c17c..765e615 100644 --- a/dist/assembler.js +++ b/dist/assembler.js @@ -1445,6 +1445,7 @@ } return styleHandler.style; } + if (typeof window !== 'undefined') { init(); } diff --git a/rollup.config.js b/rollup.config.js index 1db4445..d805bd2 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,6 +5,7 @@ import pkg from './package.json'; const NAME = 'AssemblerCSS'; const MAIN = 'src/index.ts'; +const AUTOLOAD = 'src/autoload.ts'; const GLOBALS = {}; const EXTERNAL = Object.keys(GLOBALS); @@ -17,7 +18,7 @@ const typescript = ts({ const CONFIG = [ { - input: MAIN, + input: AUTOLOAD, output: { name: NAME, file: pkg.browser, @@ -32,7 +33,7 @@ const CONFIG = [ if (production) { CONFIG.push(...[ { - input: MAIN, + input: AUTOLOAD, output: { name: NAME, file: pkg.browser.replace('.js', '.min.js'), diff --git a/src/autoload.ts b/src/autoload.ts new file mode 100644 index 0000000..7513828 --- /dev/null +++ b/src/autoload.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2022 Zindex Software + * + * 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. + */ + +import {init} from "./index"; +export * from "./index"; + +if (typeof window !== 'undefined') { + init(); +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 704e294..c8ff70e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -120,7 +120,3 @@ export function cssStyleSheet(): CSSStyleSheet { return styleHandler.style; } -if (typeof window !== 'undefined') { - init(); -} - diff --git a/types/autoload.d.ts b/types/autoload.d.ts new file mode 100644 index 0000000..6d1e0ee --- /dev/null +++ b/types/autoload.d.ts @@ -0,0 +1 @@ +export * from "./index";