mazey 4.11.0 → 4.11.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/README.md +1 -1
- package/README.zh-CN.md +363 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +2979 -0
- package/lib/index.esm.js +1 -1
- package/lib/mazey.min.js +1 -1
- package/package.json +1 -1
- package/scripts/rollup.config.mjs +14 -0
- package/.dockerignore +0 -35
- package/.gitattributes +0 -5
- package/.markdownlint.json +0 -48
- package/AGENTS.md +0 -111
- package/Dockerfile +0 -30
package/lib/index.esm.js
CHANGED
package/lib/mazey.min.js
CHANGED
package/package.json
CHANGED
|
@@ -57,6 +57,19 @@ const dTsConf = {
|
|
|
57
57
|
],
|
|
58
58
|
external: [],
|
|
59
59
|
};
|
|
60
|
+
const indexDtsConf = {
|
|
61
|
+
input: _resolve("../src/index.ts"),
|
|
62
|
+
output: [
|
|
63
|
+
{
|
|
64
|
+
file: _resolve("../lib/index.d.ts"),
|
|
65
|
+
format: "es",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
plugins: [
|
|
69
|
+
dts(),
|
|
70
|
+
],
|
|
71
|
+
external: [],
|
|
72
|
+
};
|
|
60
73
|
const gTsConf = {
|
|
61
74
|
input: _resolve("../types/global.d.ts"),
|
|
62
75
|
output: [
|
|
@@ -120,6 +133,7 @@ export default [
|
|
|
120
133
|
],
|
|
121
134
|
external: [],
|
|
122
135
|
},
|
|
136
|
+
indexDtsConf,
|
|
123
137
|
dTsConf,
|
|
124
138
|
gTsConf,
|
|
125
139
|
];
|
package/.dockerignore
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Git
|
|
2
|
-
**/.git
|
|
3
|
-
**/.gitignore
|
|
4
|
-
|
|
5
|
-
# Node.js
|
|
6
|
-
**/node_modules
|
|
7
|
-
**/npm-debug.log
|
|
8
|
-
|
|
9
|
-
# PHP
|
|
10
|
-
**/*.php
|
|
11
|
-
|
|
12
|
-
# Cache & System Files
|
|
13
|
-
**/.DS_Store
|
|
14
|
-
**/Thumbs.db
|
|
15
|
-
**/.vscode
|
|
16
|
-
**/.idea
|
|
17
|
-
**/.cache
|
|
18
|
-
**/tmp
|
|
19
|
-
**/temp
|
|
20
|
-
**/*.code-workspace
|
|
21
|
-
|
|
22
|
-
# Docs
|
|
23
|
-
**/documents/**/*.md
|
|
24
|
-
**/documents/**/*.txt
|
|
25
|
-
|
|
26
|
-
# Cert
|
|
27
|
-
**/cert/**/*.key
|
|
28
|
-
**/cert/**/*.pem
|
|
29
|
-
|
|
30
|
-
# LOG
|
|
31
|
-
**/var-log-web
|
|
32
|
-
|
|
33
|
-
# Archives
|
|
34
|
-
**/*.tar.gz
|
|
35
|
-
**/asset_frozen
|
package/.gitattributes
DELETED
package/.markdownlint.json
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"default": true,
|
|
3
|
-
"MD001": true,
|
|
4
|
-
"MD003": {
|
|
5
|
-
"style": "atx"
|
|
6
|
-
},
|
|
7
|
-
"MD004": {
|
|
8
|
-
"style": "dash"
|
|
9
|
-
},
|
|
10
|
-
"MD007": {
|
|
11
|
-
"indent": 2
|
|
12
|
-
},
|
|
13
|
-
"MD010": {
|
|
14
|
-
"code_blocks": false
|
|
15
|
-
},
|
|
16
|
-
"MD013": {
|
|
17
|
-
"line_length": 700,
|
|
18
|
-
"code_blocks": false,
|
|
19
|
-
"tables": false
|
|
20
|
-
},
|
|
21
|
-
"MD022": {
|
|
22
|
-
"lines_above": 1,
|
|
23
|
-
"lines_below": 1
|
|
24
|
-
},
|
|
25
|
-
"MD024": {
|
|
26
|
-
"siblings_only": true
|
|
27
|
-
},
|
|
28
|
-
"MD025": {
|
|
29
|
-
"front_matter_title": ""
|
|
30
|
-
},
|
|
31
|
-
"MD026": {
|
|
32
|
-
"punctuation": ".,;:!?"
|
|
33
|
-
},
|
|
34
|
-
"MD029": {
|
|
35
|
-
"style": "ordered"
|
|
36
|
-
},
|
|
37
|
-
"MD033": {
|
|
38
|
-
"allowed_elements": ["img", "br", "kbd", "sub", "sup"]
|
|
39
|
-
},
|
|
40
|
-
"MD036": false,
|
|
41
|
-
"MD041": false,
|
|
42
|
-
"MD046": {
|
|
43
|
-
"style": "fenced"
|
|
44
|
-
},
|
|
45
|
-
"MD048": {
|
|
46
|
-
"style": "backtick"
|
|
47
|
-
}
|
|
48
|
-
}
|
package/AGENTS.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
This repository is a browser-focused utility library published as `mazey`. It is not an application or monorepo. The main job here is maintaining a flat public API of frontend helper functions and shipping it in multiple bundle formats.
|
|
6
|
-
|
|
7
|
-
## Repo Map
|
|
8
|
-
|
|
9
|
-
- `src/`: source of truth for the library
|
|
10
|
-
- `types/`: extra global type declarations bundled into `lib/`
|
|
11
|
-
- `test/`: Jest tests, generally one file per source module
|
|
12
|
-
- `examples/`: demo page and TS entry used by the local dev server
|
|
13
|
-
- `scripts/`: Rollup, Webpack, release, and docs helpers
|
|
14
|
-
- `images/`: documentation assets
|
|
15
|
-
- `.github/`: CI/workflows
|
|
16
|
-
|
|
17
|
-
## Main Entry Points
|
|
18
|
-
|
|
19
|
-
- Library source entry: `src/index.ts`
|
|
20
|
-
- Published package outputs:
|
|
21
|
-
- `lib/index.cjs.js`
|
|
22
|
-
- `lib/index.esm.js`
|
|
23
|
-
- `lib/mazey.min.js`
|
|
24
|
-
- `lib/index.d.ts`
|
|
25
|
-
- Dev/demo entry: `examples/index.ts`
|
|
26
|
-
|
|
27
|
-
`src/index.ts` is intentionally simple: it re-exports all feature modules so consumers import from `"mazey"` and get a flat API.
|
|
28
|
-
|
|
29
|
-
## Source Modules
|
|
30
|
-
|
|
31
|
-
- `src/util.ts`: shared utility layer; many other modules depend on this
|
|
32
|
-
- `src/typing.d.ts`: shared internal/public types
|
|
33
|
-
- `src/url.ts`: URL parsing, query helpers, URL transforms, script query inspection
|
|
34
|
-
- `src/dom.ts`: class/style/meta/image DOM helpers
|
|
35
|
-
- `src/event.ts`: custom event registry on `window.MAZEY_DEFINE_LISTENERS`
|
|
36
|
-
- `src/store.ts`: `sessionStorage`, `localStorage`, and cookie helpers
|
|
37
|
-
- `src/load.ts`: dynamic script/CSS/image loading and page-load helpers
|
|
38
|
-
- `src/browser.ts`: browser/platform/PWA detection
|
|
39
|
-
- `src/perf.ts`: Performance API and navigation timing helpers
|
|
40
|
-
- `src/debug.ts`: custom console wrappers
|
|
41
|
-
- `src/calc.ts`: standalone algorithms and probability helpers
|
|
42
|
-
|
|
43
|
-
## Data Flow
|
|
44
|
-
|
|
45
|
-
Typical runtime flow:
|
|
46
|
-
|
|
47
|
-
1. Consumer imports from `mazey`
|
|
48
|
-
2. Package resolves to a built file from `lib/`
|
|
49
|
-
3. Built file originates from `src/index.ts`
|
|
50
|
-
4. `src/index.ts` re-exports functions from the feature modules
|
|
51
|
-
5. Feature modules call browser APIs directly, with light reuse of shared helpers in `util.ts`, `debug.ts`, and `typing.d.ts`
|
|
52
|
-
|
|
53
|
-
Important internal dependencies:
|
|
54
|
-
|
|
55
|
-
- `util.ts` is the main shared dependency
|
|
56
|
-
- `typing.d.ts` is imported across modules for signatures and shared types
|
|
57
|
-
- `debug.ts` provides `mazeyCon`, used by modules like `dom.ts` and `browser.ts`
|
|
58
|
-
- `load.ts` depends on `util.ts` and `url.ts`
|
|
59
|
-
- `perf.ts` depends on `util.ts`
|
|
60
|
-
- `browser.ts` depends on `util.ts`
|
|
61
|
-
- `calc.ts` depends on `util.ts`
|
|
62
|
-
|
|
63
|
-
This is a mostly flat architecture, not a layered service system.
|
|
64
|
-
|
|
65
|
-
## Build And Dev Flow
|
|
66
|
-
|
|
67
|
-
- `npm run build`: Rollup bundles `src/index.ts` into CJS, ESM, and IIFE outputs in `lib/`
|
|
68
|
-
- `npm run dev`: Webpack serves `examples/index.ts` via `examples/index.html`
|
|
69
|
-
- `npm test`: Jest suite across `test/`
|
|
70
|
-
- `npm run docs`: TypeDoc using `README.md`
|
|
71
|
-
|
|
72
|
-
Relevant config files:
|
|
73
|
-
|
|
74
|
-
- `package.json`
|
|
75
|
-
- `scripts/rollup.config.mjs`
|
|
76
|
-
- `scripts/webpack.config.dev.js`
|
|
77
|
-
- `tsconfig.json`
|
|
78
|
-
|
|
79
|
-
## Working Style For Agents
|
|
80
|
-
|
|
81
|
-
- Preserve the flat public API unless there is a strong reason to change it
|
|
82
|
-
- Check `src/index.ts` whenever adding, renaming, or removing exported functions
|
|
83
|
-
- Prefer small, targeted changes; most modules are independent
|
|
84
|
-
- Be careful with browser globals like `window`, `document`, `location`, `navigator`, and `performance`
|
|
85
|
-
- Keep examples and tests aligned with public behavior when you change an exported helper
|
|
86
|
-
- Avoid introducing app-style abstractions unless the repo is clearly moving in that direction
|
|
87
|
-
|
|
88
|
-
## Common Change Paths
|
|
89
|
-
|
|
90
|
-
- Add a new utility:
|
|
91
|
-
- implement in the relevant `src/*.ts`
|
|
92
|
-
- export via `src/index.ts`
|
|
93
|
-
- add or update tests under `test/`
|
|
94
|
-
- ensure build output still succeeds
|
|
95
|
-
|
|
96
|
-
- Change packaging behavior:
|
|
97
|
-
- inspect `package.json`
|
|
98
|
-
- inspect `scripts/rollup.config.mjs`
|
|
99
|
-
- inspect any generated type outputs in `lib/`
|
|
100
|
-
|
|
101
|
-
- Change local demo behavior:
|
|
102
|
-
- inspect `examples/index.ts`
|
|
103
|
-
- inspect `examples/index.html`
|
|
104
|
-
- inspect `scripts/webpack.config.dev.js`
|
|
105
|
-
|
|
106
|
-
## Notes
|
|
107
|
-
|
|
108
|
-
- The library targets browser environments first
|
|
109
|
-
- Some helpers intentionally cache data on `window`
|
|
110
|
-
- Several functions have compatibility-oriented logic for older browsers
|
|
111
|
-
- The README is broad, but the code in `src/` is the authoritative map of behavior
|
package/Dockerfile
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
FROM node:22-bookworm
|
|
2
|
-
|
|
3
|
-
ENV DEBIAN_FRONTEND=noninteractive
|
|
4
|
-
WORKDIR /workspace
|
|
5
|
-
|
|
6
|
-
# Match ubuntu-latest style tooling needed by your workflow
|
|
7
|
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
8
|
-
dos2unix \
|
|
9
|
-
git \
|
|
10
|
-
ca-certificates \
|
|
11
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
12
|
-
|
|
13
|
-
# Copy repo
|
|
14
|
-
COPY . .
|
|
15
|
-
|
|
16
|
-
# Simulate workflow env
|
|
17
|
-
ENV NODE_VERSION=22
|
|
18
|
-
ENV PROJECT_NAME=mazey
|
|
19
|
-
ENV GITHUB_ACTOR=local-dev
|
|
20
|
-
|
|
21
|
-
# Default command runs "test job" behavior
|
|
22
|
-
CMD bash -lc '\
|
|
23
|
-
set -euo pipefail; \
|
|
24
|
-
echo "== Install dependencies =="; \
|
|
25
|
-
npm install; \
|
|
26
|
-
echo "== Build package =="; \
|
|
27
|
-
npm run build --if-present; \
|
|
28
|
-
echo "== Run tests =="; \
|
|
29
|
-
npm test \
|
|
30
|
-
'
|