create-microact-app 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/vanilla/package.json +1 -1
- package/templates/vanilla/src/components/App.js +22 -35
- package/templates/vanilla/src/components/Card.js +5 -12
- package/templates/vanilla/src/components/Hero.js +6 -8
- package/templates/vanilla/src/components/InteractiveDemo.js +34 -32
- package/templates/vanilla/src/main.js +2 -6
- package/templates/web3/contracts/.gitmodules +3 -0
- package/templates/web3/contracts/foundry.lock +8 -0
- package/templates/web3/contracts/lib/forge-std/.gitattributes +1 -0
- package/templates/web3/contracts/lib/forge-std/.github/CODEOWNERS +1 -0
- package/templates/web3/contracts/lib/forge-std/.github/dependabot.yml +6 -0
- package/templates/web3/contracts/lib/forge-std/.github/workflows/ci.yml +125 -0
- package/templates/web3/contracts/lib/forge-std/.github/workflows/sync.yml +36 -0
- package/templates/web3/contracts/lib/forge-std/CONTRIBUTING.md +193 -0
- package/templates/web3/contracts/lib/forge-std/LICENSE-APACHE +203 -0
- package/templates/web3/contracts/lib/forge-std/LICENSE-MIT +25 -0
- package/templates/web3/contracts/lib/forge-std/README.md +268 -0
- package/templates/web3/contracts/lib/forge-std/RELEASE_CHECKLIST.md +12 -0
- package/templates/web3/contracts/lib/forge-std/foundry.toml +18 -0
- package/templates/web3/contracts/lib/forge-std/package.json +16 -0
- package/templates/web3/contracts/lib/forge-std/scripts/vm.py +636 -0
- package/templates/web3/contracts/lib/forge-std/src/Base.sol +48 -0
- package/templates/web3/contracts/lib/forge-std/src/Config.sol +60 -0
- package/templates/web3/contracts/lib/forge-std/src/LibVariable.sol +477 -0
- package/templates/web3/contracts/lib/forge-std/src/Script.sol +28 -0
- package/templates/web3/contracts/lib/forge-std/src/StdAssertions.sol +779 -0
- package/templates/web3/contracts/lib/forge-std/src/StdChains.sol +295 -0
- package/templates/web3/contracts/lib/forge-std/src/StdCheats.sol +825 -0
- package/templates/web3/contracts/lib/forge-std/src/StdConfig.sol +632 -0
- package/templates/web3/contracts/lib/forge-std/src/StdConstants.sol +30 -0
- package/templates/web3/contracts/lib/forge-std/src/StdError.sol +15 -0
- package/templates/web3/contracts/lib/forge-std/src/StdInvariant.sol +120 -0
- package/templates/web3/contracts/lib/forge-std/src/StdJson.sol +275 -0
- package/templates/web3/contracts/lib/forge-std/src/StdMath.sol +47 -0
- package/templates/web3/contracts/lib/forge-std/src/StdStorage.sol +475 -0
- package/templates/web3/contracts/lib/forge-std/src/StdStyle.sol +333 -0
- package/templates/web3/contracts/lib/forge-std/src/StdToml.sol +275 -0
- package/templates/web3/contracts/lib/forge-std/src/StdUtils.sol +200 -0
- package/templates/web3/contracts/lib/forge-std/src/Test.sol +32 -0
- package/templates/web3/contracts/lib/forge-std/src/Vm.sol +2500 -0
- package/templates/web3/contracts/lib/forge-std/src/console.sol +1551 -0
- package/templates/web3/contracts/lib/forge-std/src/console2.sol +4 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC1155.sol +105 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC165.sol +12 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC20.sol +43 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC4626.sol +190 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC6909.sol +72 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC721.sol +164 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC7540.sol +144 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IERC7575.sol +241 -0
- package/templates/web3/contracts/lib/forge-std/src/interfaces/IMulticall3.sol +68 -0
- package/templates/web3/contracts/lib/forge-std/src/safeconsole.sol +13248 -0
- package/templates/web3/contracts/lib/forge-std/test/CommonBase.t.sol +44 -0
- package/templates/web3/contracts/lib/forge-std/test/Config.t.sol +381 -0
- package/templates/web3/contracts/lib/forge-std/test/LibVariable.t.sol +452 -0
- package/templates/web3/contracts/lib/forge-std/test/StdAssertions.t.sol +141 -0
- package/templates/web3/contracts/lib/forge-std/test/StdChains.t.sol +227 -0
- package/templates/web3/contracts/lib/forge-std/test/StdCheats.t.sol +638 -0
- package/templates/web3/contracts/lib/forge-std/test/StdConstants.t.sol +38 -0
- package/templates/web3/contracts/lib/forge-std/test/StdError.t.sol +119 -0
- package/templates/web3/contracts/lib/forge-std/test/StdJson.t.sol +49 -0
- package/templates/web3/contracts/lib/forge-std/test/StdMath.t.sol +202 -0
- package/templates/web3/contracts/lib/forge-std/test/StdStorage.t.sol +485 -0
- package/templates/web3/contracts/lib/forge-std/test/StdStyle.t.sol +110 -0
- package/templates/web3/contracts/lib/forge-std/test/StdToml.t.sol +49 -0
- package/templates/web3/contracts/lib/forge-std/test/StdUtils.t.sol +342 -0
- package/templates/web3/contracts/lib/forge-std/test/Vm.t.sol +18 -0
- package/templates/web3/contracts/lib/forge-std/test/compilation/CompilationScript.sol +8 -0
- package/templates/web3/contracts/lib/forge-std/test/compilation/CompilationScriptBase.sol +8 -0
- package/templates/web3/contracts/lib/forge-std/test/compilation/CompilationTest.sol +8 -0
- package/templates/web3/contracts/lib/forge-std/test/compilation/CompilationTestBase.sol +8 -0
- package/templates/web3/contracts/lib/forge-std/test/fixtures/broadcast.log.json +187 -0
- package/templates/web3/contracts/lib/forge-std/test/fixtures/config.toml +81 -0
- package/templates/web3/contracts/lib/forge-std/test/fixtures/test.json +8 -0
- package/templates/web3/contracts/lib/forge-std/test/fixtures/test.toml +6 -0
- package/templates/web3/package.json +1 -1
- package/templates/web3/src/components/App.js +23 -36
- package/templates/web3/src/components/CounterCard.js +45 -45
- package/templates/web3/src/main.js +5 -7
- package/templates/vanilla/node_modules/.package-lock.json +0 -207
- package/templates/vanilla/node_modules/@esbuild/darwin-x64/README.md +0 -3
- package/templates/vanilla/node_modules/@esbuild/darwin-x64/bin/esbuild +0 -0
- package/templates/vanilla/node_modules/@esbuild/darwin-x64/package.json +0 -17
- package/templates/vanilla/node_modules/@monygroupcorp/microact/README.md +0 -154
- package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js +0 -1749
- package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js.map +0 -1
- package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js +0 -1743
- package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js.map +0 -1
- package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js +0 -2
- package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js.map +0 -1
- package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.html +0 -13
- package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.js +0 -63
- package/templates/vanilla/node_modules/@monygroupcorp/microact/package.json +0 -38
- package/templates/vanilla/node_modules/@monygroupcorp/microact/rollup.config.cjs +0 -30
- package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Component.js +0 -831
- package/templates/vanilla/node_modules/@monygroupcorp/microact/src/DOMUpdater.js +0 -320
- package/templates/vanilla/node_modules/@monygroupcorp/microact/src/EventBus.js +0 -123
- package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Router.js +0 -253
- package/templates/vanilla/node_modules/@monygroupcorp/microact/src/UpdateScheduler.js +0 -218
- package/templates/vanilla/node_modules/@monygroupcorp/microact/src/index.js +0 -6
- package/templates/vanilla/node_modules/esbuild/LICENSE.md +0 -21
- package/templates/vanilla/node_modules/esbuild/README.md +0 -3
- package/templates/vanilla/node_modules/esbuild/bin/esbuild +0 -0
- package/templates/vanilla/node_modules/esbuild/install.js +0 -287
- package/templates/vanilla/node_modules/esbuild/lib/main.d.ts +0 -660
- package/templates/vanilla/node_modules/esbuild/lib/main.js +0 -2393
- package/templates/vanilla/node_modules/esbuild/package.json +0 -42
- package/templates/vanilla/node_modules/nanoid/LICENSE +0 -20
- package/templates/vanilla/node_modules/nanoid/README.md +0 -39
- package/templates/vanilla/node_modules/nanoid/async/index.browser.cjs +0 -69
- package/templates/vanilla/node_modules/nanoid/async/index.browser.js +0 -34
- package/templates/vanilla/node_modules/nanoid/async/index.cjs +0 -71
- package/templates/vanilla/node_modules/nanoid/async/index.d.ts +0 -56
- package/templates/vanilla/node_modules/nanoid/async/index.js +0 -35
- package/templates/vanilla/node_modules/nanoid/async/index.native.js +0 -26
- package/templates/vanilla/node_modules/nanoid/async/package.json +0 -12
- package/templates/vanilla/node_modules/nanoid/bin/nanoid.cjs +0 -55
- package/templates/vanilla/node_modules/nanoid/index.browser.cjs +0 -72
- package/templates/vanilla/node_modules/nanoid/index.browser.js +0 -34
- package/templates/vanilla/node_modules/nanoid/index.cjs +0 -85
- package/templates/vanilla/node_modules/nanoid/index.d.cts +0 -91
- package/templates/vanilla/node_modules/nanoid/index.d.ts +0 -91
- package/templates/vanilla/node_modules/nanoid/index.js +0 -45
- package/templates/vanilla/node_modules/nanoid/nanoid.js +0 -1
- package/templates/vanilla/node_modules/nanoid/non-secure/index.cjs +0 -34
- package/templates/vanilla/node_modules/nanoid/non-secure/index.d.ts +0 -33
- package/templates/vanilla/node_modules/nanoid/non-secure/index.js +0 -21
- package/templates/vanilla/node_modules/nanoid/non-secure/package.json +0 -6
- package/templates/vanilla/node_modules/nanoid/package.json +0 -89
- package/templates/vanilla/node_modules/nanoid/url-alphabet/index.cjs +0 -7
- package/templates/vanilla/node_modules/nanoid/url-alphabet/index.js +0 -3
- package/templates/vanilla/node_modules/nanoid/url-alphabet/package.json +0 -6
- package/templates/vanilla/node_modules/picocolors/LICENSE +0 -15
- package/templates/vanilla/node_modules/picocolors/README.md +0 -21
- package/templates/vanilla/node_modules/picocolors/package.json +0 -25
- package/templates/vanilla/node_modules/picocolors/picocolors.browser.js +0 -4
- package/templates/vanilla/node_modules/picocolors/picocolors.d.ts +0 -5
- package/templates/vanilla/node_modules/picocolors/picocolors.js +0 -75
- package/templates/vanilla/node_modules/picocolors/types.d.ts +0 -51
- package/templates/vanilla/node_modules/postcss/LICENSE +0 -20
- package/templates/vanilla/node_modules/postcss/README.md +0 -29
- package/templates/vanilla/node_modules/postcss/lib/at-rule.d.ts +0 -140
- package/templates/vanilla/node_modules/postcss/lib/at-rule.js +0 -25
- package/templates/vanilla/node_modules/postcss/lib/comment.d.ts +0 -68
- package/templates/vanilla/node_modules/postcss/lib/comment.js +0 -13
- package/templates/vanilla/node_modules/postcss/lib/container.d.ts +0 -483
- package/templates/vanilla/node_modules/postcss/lib/container.js +0 -447
- package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.d.ts +0 -248
- package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.js +0 -133
- package/templates/vanilla/node_modules/postcss/lib/declaration.d.ts +0 -151
- package/templates/vanilla/node_modules/postcss/lib/declaration.js +0 -24
- package/templates/vanilla/node_modules/postcss/lib/document.d.ts +0 -69
- package/templates/vanilla/node_modules/postcss/lib/document.js +0 -33
- package/templates/vanilla/node_modules/postcss/lib/fromJSON.d.ts +0 -9
- package/templates/vanilla/node_modules/postcss/lib/fromJSON.js +0 -54
- package/templates/vanilla/node_modules/postcss/lib/input.d.ts +0 -227
- package/templates/vanilla/node_modules/postcss/lib/input.js +0 -265
- package/templates/vanilla/node_modules/postcss/lib/lazy-result.d.ts +0 -190
- package/templates/vanilla/node_modules/postcss/lib/lazy-result.js +0 -550
- package/templates/vanilla/node_modules/postcss/lib/list.d.ts +0 -60
- package/templates/vanilla/node_modules/postcss/lib/list.js +0 -58
- package/templates/vanilla/node_modules/postcss/lib/map-generator.js +0 -368
- package/templates/vanilla/node_modules/postcss/lib/no-work-result.d.ts +0 -46
- package/templates/vanilla/node_modules/postcss/lib/no-work-result.js +0 -138
- package/templates/vanilla/node_modules/postcss/lib/node.d.ts +0 -556
- package/templates/vanilla/node_modules/postcss/lib/node.js +0 -449
- package/templates/vanilla/node_modules/postcss/lib/parse.d.ts +0 -9
- package/templates/vanilla/node_modules/postcss/lib/parse.js +0 -42
- package/templates/vanilla/node_modules/postcss/lib/parser.js +0 -611
- package/templates/vanilla/node_modules/postcss/lib/postcss.d.mts +0 -69
- package/templates/vanilla/node_modules/postcss/lib/postcss.d.ts +0 -458
- package/templates/vanilla/node_modules/postcss/lib/postcss.js +0 -101
- package/templates/vanilla/node_modules/postcss/lib/postcss.mjs +0 -30
- package/templates/vanilla/node_modules/postcss/lib/previous-map.d.ts +0 -81
- package/templates/vanilla/node_modules/postcss/lib/previous-map.js +0 -144
- package/templates/vanilla/node_modules/postcss/lib/processor.d.ts +0 -115
- package/templates/vanilla/node_modules/postcss/lib/processor.js +0 -67
- package/templates/vanilla/node_modules/postcss/lib/result.d.ts +0 -205
- package/templates/vanilla/node_modules/postcss/lib/result.js +0 -42
- package/templates/vanilla/node_modules/postcss/lib/root.d.ts +0 -87
- package/templates/vanilla/node_modules/postcss/lib/root.js +0 -61
- package/templates/vanilla/node_modules/postcss/lib/rule.d.ts +0 -126
- package/templates/vanilla/node_modules/postcss/lib/rule.js +0 -27
- package/templates/vanilla/node_modules/postcss/lib/stringifier.d.ts +0 -46
- package/templates/vanilla/node_modules/postcss/lib/stringifier.js +0 -353
- package/templates/vanilla/node_modules/postcss/lib/stringify.d.ts +0 -9
- package/templates/vanilla/node_modules/postcss/lib/stringify.js +0 -11
- package/templates/vanilla/node_modules/postcss/lib/symbols.js +0 -5
- package/templates/vanilla/node_modules/postcss/lib/terminal-highlight.js +0 -70
- package/templates/vanilla/node_modules/postcss/lib/tokenize.js +0 -266
- package/templates/vanilla/node_modules/postcss/lib/warn-once.js +0 -13
- package/templates/vanilla/node_modules/postcss/lib/warning.d.ts +0 -147
- package/templates/vanilla/node_modules/postcss/lib/warning.js +0 -37
- package/templates/vanilla/node_modules/postcss/package.json +0 -88
- package/templates/vanilla/node_modules/rollup/LICENSE.md +0 -695
- package/templates/vanilla/node_modules/rollup/README.md +0 -125
- package/templates/vanilla/node_modules/rollup/dist/bin/rollup +0 -1715
- package/templates/vanilla/node_modules/rollup/dist/es/getLogFilter.js +0 -64
- package/templates/vanilla/node_modules/rollup/dist/es/package.json +0 -1
- package/templates/vanilla/node_modules/rollup/dist/es/rollup.js +0 -17
- package/templates/vanilla/node_modules/rollup/dist/es/shared/node-entry.js +0 -27273
- package/templates/vanilla/node_modules/rollup/dist/es/shared/watch.js +0 -4857
- package/templates/vanilla/node_modules/rollup/dist/getLogFilter.d.ts +0 -5
- package/templates/vanilla/node_modules/rollup/dist/getLogFilter.js +0 -69
- package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.d.ts +0 -20
- package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.js +0 -29
- package/templates/vanilla/node_modules/rollup/dist/rollup.d.ts +0 -1012
- package/templates/vanilla/node_modules/rollup/dist/rollup.js +0 -31
- package/templates/vanilla/node_modules/rollup/dist/shared/fsevents-importer.js +0 -37
- package/templates/vanilla/node_modules/rollup/dist/shared/index.js +0 -4571
- package/templates/vanilla/node_modules/rollup/dist/shared/loadConfigFile.js +0 -546
- package/templates/vanilla/node_modules/rollup/dist/shared/rollup.js +0 -27351
- package/templates/vanilla/node_modules/rollup/dist/shared/watch-cli.js +0 -561
- package/templates/vanilla/node_modules/rollup/dist/shared/watch-proxy.js +0 -87
- package/templates/vanilla/node_modules/rollup/dist/shared/watch.js +0 -316
- package/templates/vanilla/node_modules/rollup/package.json +0 -181
- package/templates/vanilla/node_modules/source-map-js/LICENSE +0 -28
- package/templates/vanilla/node_modules/source-map-js/README.md +0 -765
- package/templates/vanilla/node_modules/source-map-js/lib/array-set.js +0 -121
- package/templates/vanilla/node_modules/source-map-js/lib/base64-vlq.js +0 -140
- package/templates/vanilla/node_modules/source-map-js/lib/base64.js +0 -67
- package/templates/vanilla/node_modules/source-map-js/lib/binary-search.js +0 -111
- package/templates/vanilla/node_modules/source-map-js/lib/mapping-list.js +0 -79
- package/templates/vanilla/node_modules/source-map-js/lib/quick-sort.js +0 -132
- package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.d.ts +0 -1
- package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.js +0 -1188
- package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.d.ts +0 -1
- package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.js +0 -444
- package/templates/vanilla/node_modules/source-map-js/lib/source-node.d.ts +0 -1
- package/templates/vanilla/node_modules/source-map-js/lib/source-node.js +0 -413
- package/templates/vanilla/node_modules/source-map-js/lib/util.js +0 -594
- package/templates/vanilla/node_modules/source-map-js/package.json +0 -71
- package/templates/vanilla/node_modules/source-map-js/source-map.d.ts +0 -104
- package/templates/vanilla/node_modules/source-map-js/source-map.js +0 -8
- package/templates/vanilla/node_modules/vite/LICENSE.md +0 -3396
- package/templates/vanilla/node_modules/vite/README.md +0 -20
- package/templates/vanilla/node_modules/vite/bin/openChrome.applescript +0 -95
- package/templates/vanilla/node_modules/vite/bin/vite.js +0 -61
- package/templates/vanilla/node_modules/vite/client.d.ts +0 -281
- package/templates/vanilla/node_modules/vite/dist/client/client.mjs +0 -725
- package/templates/vanilla/node_modules/vite/dist/client/client.mjs.map +0 -1
- package/templates/vanilla/node_modules/vite/dist/client/env.mjs +0 -30
- package/templates/vanilla/node_modules/vite/dist/client/env.mjs.map +0 -1
- package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-7ec6f216.js +0 -914
- package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-827b23df.js +0 -66713
- package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-c423598f.js +0 -561
- package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js +0 -7930
- package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f1e8587f.js +0 -7646
- package/templates/vanilla/node_modules/vite/dist/node/cli.js +0 -929
- package/templates/vanilla/node_modules/vite/dist/node/constants.js +0 -130
- package/templates/vanilla/node_modules/vite/dist/node/index.d.ts +0 -3548
- package/templates/vanilla/node_modules/vite/dist/node/index.js +0 -158
- package/templates/vanilla/node_modules/vite/dist/node-cjs/publicUtils.cjs +0 -4555
- package/templates/vanilla/node_modules/vite/index.cjs +0 -34
- package/templates/vanilla/node_modules/vite/package.json +0 -173
- package/templates/vanilla/node_modules/vite/types/customEvent.d.ts +0 -35
- package/templates/vanilla/node_modules/vite/types/hmrPayload.d.ts +0 -61
- package/templates/vanilla/node_modules/vite/types/hot.d.ts +0 -32
- package/templates/vanilla/node_modules/vite/types/importGlob.d.ts +0 -97
- package/templates/vanilla/node_modules/vite/types/importMeta.d.ts +0 -26
- package/templates/vanilla/node_modules/vite/types/metadata.d.ts +0 -10
- package/templates/vanilla/node_modules/vite/types/package.json +0 -4
- package/templates/vanilla/package-lock.json +0 -589
|
@@ -1,914 +0,0 @@
|
|
|
1
|
-
import { F as getDefaultExportFromCjs } from './dep-827b23df.js';
|
|
2
|
-
import require$$0 from 'path';
|
|
3
|
-
import require$$0__default from 'fs';
|
|
4
|
-
import { l as lib } from './dep-c423598f.js';
|
|
5
|
-
|
|
6
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
7
|
-
import { dirname as __cjs_dirname } from 'node:path';
|
|
8
|
-
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
9
|
-
|
|
10
|
-
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
11
|
-
const __dirname = __cjs_dirname(__filename);
|
|
12
|
-
const require = __cjs_createRequire(import.meta.url);
|
|
13
|
-
const __require = require;
|
|
14
|
-
function _mergeNamespaces(n, m) {
|
|
15
|
-
for (var i = 0; i < m.length; i++) {
|
|
16
|
-
var e = m[i];
|
|
17
|
-
if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
|
|
18
|
-
if (k !== 'default' && !(k in n)) {
|
|
19
|
-
n[k] = e[k];
|
|
20
|
-
}
|
|
21
|
-
} }
|
|
22
|
-
}
|
|
23
|
-
return n;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const startsWithKeywordRegexp = /^(all|not|only|print|screen)/i;
|
|
27
|
-
|
|
28
|
-
var joinMedia$1 = function (parentMedia, childMedia) {
|
|
29
|
-
if (!parentMedia.length && childMedia.length) return childMedia
|
|
30
|
-
if (parentMedia.length && !childMedia.length) return parentMedia
|
|
31
|
-
if (!parentMedia.length && !childMedia.length) return []
|
|
32
|
-
|
|
33
|
-
const media = [];
|
|
34
|
-
|
|
35
|
-
parentMedia.forEach(parentItem => {
|
|
36
|
-
const parentItemStartsWithKeyword = startsWithKeywordRegexp.test(parentItem);
|
|
37
|
-
|
|
38
|
-
childMedia.forEach(childItem => {
|
|
39
|
-
const childItemStartsWithKeyword = startsWithKeywordRegexp.test(childItem);
|
|
40
|
-
if (parentItem !== childItem) {
|
|
41
|
-
if (childItemStartsWithKeyword && !parentItemStartsWithKeyword) {
|
|
42
|
-
media.push(`${childItem} and ${parentItem}`);
|
|
43
|
-
} else {
|
|
44
|
-
media.push(`${parentItem} and ${childItem}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
return media
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
var joinLayer$1 = function (parentLayer, childLayer) {
|
|
54
|
-
if (!parentLayer.length && childLayer.length) return childLayer
|
|
55
|
-
if (parentLayer.length && !childLayer.length) return parentLayer
|
|
56
|
-
if (!parentLayer.length && !childLayer.length) return []
|
|
57
|
-
|
|
58
|
-
return parentLayer.concat(childLayer)
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var readCache$1 = {exports: {}};
|
|
62
|
-
|
|
63
|
-
var pify$2 = {exports: {}};
|
|
64
|
-
|
|
65
|
-
var processFn = function (fn, P, opts) {
|
|
66
|
-
return function () {
|
|
67
|
-
var that = this;
|
|
68
|
-
var args = new Array(arguments.length);
|
|
69
|
-
|
|
70
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
71
|
-
args[i] = arguments[i];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return new P(function (resolve, reject) {
|
|
75
|
-
args.push(function (err, result) {
|
|
76
|
-
if (err) {
|
|
77
|
-
reject(err);
|
|
78
|
-
} else if (opts.multiArgs) {
|
|
79
|
-
var results = new Array(arguments.length - 1);
|
|
80
|
-
|
|
81
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
82
|
-
results[i - 1] = arguments[i];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
resolve(results);
|
|
86
|
-
} else {
|
|
87
|
-
resolve(result);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
fn.apply(that, args);
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
var pify$1 = pify$2.exports = function (obj, P, opts) {
|
|
97
|
-
if (typeof P !== 'function') {
|
|
98
|
-
opts = P;
|
|
99
|
-
P = Promise;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
opts = opts || {};
|
|
103
|
-
opts.exclude = opts.exclude || [/.+Sync$/];
|
|
104
|
-
|
|
105
|
-
var filter = function (key) {
|
|
106
|
-
var match = function (pattern) {
|
|
107
|
-
return typeof pattern === 'string' ? key === pattern : pattern.test(key);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
var ret = typeof obj === 'function' ? function () {
|
|
114
|
-
if (opts.excludeMain) {
|
|
115
|
-
return obj.apply(this, arguments);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return processFn(obj, P, opts).apply(this, arguments);
|
|
119
|
-
} : {};
|
|
120
|
-
|
|
121
|
-
return Object.keys(obj).reduce(function (ret, key) {
|
|
122
|
-
var x = obj[key];
|
|
123
|
-
|
|
124
|
-
ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
|
|
125
|
-
|
|
126
|
-
return ret;
|
|
127
|
-
}, ret);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
pify$1.all = pify$1;
|
|
131
|
-
|
|
132
|
-
var pifyExports = pify$2.exports;
|
|
133
|
-
|
|
134
|
-
var fs = require$$0__default;
|
|
135
|
-
var path$2 = require$$0;
|
|
136
|
-
var pify = pifyExports;
|
|
137
|
-
|
|
138
|
-
var stat = pify(fs.stat);
|
|
139
|
-
var readFile = pify(fs.readFile);
|
|
140
|
-
var resolve = path$2.resolve;
|
|
141
|
-
|
|
142
|
-
var cache = Object.create(null);
|
|
143
|
-
|
|
144
|
-
function convert(content, encoding) {
|
|
145
|
-
if (Buffer.isEncoding(encoding)) {
|
|
146
|
-
return content.toString(encoding);
|
|
147
|
-
}
|
|
148
|
-
return content;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
readCache$1.exports = function (path, encoding) {
|
|
152
|
-
path = resolve(path);
|
|
153
|
-
|
|
154
|
-
return stat(path).then(function (stats) {
|
|
155
|
-
var item = cache[path];
|
|
156
|
-
|
|
157
|
-
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
|
158
|
-
return convert(item.content, encoding);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return readFile(path).then(function (data) {
|
|
162
|
-
cache[path] = {
|
|
163
|
-
mtime: stats.mtime,
|
|
164
|
-
content: data
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
return convert(data, encoding);
|
|
168
|
-
});
|
|
169
|
-
}).catch(function (err) {
|
|
170
|
-
cache[path] = null;
|
|
171
|
-
return Promise.reject(err);
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
readCache$1.exports.sync = function (path, encoding) {
|
|
176
|
-
path = resolve(path);
|
|
177
|
-
|
|
178
|
-
try {
|
|
179
|
-
var stats = fs.statSync(path);
|
|
180
|
-
var item = cache[path];
|
|
181
|
-
|
|
182
|
-
if (item && item.mtime.getTime() === stats.mtime.getTime()) {
|
|
183
|
-
return convert(item.content, encoding);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
var data = fs.readFileSync(path);
|
|
187
|
-
|
|
188
|
-
cache[path] = {
|
|
189
|
-
mtime: stats.mtime,
|
|
190
|
-
content: data
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
return convert(data, encoding);
|
|
194
|
-
} catch (err) {
|
|
195
|
-
cache[path] = null;
|
|
196
|
-
throw err;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
readCache$1.exports.get = function (path, encoding) {
|
|
202
|
-
path = resolve(path);
|
|
203
|
-
if (cache[path]) {
|
|
204
|
-
return convert(cache[path].content, encoding);
|
|
205
|
-
}
|
|
206
|
-
return null;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
readCache$1.exports.clear = function () {
|
|
210
|
-
cache = Object.create(null);
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
var readCacheExports = readCache$1.exports;
|
|
214
|
-
|
|
215
|
-
const dataURLRegexp = /^data:text\/css;base64,/i;
|
|
216
|
-
|
|
217
|
-
function isValid(url) {
|
|
218
|
-
return dataURLRegexp.test(url)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function contents(url) {
|
|
222
|
-
// "data:text/css;base64,".length === 21
|
|
223
|
-
return Buffer.from(url.slice(21), "base64").toString()
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var dataUrl = {
|
|
227
|
-
isValid,
|
|
228
|
-
contents,
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const readCache = readCacheExports;
|
|
232
|
-
const dataURL$1 = dataUrl;
|
|
233
|
-
|
|
234
|
-
var loadContent$1 = filename => {
|
|
235
|
-
if (dataURL$1.isValid(filename)) {
|
|
236
|
-
return dataURL$1.contents(filename)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return readCache(filename, "utf-8")
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
// builtin tooling
|
|
243
|
-
const path$1 = require$$0;
|
|
244
|
-
|
|
245
|
-
// placeholder tooling
|
|
246
|
-
let sugarss;
|
|
247
|
-
|
|
248
|
-
var processContent$1 = function processContent(
|
|
249
|
-
result,
|
|
250
|
-
content,
|
|
251
|
-
filename,
|
|
252
|
-
options,
|
|
253
|
-
postcss
|
|
254
|
-
) {
|
|
255
|
-
const { plugins } = options;
|
|
256
|
-
const ext = path$1.extname(filename);
|
|
257
|
-
|
|
258
|
-
const parserList = [];
|
|
259
|
-
|
|
260
|
-
// SugarSS support:
|
|
261
|
-
if (ext === ".sss") {
|
|
262
|
-
if (!sugarss) {
|
|
263
|
-
try {
|
|
264
|
-
sugarss = __require('sugarss');
|
|
265
|
-
} catch {} // Ignore
|
|
266
|
-
}
|
|
267
|
-
if (sugarss)
|
|
268
|
-
return runPostcss(postcss, content, filename, plugins, [sugarss])
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// Syntax support:
|
|
272
|
-
if (result.opts.syntax?.parse) {
|
|
273
|
-
parserList.push(result.opts.syntax.parse);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Parser support:
|
|
277
|
-
if (result.opts.parser) parserList.push(result.opts.parser);
|
|
278
|
-
// Try the default as a last resort:
|
|
279
|
-
parserList.push(null);
|
|
280
|
-
|
|
281
|
-
return runPostcss(postcss, content, filename, plugins, parserList)
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
function runPostcss(postcss, content, filename, plugins, parsers, index) {
|
|
285
|
-
if (!index) index = 0;
|
|
286
|
-
return postcss(plugins)
|
|
287
|
-
.process(content, {
|
|
288
|
-
from: filename,
|
|
289
|
-
parser: parsers[index],
|
|
290
|
-
})
|
|
291
|
-
.catch(err => {
|
|
292
|
-
// If there's an error, try the next parser
|
|
293
|
-
index++;
|
|
294
|
-
// If there are no parsers left, throw it
|
|
295
|
-
if (index === parsers.length) throw err
|
|
296
|
-
return runPostcss(postcss, content, filename, plugins, parsers, index)
|
|
297
|
-
})
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// external tooling
|
|
301
|
-
const valueParser = lib;
|
|
302
|
-
|
|
303
|
-
// extended tooling
|
|
304
|
-
const { stringify } = valueParser;
|
|
305
|
-
|
|
306
|
-
function split(params, start) {
|
|
307
|
-
const list = [];
|
|
308
|
-
const last = params.reduce((item, node, index) => {
|
|
309
|
-
if (index < start) return ""
|
|
310
|
-
if (node.type === "div" && node.value === ",") {
|
|
311
|
-
list.push(item);
|
|
312
|
-
return ""
|
|
313
|
-
}
|
|
314
|
-
return item + stringify(node)
|
|
315
|
-
}, "");
|
|
316
|
-
list.push(last);
|
|
317
|
-
return list
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
var parseStatements$1 = function (result, styles) {
|
|
321
|
-
const statements = [];
|
|
322
|
-
let nodes = [];
|
|
323
|
-
|
|
324
|
-
styles.each(node => {
|
|
325
|
-
let stmt;
|
|
326
|
-
if (node.type === "atrule") {
|
|
327
|
-
if (node.name === "import") stmt = parseImport(result, node);
|
|
328
|
-
else if (node.name === "media") stmt = parseMedia(result, node);
|
|
329
|
-
else if (node.name === "charset") stmt = parseCharset(result, node);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (stmt) {
|
|
333
|
-
if (nodes.length) {
|
|
334
|
-
statements.push({
|
|
335
|
-
type: "nodes",
|
|
336
|
-
nodes,
|
|
337
|
-
media: [],
|
|
338
|
-
layer: [],
|
|
339
|
-
});
|
|
340
|
-
nodes = [];
|
|
341
|
-
}
|
|
342
|
-
statements.push(stmt);
|
|
343
|
-
} else nodes.push(node);
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
if (nodes.length) {
|
|
347
|
-
statements.push({
|
|
348
|
-
type: "nodes",
|
|
349
|
-
nodes,
|
|
350
|
-
media: [],
|
|
351
|
-
layer: [],
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
return statements
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
function parseMedia(result, atRule) {
|
|
359
|
-
const params = valueParser(atRule.params).nodes;
|
|
360
|
-
return {
|
|
361
|
-
type: "media",
|
|
362
|
-
node: atRule,
|
|
363
|
-
media: split(params, 0),
|
|
364
|
-
layer: [],
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
function parseCharset(result, atRule) {
|
|
369
|
-
if (atRule.prev()) {
|
|
370
|
-
return result.warn("@charset must precede all other statements", {
|
|
371
|
-
node: atRule,
|
|
372
|
-
})
|
|
373
|
-
}
|
|
374
|
-
return {
|
|
375
|
-
type: "charset",
|
|
376
|
-
node: atRule,
|
|
377
|
-
media: [],
|
|
378
|
-
layer: [],
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function parseImport(result, atRule) {
|
|
383
|
-
let prev = atRule.prev();
|
|
384
|
-
if (prev) {
|
|
385
|
-
do {
|
|
386
|
-
if (
|
|
387
|
-
prev.type !== "comment" &&
|
|
388
|
-
(prev.type !== "atrule" ||
|
|
389
|
-
(prev.name !== "import" &&
|
|
390
|
-
prev.name !== "charset" &&
|
|
391
|
-
!(prev.name === "layer" && !prev.nodes)))
|
|
392
|
-
) {
|
|
393
|
-
return result.warn(
|
|
394
|
-
"@import must precede all other statements (besides @charset or empty @layer)",
|
|
395
|
-
{ node: atRule }
|
|
396
|
-
)
|
|
397
|
-
}
|
|
398
|
-
prev = prev.prev();
|
|
399
|
-
} while (prev)
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (atRule.nodes) {
|
|
403
|
-
return result.warn(
|
|
404
|
-
"It looks like you didn't end your @import statement correctly. " +
|
|
405
|
-
"Child nodes are attached to it.",
|
|
406
|
-
{ node: atRule }
|
|
407
|
-
)
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const params = valueParser(atRule.params).nodes;
|
|
411
|
-
const stmt = {
|
|
412
|
-
type: "import",
|
|
413
|
-
node: atRule,
|
|
414
|
-
media: [],
|
|
415
|
-
layer: [],
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
// prettier-ignore
|
|
419
|
-
if (
|
|
420
|
-
!params.length ||
|
|
421
|
-
(
|
|
422
|
-
params[0].type !== "string" ||
|
|
423
|
-
!params[0].value
|
|
424
|
-
) &&
|
|
425
|
-
(
|
|
426
|
-
params[0].type !== "function" ||
|
|
427
|
-
params[0].value !== "url" ||
|
|
428
|
-
!params[0].nodes.length ||
|
|
429
|
-
!params[0].nodes[0].value
|
|
430
|
-
)
|
|
431
|
-
) {
|
|
432
|
-
return result.warn(`Unable to find uri in '${ atRule.toString() }'`, {
|
|
433
|
-
node: atRule,
|
|
434
|
-
})
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
if (params[0].type === "string") stmt.uri = params[0].value;
|
|
438
|
-
else stmt.uri = params[0].nodes[0].value;
|
|
439
|
-
stmt.fullUri = stringify(params[0]);
|
|
440
|
-
|
|
441
|
-
let remainder = params;
|
|
442
|
-
if (remainder.length > 2) {
|
|
443
|
-
if (
|
|
444
|
-
(remainder[2].type === "word" || remainder[2].type === "function") &&
|
|
445
|
-
remainder[2].value === "layer"
|
|
446
|
-
) {
|
|
447
|
-
if (remainder[1].type !== "space") {
|
|
448
|
-
return result.warn("Invalid import layer statement", { node: atRule })
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (remainder[2].nodes) {
|
|
452
|
-
stmt.layer = [stringify(remainder[2].nodes)];
|
|
453
|
-
} else {
|
|
454
|
-
stmt.layer = [""];
|
|
455
|
-
}
|
|
456
|
-
remainder = remainder.slice(2);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
if (remainder.length > 2) {
|
|
461
|
-
if (remainder[1].type !== "space") {
|
|
462
|
-
return result.warn("Invalid import media statement", { node: atRule })
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
stmt.media = split(remainder, 2);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
return stmt
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
var assignLayerNames$1 = function (layer, node, state, options) {
|
|
472
|
-
layer.forEach((layerPart, i) => {
|
|
473
|
-
if (layerPart.trim() === "") {
|
|
474
|
-
if (options.nameLayer) {
|
|
475
|
-
layer[i] = options
|
|
476
|
-
.nameLayer(state.anonymousLayerCounter++, state.rootFilename)
|
|
477
|
-
.toString();
|
|
478
|
-
} else {
|
|
479
|
-
throw node.error(
|
|
480
|
-
`When using anonymous layers in @import you must also set the "nameLayer" plugin option`
|
|
481
|
-
)
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
// builtin tooling
|
|
488
|
-
const path = require$$0;
|
|
489
|
-
|
|
490
|
-
// internal tooling
|
|
491
|
-
const joinMedia = joinMedia$1;
|
|
492
|
-
const joinLayer = joinLayer$1;
|
|
493
|
-
const resolveId = (id) => id;
|
|
494
|
-
const loadContent = loadContent$1;
|
|
495
|
-
const processContent = processContent$1;
|
|
496
|
-
const parseStatements = parseStatements$1;
|
|
497
|
-
const assignLayerNames = assignLayerNames$1;
|
|
498
|
-
const dataURL = dataUrl;
|
|
499
|
-
|
|
500
|
-
function AtImport(options) {
|
|
501
|
-
options = {
|
|
502
|
-
root: process.cwd(),
|
|
503
|
-
path: [],
|
|
504
|
-
skipDuplicates: true,
|
|
505
|
-
resolve: resolveId,
|
|
506
|
-
load: loadContent,
|
|
507
|
-
plugins: [],
|
|
508
|
-
addModulesDirectories: [],
|
|
509
|
-
nameLayer: null,
|
|
510
|
-
...options,
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
options.root = path.resolve(options.root);
|
|
514
|
-
|
|
515
|
-
// convert string to an array of a single element
|
|
516
|
-
if (typeof options.path === "string") options.path = [options.path];
|
|
517
|
-
|
|
518
|
-
if (!Array.isArray(options.path)) options.path = [];
|
|
519
|
-
|
|
520
|
-
options.path = options.path.map(p => path.resolve(options.root, p));
|
|
521
|
-
|
|
522
|
-
return {
|
|
523
|
-
postcssPlugin: "postcss-import",
|
|
524
|
-
Once(styles, { result, atRule, postcss }) {
|
|
525
|
-
const state = {
|
|
526
|
-
importedFiles: {},
|
|
527
|
-
hashFiles: {},
|
|
528
|
-
rootFilename: null,
|
|
529
|
-
anonymousLayerCounter: 0,
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
if (styles.source?.input?.file) {
|
|
533
|
-
state.rootFilename = styles.source.input.file;
|
|
534
|
-
state.importedFiles[styles.source.input.file] = {};
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (options.plugins && !Array.isArray(options.plugins)) {
|
|
538
|
-
throw new Error("plugins option must be an array")
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if (options.nameLayer && typeof options.nameLayer !== "function") {
|
|
542
|
-
throw new Error("nameLayer option must be a function")
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
return parseStyles(result, styles, options, state, [], []).then(
|
|
546
|
-
bundle => {
|
|
547
|
-
applyRaws(bundle);
|
|
548
|
-
applyMedia(bundle);
|
|
549
|
-
applyStyles(bundle, styles);
|
|
550
|
-
}
|
|
551
|
-
)
|
|
552
|
-
|
|
553
|
-
function applyRaws(bundle) {
|
|
554
|
-
bundle.forEach((stmt, index) => {
|
|
555
|
-
if (index === 0) return
|
|
556
|
-
|
|
557
|
-
if (stmt.parent) {
|
|
558
|
-
const { before } = stmt.parent.node.raws;
|
|
559
|
-
if (stmt.type === "nodes") stmt.nodes[0].raws.before = before;
|
|
560
|
-
else stmt.node.raws.before = before;
|
|
561
|
-
} else if (stmt.type === "nodes") {
|
|
562
|
-
stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n";
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
function applyMedia(bundle) {
|
|
568
|
-
bundle.forEach(stmt => {
|
|
569
|
-
if (
|
|
570
|
-
(!stmt.media.length && !stmt.layer.length) ||
|
|
571
|
-
stmt.type === "charset"
|
|
572
|
-
) {
|
|
573
|
-
return
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
if (stmt.layer.length > 1) {
|
|
577
|
-
assignLayerNames(stmt.layer, stmt.node, state, options);
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
if (stmt.type === "import") {
|
|
581
|
-
const parts = [stmt.fullUri];
|
|
582
|
-
|
|
583
|
-
const media = stmt.media.join(", ");
|
|
584
|
-
|
|
585
|
-
if (stmt.layer.length) {
|
|
586
|
-
const layerName = stmt.layer.join(".");
|
|
587
|
-
|
|
588
|
-
let layerParams = "layer";
|
|
589
|
-
if (layerName) {
|
|
590
|
-
layerParams = `layer(${layerName})`;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
parts.push(layerParams);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
if (media) {
|
|
597
|
-
parts.push(media);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
stmt.node.params = parts.join(" ");
|
|
601
|
-
} else if (stmt.type === "media") {
|
|
602
|
-
if (stmt.layer.length) {
|
|
603
|
-
const layerNode = atRule({
|
|
604
|
-
name: "layer",
|
|
605
|
-
params: stmt.layer.join("."),
|
|
606
|
-
source: stmt.node.source,
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
if (stmt.parentMedia?.length) {
|
|
610
|
-
const mediaNode = atRule({
|
|
611
|
-
name: "media",
|
|
612
|
-
params: stmt.parentMedia.join(", "),
|
|
613
|
-
source: stmt.node.source,
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
mediaNode.append(layerNode);
|
|
617
|
-
layerNode.append(stmt.node);
|
|
618
|
-
stmt.node = mediaNode;
|
|
619
|
-
} else {
|
|
620
|
-
layerNode.append(stmt.node);
|
|
621
|
-
stmt.node = layerNode;
|
|
622
|
-
}
|
|
623
|
-
} else {
|
|
624
|
-
stmt.node.params = stmt.media.join(", ");
|
|
625
|
-
}
|
|
626
|
-
} else {
|
|
627
|
-
const { nodes } = stmt;
|
|
628
|
-
const { parent } = nodes[0];
|
|
629
|
-
|
|
630
|
-
let outerAtRule;
|
|
631
|
-
let innerAtRule;
|
|
632
|
-
if (stmt.media.length && stmt.layer.length) {
|
|
633
|
-
const mediaNode = atRule({
|
|
634
|
-
name: "media",
|
|
635
|
-
params: stmt.media.join(", "),
|
|
636
|
-
source: parent.source,
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
const layerNode = atRule({
|
|
640
|
-
name: "layer",
|
|
641
|
-
params: stmt.layer.join("."),
|
|
642
|
-
source: parent.source,
|
|
643
|
-
});
|
|
644
|
-
|
|
645
|
-
mediaNode.append(layerNode);
|
|
646
|
-
innerAtRule = layerNode;
|
|
647
|
-
outerAtRule = mediaNode;
|
|
648
|
-
} else if (stmt.media.length) {
|
|
649
|
-
const mediaNode = atRule({
|
|
650
|
-
name: "media",
|
|
651
|
-
params: stmt.media.join(", "),
|
|
652
|
-
source: parent.source,
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
innerAtRule = mediaNode;
|
|
656
|
-
outerAtRule = mediaNode;
|
|
657
|
-
} else if (stmt.layer.length) {
|
|
658
|
-
const layerNode = atRule({
|
|
659
|
-
name: "layer",
|
|
660
|
-
params: stmt.layer.join("."),
|
|
661
|
-
source: parent.source,
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
innerAtRule = layerNode;
|
|
665
|
-
outerAtRule = layerNode;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
parent.insertBefore(nodes[0], outerAtRule);
|
|
669
|
-
|
|
670
|
-
// remove nodes
|
|
671
|
-
nodes.forEach(node => {
|
|
672
|
-
node.parent = undefined;
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
// better output
|
|
676
|
-
nodes[0].raws.before = nodes[0].raws.before || "\n";
|
|
677
|
-
|
|
678
|
-
// wrap new rules with media query and/or layer at rule
|
|
679
|
-
innerAtRule.append(nodes);
|
|
680
|
-
|
|
681
|
-
stmt.type = "media";
|
|
682
|
-
stmt.node = outerAtRule;
|
|
683
|
-
delete stmt.nodes;
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
function applyStyles(bundle, styles) {
|
|
689
|
-
styles.nodes = [];
|
|
690
|
-
|
|
691
|
-
// Strip additional statements.
|
|
692
|
-
bundle.forEach(stmt => {
|
|
693
|
-
if (["charset", "import", "media"].includes(stmt.type)) {
|
|
694
|
-
stmt.node.parent = undefined;
|
|
695
|
-
styles.append(stmt.node);
|
|
696
|
-
} else if (stmt.type === "nodes") {
|
|
697
|
-
stmt.nodes.forEach(node => {
|
|
698
|
-
node.parent = undefined;
|
|
699
|
-
styles.append(node);
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
function parseStyles(result, styles, options, state, media, layer) {
|
|
706
|
-
const statements = parseStatements(result, styles);
|
|
707
|
-
|
|
708
|
-
return Promise.resolve(statements)
|
|
709
|
-
.then(stmts => {
|
|
710
|
-
// process each statement in series
|
|
711
|
-
return stmts.reduce((promise, stmt) => {
|
|
712
|
-
return promise.then(() => {
|
|
713
|
-
stmt.media = joinMedia(media, stmt.media || []);
|
|
714
|
-
stmt.parentMedia = media;
|
|
715
|
-
stmt.layer = joinLayer(layer, stmt.layer || []);
|
|
716
|
-
|
|
717
|
-
// skip protocol base uri (protocol://url) or protocol-relative
|
|
718
|
-
if (
|
|
719
|
-
stmt.type !== "import" ||
|
|
720
|
-
/^(?:[a-z]+:)?\/\//i.test(stmt.uri)
|
|
721
|
-
) {
|
|
722
|
-
return
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
if (options.filter && !options.filter(stmt.uri)) {
|
|
726
|
-
// rejected by filter
|
|
727
|
-
return
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
return resolveImportId(result, stmt, options, state)
|
|
731
|
-
})
|
|
732
|
-
}, Promise.resolve())
|
|
733
|
-
})
|
|
734
|
-
.then(() => {
|
|
735
|
-
let charset;
|
|
736
|
-
const imports = [];
|
|
737
|
-
const bundle = [];
|
|
738
|
-
|
|
739
|
-
function handleCharset(stmt) {
|
|
740
|
-
if (!charset) charset = stmt;
|
|
741
|
-
// charsets aren't case-sensitive, so convert to lower case to compare
|
|
742
|
-
else if (
|
|
743
|
-
stmt.node.params.toLowerCase() !==
|
|
744
|
-
charset.node.params.toLowerCase()
|
|
745
|
-
) {
|
|
746
|
-
throw new Error(
|
|
747
|
-
`Incompatable @charset statements:
|
|
748
|
-
${stmt.node.params} specified in ${stmt.node.source.input.file}
|
|
749
|
-
${charset.node.params} specified in ${charset.node.source.input.file}`
|
|
750
|
-
)
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
// squash statements and their children
|
|
755
|
-
statements.forEach(stmt => {
|
|
756
|
-
if (stmt.type === "charset") handleCharset(stmt);
|
|
757
|
-
else if (stmt.type === "import") {
|
|
758
|
-
if (stmt.children) {
|
|
759
|
-
stmt.children.forEach((child, index) => {
|
|
760
|
-
if (child.type === "import") imports.push(child);
|
|
761
|
-
else if (child.type === "charset") handleCharset(child);
|
|
762
|
-
else bundle.push(child);
|
|
763
|
-
// For better output
|
|
764
|
-
if (index === 0) child.parent = stmt;
|
|
765
|
-
});
|
|
766
|
-
} else imports.push(stmt);
|
|
767
|
-
} else if (stmt.type === "media" || stmt.type === "nodes") {
|
|
768
|
-
bundle.push(stmt);
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
|
|
772
|
-
return charset
|
|
773
|
-
? [charset, ...imports.concat(bundle)]
|
|
774
|
-
: imports.concat(bundle)
|
|
775
|
-
})
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
function resolveImportId(result, stmt, options, state) {
|
|
779
|
-
if (dataURL.isValid(stmt.uri)) {
|
|
780
|
-
return loadImportContent(result, stmt, stmt.uri, options, state).then(
|
|
781
|
-
result => {
|
|
782
|
-
stmt.children = result;
|
|
783
|
-
}
|
|
784
|
-
)
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
const atRule = stmt.node;
|
|
788
|
-
let sourceFile;
|
|
789
|
-
if (atRule.source?.input?.file) {
|
|
790
|
-
sourceFile = atRule.source.input.file;
|
|
791
|
-
}
|
|
792
|
-
const base = sourceFile
|
|
793
|
-
? path.dirname(atRule.source.input.file)
|
|
794
|
-
: options.root;
|
|
795
|
-
|
|
796
|
-
return Promise.resolve(options.resolve(stmt.uri, base, options))
|
|
797
|
-
.then(paths => {
|
|
798
|
-
if (!Array.isArray(paths)) paths = [paths];
|
|
799
|
-
// Ensure that each path is absolute:
|
|
800
|
-
return Promise.all(
|
|
801
|
-
paths.map(file => {
|
|
802
|
-
return !path.isAbsolute(file)
|
|
803
|
-
? resolveId(file)
|
|
804
|
-
: file
|
|
805
|
-
})
|
|
806
|
-
)
|
|
807
|
-
})
|
|
808
|
-
.then(resolved => {
|
|
809
|
-
// Add dependency messages:
|
|
810
|
-
resolved.forEach(file => {
|
|
811
|
-
result.messages.push({
|
|
812
|
-
type: "dependency",
|
|
813
|
-
plugin: "postcss-import",
|
|
814
|
-
file,
|
|
815
|
-
parent: sourceFile,
|
|
816
|
-
});
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
return Promise.all(
|
|
820
|
-
resolved.map(file => {
|
|
821
|
-
return loadImportContent(result, stmt, file, options, state)
|
|
822
|
-
})
|
|
823
|
-
)
|
|
824
|
-
})
|
|
825
|
-
.then(result => {
|
|
826
|
-
// Merge loaded statements
|
|
827
|
-
stmt.children = result.reduce((result, statements) => {
|
|
828
|
-
return statements ? result.concat(statements) : result
|
|
829
|
-
}, []);
|
|
830
|
-
})
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
function loadImportContent(result, stmt, filename, options, state) {
|
|
834
|
-
const atRule = stmt.node;
|
|
835
|
-
const { media, layer } = stmt;
|
|
836
|
-
|
|
837
|
-
assignLayerNames(layer, atRule, state, options);
|
|
838
|
-
|
|
839
|
-
if (options.skipDuplicates) {
|
|
840
|
-
// skip files already imported at the same scope
|
|
841
|
-
if (state.importedFiles[filename]?.[media]?.[layer]) {
|
|
842
|
-
return
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
// save imported files to skip them next time
|
|
846
|
-
if (!state.importedFiles[filename]) {
|
|
847
|
-
state.importedFiles[filename] = {};
|
|
848
|
-
}
|
|
849
|
-
if (!state.importedFiles[filename][media]) {
|
|
850
|
-
state.importedFiles[filename][media] = {};
|
|
851
|
-
}
|
|
852
|
-
state.importedFiles[filename][media][layer] = true;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
return Promise.resolve(options.load(filename, options)).then(
|
|
856
|
-
content => {
|
|
857
|
-
if (content.trim() === "") {
|
|
858
|
-
result.warn(`${filename} is empty`, { node: atRule });
|
|
859
|
-
return
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
// skip previous imported files not containing @import rules
|
|
863
|
-
if (state.hashFiles[content]?.[media]?.[layer]) {
|
|
864
|
-
return
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
return processContent(
|
|
868
|
-
result,
|
|
869
|
-
content,
|
|
870
|
-
filename,
|
|
871
|
-
options,
|
|
872
|
-
postcss
|
|
873
|
-
).then(importedResult => {
|
|
874
|
-
const styles = importedResult.root;
|
|
875
|
-
result.messages = result.messages.concat(importedResult.messages);
|
|
876
|
-
|
|
877
|
-
if (options.skipDuplicates) {
|
|
878
|
-
const hasImport = styles.some(child => {
|
|
879
|
-
return child.type === "atrule" && child.name === "import"
|
|
880
|
-
});
|
|
881
|
-
if (!hasImport) {
|
|
882
|
-
// save hash files to skip them next time
|
|
883
|
-
if (!state.hashFiles[content]) {
|
|
884
|
-
state.hashFiles[content] = {};
|
|
885
|
-
}
|
|
886
|
-
if (!state.hashFiles[content][media]) {
|
|
887
|
-
state.hashFiles[content][media] = {};
|
|
888
|
-
}
|
|
889
|
-
state.hashFiles[content][media][layer] = true;
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
// recursion: import @import from imported file
|
|
894
|
-
return parseStyles(result, styles, options, state, media, layer)
|
|
895
|
-
})
|
|
896
|
-
}
|
|
897
|
-
)
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
AtImport.postcss = true;
|
|
904
|
-
|
|
905
|
-
var postcssImport = AtImport;
|
|
906
|
-
|
|
907
|
-
var index = /*@__PURE__*/getDefaultExportFromCjs(postcssImport);
|
|
908
|
-
|
|
909
|
-
var index$1 = /*#__PURE__*/_mergeNamespaces({
|
|
910
|
-
__proto__: null,
|
|
911
|
-
default: index
|
|
912
|
-
}, [postcssImport]);
|
|
913
|
-
|
|
914
|
-
export { index$1 as i };
|