diva.js 7.2.5 → 7.2.6
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/README.md +65 -11
- package/build/diva.debug.js +29165 -0
- package/build/diva.esm.js +17 -0
- package/build/diva.js +17 -0
- package/package.json +15 -1
- package/.clang-format +0 -7
- package/.github/workflows/npm-publish.yml +0 -45
- package/Makefile +0 -75
- package/elm.json +0 -32
- package/review/elm.json +0 -52
- package/review/src/ReviewConfig.elm +0 -87
- package/scripts/elm-esm.sh +0 -40
- package/scripts/minify-css.mjs +0 -31
- package/src/Filters.elm +0 -1044
- package/src/Main.elm +0 -1217
- package/src/Model.elm +0 -213
- package/src/Msg.elm +0 -59
- package/src/Utilities.elm +0 -46
- package/src/View/CollectionExplorer.elm +0 -172
- package/src/View/Helpers.elm +0 -86
- package/src/View/HtmlRenderer.elm +0 -136
- package/src/View/Icons.elm +0 -159
- package/src/View/ManifestInfoModal.elm +0 -363
- package/src/View/PageViewModal.elm +0 -1046
- package/src/View/Sidebar.elm +0 -786
- package/src/View/Toolbar.elm +0 -189
- package/src/View.elm +0 -244
- package/src/diva.ts +0 -802
- package/src/filters.ts +0 -1843
- package/src/styles/app.css +0 -328
- package/src/styles/collection.css +0 -75
- package/src/styles/modal.css +0 -388
- package/src/styles/sidebar.css +0 -215
- package/src/styles/theme.css +0 -39
- package/src/styles/toolbar.css +0 -154
- package/src/viewer-element.ts +0 -1307
- package/testing/index.html +0 -52
- package/testing/testing.html +0 -231
- package/tsconfig.json +0 -12
package/package.json
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diva.js",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/DDMAL/diva.js.git"
|
|
8
8
|
},
|
|
9
|
+
"main": "./build/diva.js",
|
|
10
|
+
"module": "./build/diva.esm.js",
|
|
11
|
+
"browser": "./build/diva.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./build/diva.esm.js",
|
|
15
|
+
"default": "./build/diva.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"build/",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
9
23
|
"scripts": {
|
|
10
24
|
"format": "find src -name \"*.ts\" -print0 | xargs -0 clang-format -i",
|
|
11
25
|
"develop": "chokidar \"src/**/*\" \"scripts/elm-esm.sh\" \"Makefile\" -c \"make build-dev\""
|
package/.clang-format
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
id-token: write
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
publish:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
environment: npm
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout repository
|
|
18
|
-
uses: actions/checkout@v6
|
|
19
|
-
|
|
20
|
-
- name: Setup Node.js
|
|
21
|
-
uses: actions/setup-node@v6
|
|
22
|
-
with:
|
|
23
|
-
node-version: '24'
|
|
24
|
-
registry-url: 'https://registry.npmjs.org'
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: yarn install
|
|
28
|
-
|
|
29
|
-
- name: Install Elm globally
|
|
30
|
-
run: npm install -g elm
|
|
31
|
-
|
|
32
|
-
- name: Build
|
|
33
|
-
run: make build
|
|
34
|
-
|
|
35
|
-
- name: Verify tag matches package version
|
|
36
|
-
run: |
|
|
37
|
-
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
|
|
38
|
-
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
39
|
-
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
|
|
40
|
-
echo "Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)." >&2
|
|
41
|
-
exit 1
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
- name: Publish to NPM
|
|
45
|
-
run: npm publish --provenance
|
package/Makefile
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
SHELL := /bin/sh
|
|
2
|
-
|
|
3
|
-
ELM_SRC := src/Main.elm
|
|
4
|
-
TS_SRC := src/diva.ts
|
|
5
|
-
TS_VE_SRC := src/viewer-element.ts
|
|
6
|
-
TS_FT_SRC := src/filters.ts
|
|
7
|
-
CSS_SRC := $(wildcard src/styles/*.css)
|
|
8
|
-
DIVA_CSS := cache/diva.css
|
|
9
|
-
ELM_OUT := cache/elm.js
|
|
10
|
-
ELM_ESM := cache/elm-esm.js
|
|
11
|
-
DIVA_DEBUG := build/diva.debug.js
|
|
12
|
-
DIVA_JS := build/diva.js
|
|
13
|
-
ELM_ESM_SCRIPT := scripts/elm-esm.sh
|
|
14
|
-
ELM_FLAGS ?= --optimize
|
|
15
|
-
VERSION ?= $(shell node -p "require('./package.json').version")
|
|
16
|
-
RELEASE_PREFIX := diva.js-$(VERSION)
|
|
17
|
-
RELEASE_DIR := release
|
|
18
|
-
RELEASE_TAR := $(RELEASE_DIR)/$(RELEASE_PREFIX).tar.gz
|
|
19
|
-
RELEASE_ZIP := $(RELEASE_DIR)/$(RELEASE_PREFIX).zip
|
|
20
|
-
|
|
21
|
-
.PHONY: all build build-dev clean clean-cache release
|
|
22
|
-
|
|
23
|
-
all: build
|
|
24
|
-
|
|
25
|
-
build: clean-cache $(DIVA_JS)
|
|
26
|
-
|
|
27
|
-
build-dev: ELM_FLAGS = --debug
|
|
28
|
-
build-dev:
|
|
29
|
-
$(MAKE) -B ELM_FLAGS=--debug clean-cache $(DIVA_DEBUG)
|
|
30
|
-
|
|
31
|
-
$(ELM_OUT): $(ELM_SRC)
|
|
32
|
-
mkdir -p build
|
|
33
|
-
elm make $(ELM_FLAGS) $(ELM_SRC) --output=$(ELM_OUT)
|
|
34
|
-
|
|
35
|
-
$(ELM_ESM): $(ELM_OUT) $(ELM_ESM_SCRIPT)
|
|
36
|
-
./scripts/elm-esm.sh $(ELM_OUT) $(ELM_ESM)
|
|
37
|
-
|
|
38
|
-
$(DIVA_CSS): $(CSS_SRC) scripts/minify-css.mjs
|
|
39
|
-
node ./scripts/minify-css.mjs
|
|
40
|
-
|
|
41
|
-
$(DIVA_DEBUG): $(TS_SRC) $(TS_VE_SRC) $(TS_FT_SRC) $(DIVA_CSS) $(ELM_ESM)
|
|
42
|
-
mkdir -p public
|
|
43
|
-
yarn -s esbuild $(TS_SRC) --bundle --format=iife --platform=browser --target=es2019 --loader:.css=text --outfile=$(DIVA_DEBUG)
|
|
44
|
-
|
|
45
|
-
$(DIVA_JS): $(TS_SRC) $(TS_VE_SRC) $(TS_FT_SRC) $(DIVA_CSS) $(ELM_ESM)
|
|
46
|
-
yarn -s esbuild $(TS_SRC) --bundle --format=iife --platform=browser --target=es2019 --loader:.css=text --minify --drop:console --pure:F2 --pure:F3 --pure:F4 --pure:F5 --pure:F6 --pure:F7 --pure:F8 --pure:F9 --pure:A2 --pure:A3 --pure:A4 --pure:A5 --pure:A6 --pure:A7 --pure:A8 --pure:A9 --outfile=$(DIVA_JS)
|
|
47
|
-
@min="$(DIVA_JS)"; \
|
|
48
|
-
MINIFIED_SIZE=$$(wc -c < "$$min"); \
|
|
49
|
-
GZIPPED_SIZE=$$(gzip -c "$$min" | wc -c); \
|
|
50
|
-
MINIFIED_HR=$$(numfmt --to=iec-i --suffix=B "$$MINIFIED_SIZE"); \
|
|
51
|
-
GZIPPED_HR=$$(numfmt --to=iec-i --suffix=B "$$GZIPPED_SIZE"); \
|
|
52
|
-
printf "%-18s %10s (%7s) %s\n" "Minified size:" "$$MINIFIED_SIZE bytes" "$$MINIFIED_HR" "$$min"; \
|
|
53
|
-
printf "%-18s %10s (%7s)\n" "Gzipped size:" "$$GZIPPED_SIZE bytes" "$$GZIPPED_HR";
|
|
54
|
-
|
|
55
|
-
clean:
|
|
56
|
-
rm -f $(ELM_OUT) $(ELM_ESM) $(DIVA_JS) $(DIVA_DEBUG) $(DIVA_CSS) build/diva.css build/diva.min.css
|
|
57
|
-
|
|
58
|
-
clean-cache:
|
|
59
|
-
rm -f cache/*
|
|
60
|
-
|
|
61
|
-
release: clean build build-dev
|
|
62
|
-
mkdir -p $(RELEASE_DIR)
|
|
63
|
-
@LICENSE_FILE=$$(ls LICENSE* 2>/dev/null | head -n 1); \
|
|
64
|
-
if [ -z "$$LICENSE_FILE" ]; then \
|
|
65
|
-
echo "Error: no LICENSE file found in project root."; \
|
|
66
|
-
exit 1; \
|
|
67
|
-
fi; \
|
|
68
|
-
tar -czf "$(RELEASE_TAR)" build README.md "$$LICENSE_FILE"; \
|
|
69
|
-
zip -rq "$(RELEASE_ZIP)" build README.md "$$LICENSE_FILE"; \
|
|
70
|
-
echo "Created $(RELEASE_TAR)"; \
|
|
71
|
-
echo "Created $(RELEASE_ZIP)"
|
|
72
|
-
|
|
73
|
-
publish: clean build
|
|
74
|
-
cp -r build .
|
|
75
|
-
npm publish
|
package/elm.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "application",
|
|
3
|
-
"source-directories": [
|
|
4
|
-
"src"
|
|
5
|
-
],
|
|
6
|
-
"elm-version": "0.19.1",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"direct": {
|
|
9
|
-
"elm/browser": "1.0.2",
|
|
10
|
-
"elm/core": "1.0.5",
|
|
11
|
-
"elm/html": "1.0.1",
|
|
12
|
-
"elm/http": "2.0.0",
|
|
13
|
-
"elm/json": "1.1.4",
|
|
14
|
-
"elm/svg": "1.0.1",
|
|
15
|
-
"hecrj/html-parser": "2.4.0",
|
|
16
|
-
"rism-digital/elm-iiif": "1.0.3"
|
|
17
|
-
},
|
|
18
|
-
"indirect": {
|
|
19
|
-
"elm/bytes": "1.0.8",
|
|
20
|
-
"elm/file": "1.0.5",
|
|
21
|
-
"elm/parser": "1.1.0",
|
|
22
|
-
"elm/time": "1.0.0",
|
|
23
|
-
"elm/url": "1.0.0",
|
|
24
|
-
"elm/virtual-dom": "1.0.5",
|
|
25
|
-
"rtfeldman/elm-hex": "1.0.0"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"test-dependencies": {
|
|
29
|
-
"direct": {},
|
|
30
|
-
"indirect": {}
|
|
31
|
-
}
|
|
32
|
-
}
|
package/review/elm.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "application",
|
|
3
|
-
"source-directories": [
|
|
4
|
-
"src"
|
|
5
|
-
],
|
|
6
|
-
"elm-version": "0.19.1",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"direct": {
|
|
9
|
-
"SiriusStarr/elm-review-no-single-pattern-case": "2.1.2",
|
|
10
|
-
"SiriusStarr/elm-review-no-unsorted": "1.1.8",
|
|
11
|
-
"elm/core": "1.0.5",
|
|
12
|
-
"jfmengels/elm-review": "2.16.4",
|
|
13
|
-
"jfmengels/elm-review-code-style": "1.2.0",
|
|
14
|
-
"jfmengels/elm-review-common": "1.3.5",
|
|
15
|
-
"jfmengels/elm-review-debug": "1.0.8",
|
|
16
|
-
"jfmengels/elm-review-performance": "1.0.2",
|
|
17
|
-
"jfmengels/elm-review-simplify": "2.1.15",
|
|
18
|
-
"jfmengels/elm-review-unused": "1.2.6",
|
|
19
|
-
"sparksp/elm-review-imports": "1.0.2",
|
|
20
|
-
"stil4m/elm-syntax": "7.3.9"
|
|
21
|
-
},
|
|
22
|
-
"indirect": {
|
|
23
|
-
"avh4/elm-fifo": "1.0.4",
|
|
24
|
-
"elm/bytes": "1.0.8",
|
|
25
|
-
"elm/html": "1.0.1",
|
|
26
|
-
"elm/json": "1.1.4",
|
|
27
|
-
"elm/parser": "1.1.0",
|
|
28
|
-
"elm/project-metadata-utils": "1.0.2",
|
|
29
|
-
"elm/random": "1.0.0",
|
|
30
|
-
"elm/regex": "1.0.0",
|
|
31
|
-
"elm/time": "1.0.0",
|
|
32
|
-
"elm/virtual-dom": "1.0.5",
|
|
33
|
-
"elm-community/dict-extra": "2.4.0",
|
|
34
|
-
"elm-community/graph": "6.0.0",
|
|
35
|
-
"elm-community/intdict": "3.1.0",
|
|
36
|
-
"elm-community/list-extra": "8.7.0",
|
|
37
|
-
"elm-community/maybe-extra": "5.3.0",
|
|
38
|
-
"elm-community/result-extra": "2.4.0",
|
|
39
|
-
"elm-community/string-extra": "4.0.1",
|
|
40
|
-
"elm-explorations/test": "2.2.1",
|
|
41
|
-
"pzp1997/assoc-list": "1.0.0",
|
|
42
|
-
"rtfeldman/elm-hex": "1.0.0",
|
|
43
|
-
"stil4m/structured-writer": "1.0.3"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"test-dependencies": {
|
|
47
|
-
"direct": {
|
|
48
|
-
"elm-explorations/test": "2.2.1"
|
|
49
|
-
},
|
|
50
|
-
"indirect": {}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
module ReviewConfig exposing (config)
|
|
2
|
-
|
|
3
|
-
{-| Do not rename the ReviewConfig module or the config function, because
|
|
4
|
-
`elm-review` will look for these.
|
|
5
|
-
|
|
6
|
-
To add packages that contain rules, add them to this review project using
|
|
7
|
-
|
|
8
|
-
`elm install author/packagename`
|
|
9
|
-
|
|
10
|
-
when inside the directory containing this file.
|
|
11
|
-
|
|
12
|
-
-}
|
|
13
|
-
|
|
14
|
-
import NoConfusingPrefixOperator
|
|
15
|
-
import NoDebug.Log
|
|
16
|
-
import NoDebug.TodoOrToString
|
|
17
|
-
import NoExposingEverything
|
|
18
|
-
import NoImportingEverything
|
|
19
|
-
import NoInconsistentAliases
|
|
20
|
-
import NoMissingTypeAnnotation
|
|
21
|
-
import NoMissingTypeAnnotationInLetIn
|
|
22
|
-
import NoMissingTypeExpose
|
|
23
|
-
import NoModuleOnExposedNames
|
|
24
|
-
import NoPrematureLetComputation
|
|
25
|
-
import NoSimpleLetBody
|
|
26
|
-
import NoSinglePatternCase
|
|
27
|
-
import NoUnoptimizedRecursion
|
|
28
|
-
import NoUnsortedCases
|
|
29
|
-
import NoUnsortedLetDeclarations
|
|
30
|
-
import NoUnsortedRecords
|
|
31
|
-
import NoUnsortedTopLevelDeclarations
|
|
32
|
-
import NoUnused.CustomTypeConstructorArgs
|
|
33
|
-
import NoUnused.CustomTypeConstructors
|
|
34
|
-
import NoUnused.Dependencies
|
|
35
|
-
import NoUnused.Exports
|
|
36
|
-
import NoUnused.Parameters
|
|
37
|
-
import NoUnused.Patterns
|
|
38
|
-
import NoUnused.Variables
|
|
39
|
-
import Review.Rule as Rule exposing (Rule)
|
|
40
|
-
import Simplify
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
config : List Rule
|
|
44
|
-
config =
|
|
45
|
-
[ NoConfusingPrefixOperator.rule
|
|
46
|
-
, NoDebug.Log.rule
|
|
47
|
-
, NoDebug.TodoOrToString.rule
|
|
48
|
-
|> Rule.ignoreErrorsForDirectories [ "tests/" ]
|
|
49
|
-
, NoExposingEverything.rule
|
|
50
|
-
, NoImportingEverything.rule []
|
|
51
|
-
, NoMissingTypeAnnotation.rule
|
|
52
|
-
, NoMissingTypeExpose.rule
|
|
53
|
-
, NoSimpleLetBody.rule
|
|
54
|
-
, NoPrematureLetComputation.rule
|
|
55
|
-
, NoUnused.CustomTypeConstructors.rule []
|
|
56
|
-
, NoUnused.CustomTypeConstructorArgs.rule
|
|
57
|
-
, NoUnused.Dependencies.rule
|
|
58
|
-
, NoUnused.Exports.rule
|
|
59
|
-
, NoUnused.Parameters.rule
|
|
60
|
-
, NoUnused.Patterns.rule
|
|
61
|
-
, NoUnused.Variables.rule
|
|
62
|
-
, Simplify.rule Simplify.defaults
|
|
63
|
-
, NoSinglePatternCase.rule NoSinglePatternCase.fixInArgument
|
|
64
|
-
|
|
65
|
-
--, NoUnsortedRecords.rule NoUnsortedRecords.defaults
|
|
66
|
-
, NoUnsortedLetDeclarations.rule
|
|
67
|
-
(NoUnsortedLetDeclarations.sortLetDeclarations
|
|
68
|
-
|> NoUnsortedLetDeclarations.usedInExpressionLast
|
|
69
|
-
|> NoUnsortedLetDeclarations.glueHelpersBefore
|
|
70
|
-
)
|
|
71
|
-
, NoUnsortedCases.rule NoUnsortedCases.defaults
|
|
72
|
-
, NoUnsortedTopLevelDeclarations.rule
|
|
73
|
-
(NoUnsortedTopLevelDeclarations.sortTopLevelDeclarations
|
|
74
|
-
|> NoUnsortedTopLevelDeclarations.portsFirst
|
|
75
|
-
|> NoUnsortedTopLevelDeclarations.exposedOrderWithPrivateLast
|
|
76
|
-
|> NoUnsortedTopLevelDeclarations.alphabetically
|
|
77
|
-
)
|
|
78
|
-
, NoInconsistentAliases.config
|
|
79
|
-
[ ( "Html.Attributes", "HA" )
|
|
80
|
-
, ( "Json.Decode", "Decode" )
|
|
81
|
-
, ( "Json.Encode", "Encode" )
|
|
82
|
-
]
|
|
83
|
-
|> NoInconsistentAliases.noMissingAliases
|
|
84
|
-
|> NoInconsistentAliases.rule
|
|
85
|
-
, NoModuleOnExposedNames.rule
|
|
86
|
-
, NoUnoptimizedRecursion.rule (NoUnoptimizedRecursion.optOutWithComment "IGNORE TCO")
|
|
87
|
-
]
|
package/scripts/elm-esm.sh
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
# Converts an Elm build into an ESM module so that it can
|
|
4
|
-
# be imported and used as part of a JS library.
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
INPUT="$1"
|
|
9
|
-
OUTPUT="$2"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if [ -z "$INPUT" ] || [ -z "$OUTPUT" ]; then
|
|
14
|
-
echo "Usage: scripts/elm-esm.sh <input> <output>" 1>&2
|
|
15
|
-
exit 1
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
perl -0777 -e '
|
|
19
|
-
my ($input, $output) = @ARGV;
|
|
20
|
-
open my $fh, "<", $input or die "Failed to read $input: $!";
|
|
21
|
-
my $js = do { local $/; <$fh> };
|
|
22
|
-
close $fh;
|
|
23
|
-
|
|
24
|
-
if ($js !~ /^\s*_Platform_export\(([\s\S]*)\);\n?}\(this\)\);/m) {
|
|
25
|
-
die "Could not find Elm export payload.";
|
|
26
|
-
}
|
|
27
|
-
my $elm_exports = $1;
|
|
28
|
-
|
|
29
|
-
my $out = $js;
|
|
30
|
-
$out =~ s/\(function\s*\(scope\)\s*\{$/\/\/ -- $&/m;
|
|
31
|
-
$out =~ s/["'"]use strict["'"];$/\/\/ -- $&/m;
|
|
32
|
-
$out =~ s/function _Platform_export([\s\S]*?)\}\n/\/\*\n$&\n\*\//g;
|
|
33
|
-
$out =~ s/function _Platform_mergeExports([\s\S]*?)\}\n\s*}/\/\*\n$&\n\*\//g;
|
|
34
|
-
$out =~ s/^\s*_Platform_export\(([\s\S]*)\);\n?}\(this\)\);/\/\*\n$&\n\*\//m;
|
|
35
|
-
$out .= "\nexport const Elm = $elm_exports;\n";
|
|
36
|
-
|
|
37
|
-
open my $out_fh, ">", $output or die "Failed to write $output: $!";
|
|
38
|
-
print {$out_fh} $out;
|
|
39
|
-
close $out_fh;
|
|
40
|
-
' "$INPUT" "$OUTPUT"
|
package/scripts/minify-css.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import {fileURLToPath} from "node:url";
|
|
4
|
-
import {transform} from "lightningcss";
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
const rootDir = path.resolve(__dirname, "..");
|
|
9
|
-
|
|
10
|
-
const sources = [
|
|
11
|
-
"src/styles/theme.css",
|
|
12
|
-
"src/styles/app.css",
|
|
13
|
-
"src/styles/sidebar.css",
|
|
14
|
-
"src/styles/toolbar.css",
|
|
15
|
-
"src/styles/modal.css",
|
|
16
|
-
"src/styles/collection.css",
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const input = await Promise.all(
|
|
20
|
-
sources.map((file) => fs.readFile(path.join(rootDir, file), "utf8"))
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const css = input.join("\n");
|
|
24
|
-
const result = transform({
|
|
25
|
-
code: Buffer.from(css),
|
|
26
|
-
minify: true,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const outDir = path.join(rootDir, "cache");
|
|
30
|
-
await fs.mkdir(outDir, {recursive: true});
|
|
31
|
-
await fs.writeFile(path.join(outDir, "diva.css"), result.code);
|