@pi-r/chrome 0.2.11 → 0.2.13

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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright 2024 An Pham
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
1
+ Copyright 2023 An Pham
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
7
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
- # @pi-r/chrome
2
-
3
- PEP 402 - Forever
4
-
5
- ## LICENSE
6
-
1
+ # @pi-r/chrome
2
+
3
+ ## LICENSE
4
+
7
5
  MIT
package/index.js CHANGED
@@ -11,6 +11,9 @@ const transform_1 = require("@e-mc/document/transform");
11
11
  const Document = require('@e-mc/document');
12
12
  const CACHE_DBRESULT = new Map();
13
13
  const CACHE_LOCALFILE = new Map();
14
+ const CACHE_ETAG = new Map();
15
+ const CACHE_CONTENT = new Map();
16
+ const CACHE_FORMAT = new Map();
14
17
  const CACHE_DATASET = {};
15
18
  const CACHE_ATRULES = {};
16
19
  let CACHE_TOTAL = 0;
@@ -181,7 +184,7 @@ function hasCondition(data, condition) {
181
184
  if (items.length && !isSpace(match[0][0])) {
182
185
  return false;
183
186
  }
184
- items.push([match[1], match[2], match[3]]);
187
+ items.push([match[1], trimQuote(match[2]), trimQuote(match[3])]);
185
188
  }
186
189
  REGEXP_TEMPLATECOMPARISON.lastIndex = 0;
187
190
  const length = items.length;
@@ -931,6 +934,9 @@ class ChromeDocument extends Document {
931
934
  }
932
935
  CACHE_TOTAL = stored.length - result;
933
936
  }
937
+ CACHE_ETAG.clear();
938
+ CACHE_CONTENT.clear();
939
+ CACHE_FORMAT.clear();
934
940
  }
935
941
  return result + (parent && result > 0 ? await super.purgeMemory(typeof parent === 'number' && parent > 0 ? parent : percent, limit, true) : 0);
936
942
  }
@@ -958,12 +964,27 @@ class ChromeDocument extends Document {
958
964
  if (outHtml) {
959
965
  const { etag, initialValue } = htmlFile;
960
966
  let buffer;
961
- if (!initialValue || !(etag && initialValue.etag === etag && (buffer = initialValue.buffer)) || fetched.find(item => item.bundleReplace && (!(0, types_1.isArray)(item.from) || item.from.includes('style')))) {
967
+ if (!initialValue || !(etag && initialValue.etag === etag && (buffer = initialValue.buffer)) || fetched.find(item => item !== htmlFile && item.etag && CACHE_ETAG.get(item.localUri) !== item.etag && (item.inlineContent || item.bundleReplace && (!Array.isArray(item.from) || item.from.includes('style'))))) {
968
+ const isValid = (item) => !!item.localUri && item !== htmlFile && !item.invalid;
969
+ for (const item of fetched) {
970
+ if (item.etag && !item.content && isValid(item)) {
971
+ CACHE_ETAG.set(item.localUri, item.etag);
972
+ }
973
+ }
974
+ for (const item of instance.assets) {
975
+ if (isValid(item)) {
976
+ if (item.content) {
977
+ CACHE_CONTENT.set(item.localUri, item.content);
978
+ }
979
+ if (item.format) {
980
+ CACHE_FORMAT.set(item.localUri, item.format.toString());
981
+ }
982
+ }
983
+ }
962
984
  break;
963
985
  }
964
986
  try {
965
- const { localUri, encoding } = htmlFile;
966
- fs.writeFileSync(localUri, buffer, (0, types_1.getEncoding)(encoding));
987
+ fs.writeFileSync(htmlFile.localUri, buffer, (0, types_1.getEncoding)(htmlFile.encoding));
967
988
  htmlFile.buffer = buffer;
968
989
  htmlFile.sourceUTF8 = undefined;
969
990
  }
@@ -971,12 +992,39 @@ class ChromeDocument extends Document {
971
992
  break;
972
993
  }
973
994
  }
974
- const { jsFiles, cssFiles, svgFiles } = instance;
975
- const copiedAssets = this.copiedAssets;
976
- const wasModified = (item) => fetched.includes(item) || copiedAssets.includes(item) && (!(0, types_1.isEmpty)(item.bundleId) || !(0, types_1.isEmpty)(item.trailingContent));
977
- const js = jsFiles.filter(item => item.imports || wasModified(item));
978
- const css = cssFiles.filter(wasModified);
979
- const svg = svgFiles.filter(wasModified);
995
+ const wasModified = (item) => {
996
+ const localUri = item.localUri;
997
+ let result = fetched.includes(item) || Array.isArray(item.from) && item.from.includes('style');
998
+ if (localUri) {
999
+ if (item.etag && !item.content && !item.invalid) {
1000
+ CACHE_ETAG.set(localUri, item.etag);
1001
+ }
1002
+ else {
1003
+ CACHE_ETAG.delete(localUri);
1004
+ }
1005
+ if (!item.content || item.invalid) {
1006
+ CACHE_CONTENT.delete(localUri);
1007
+ }
1008
+ else if (CACHE_CONTENT.get(localUri) !== item.content || !item.inlineContent && !Document.isPath(localUri)) {
1009
+ CACHE_CONTENT.set(localUri, item.content);
1010
+ result = true;
1011
+ }
1012
+ if (!item.format || item.invalid) {
1013
+ CACHE_FORMAT.delete(localUri);
1014
+ }
1015
+ else {
1016
+ const format = item.format.toString();
1017
+ if (CACHE_FORMAT.get(localUri) !== format || !item.inlineContent && !Document.isPath(localUri)) {
1018
+ CACHE_FORMAT.set(localUri, format);
1019
+ result = true;
1020
+ }
1021
+ }
1022
+ }
1023
+ return result || this.copiedAssets.includes(item) && (!(0, types_1.isEmpty)(item.bundleId) || !(0, types_1.isEmpty)(item.trailingContent));
1024
+ };
1025
+ const js = instance.jsFiles.filter(item => wasModified(item) || !!item.imports);
1026
+ const css = instance.cssFiles.filter(wasModified);
1027
+ const svg = instance.svgFiles.filter(wasModified);
980
1028
  if (js.length || css.length || svg.length) {
981
1029
  instance.jsFiles = js;
982
1030
  instance.cssFiles = css;
@@ -3033,7 +3081,8 @@ class ChromeDocument extends Document {
3033
3081
  const row = items[0];
3034
3082
  let condition = NaN;
3035
3083
  for (let seg of template) {
3036
- switch ((seg = seg.trim()).toLowerCase()) {
3084
+ seg = seg.trim();
3085
+ switch (seg.toLowerCase()) {
3037
3086
  case ':is(and)':
3038
3087
  if (condition === 0) {
3039
3088
  remove = false;
@@ -3226,7 +3275,7 @@ class ChromeDocument extends Document {
3226
3275
  const parseSelector = (value) => {
3227
3276
  const items = [];
3228
3277
  const revised = value.replace(useUnsafeCssReplace ? REGEXP_NTHCHILD_UNSAFE : REGEXP_NTHCHILD, (...capture) => {
3229
- return '`%' + (items.push('\\(' + getStringSome() + (capture[1] === '-' ? '\\x2d' : '\\x2b?') + (capture[2] || '[01]?') + (capture[3] === '0' ? !capture[1] && !capture[2] && !capture[4] && !capture[5] ? '[+-]?0[nN]?' : '0' : '[nN]') + getStringSome() + (capture[5] ? (capture[4] === '-' ? '\\x2d' : '\\x2b') + getStringSome() + capture[5] : `(?:[+-]${getStringSome()}0)?`) + (capture[6] ? getStringMany() + '[oO][fF]' + getStringMany() + capture[6].trim() : '') + getStringSome() + '\\)') - 1) + '`';
3278
+ return '`%' + (items.push('\\(' + getStringSome() + (capture[1] === '-' ? '\\x2d' : '\\x2b?') + (capture[2] || '[01]?') + (capture[3] === '0' ? !capture[1] && !capture[2] && !capture[4] && !capture[5] ? '[+-]?0[nN]?' : '0' : '[nN]?') + getStringSome() + (capture[5] ? (capture[4] === '-' ? '\\x2d' : '\\x2b?') + getStringSome() + capture[5] : `(?:[+-]${getStringSome()}0)?`) + (capture[6] ? getStringMany() + '[oO][fF]' + getStringMany() + capture[6].trim() : '') + getStringSome() + '\\)') - 1) + '`';
3230
3279
  });
3231
3280
  let selector = '';
3232
3281
  for (let i = 0, length = revised.length, casing = false, attr = false, quote = false; i < length; i++) {
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@pi-r/chrome",
3
- "version": "0.2.11",
4
- "description": "Chrome document constructor for E-mc.",
5
- "main": "index.js",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/anpham6/pi-r.git",
12
- "directory": "src/module/chrome"
13
- },
14
- "keywords": [
15
- "squared",
16
- "e-mc",
17
- "squared-functions"
18
- ],
19
- "author": "An Pham <anpham6@gmail.com>",
20
- "license": "MIT",
21
- "homepage": "https://github.com/anpham6/pi-r#readme",
22
- "dependencies": {
23
- "@e-mc/cloud": "^0.5.6",
24
- "@e-mc/core": "^0.5.6",
25
- "@e-mc/document": "^0.5.6",
26
- "@e-mc/types": "^0.5.6"
27
- }
28
- }
1
+ {
2
+ "name": "@pi-r/chrome",
3
+ "version": "0.2.13",
4
+ "description": "Chrome document constructor for E-mc.",
5
+ "main": "index.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/anpham6/pi-r.git",
12
+ "directory": "src/module/chrome"
13
+ },
14
+ "keywords": [
15
+ "squared",
16
+ "e-mc",
17
+ "squared-functions"
18
+ ],
19
+ "author": "An Pham <anpham6@gmail.com>",
20
+ "license": "MIT",
21
+ "homepage": "https://github.com/anpham6/pi-r#readme",
22
+ "dependencies": {
23
+ "@e-mc/cloud": "^0.5.18",
24
+ "@e-mc/core": "^0.5.18",
25
+ "@e-mc/document": "^0.5.18",
26
+ "@e-mc/types": "^0.5.18"
27
+ }
28
+ }
package/types/index.d.ts CHANGED
@@ -1,118 +1,118 @@
1
- import type { LocationUri, XmlTagNode } from '@e-mc/types/lib/squared';
2
-
3
- import type { DocumentConstructor, ICloud, IDocument, IFileManager } from '@e-mc/types/lib';
4
- import type { DocumentAsset as IDocumentAsset } from '@e-mc/types/lib/document';
5
- import type { LogTime } from '@e-mc/types/lib/logger';
6
- import type { DbSourceDataType, DocumentComponentOption, DocumentComponent as IDocumentComponent, DocumentComponentOptions as IDocumentComponentOptions, DocumentDirectory as IDocumentDirectory, DocumentEval as IDocumentEval, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
7
-
8
- import type { CloudScopeOrigin } from '@e-mc/cloud/types';
9
- import type { IDomWriter, IXmlElement } from '@e-mc/document/parse/types';
10
-
11
- import type { ChromeAsset, CssRuleData, DataSource, DocumentOutput } from './squared';
12
-
13
- interface DocumentDirectory extends IDocumentDirectory {
14
- template?: string;
15
- data?: string;
16
- export?: string;
17
- schema?: string;
18
- sql?: string;
19
- }
20
-
21
- interface DocumentComponentExtended<T> extends DbSourceDataType<T> {
22
- uri?: T;
23
- local?: T;
24
- export?: T;
25
- }
26
-
27
- interface DocumentComponentOptions<T> extends IDocumentComponentOptions, DocumentComponentExtended<DocumentComponentOption<T>> {}
28
-
29
- interface DocumentEval extends IDocumentEval {
30
- template?: boolean;
31
- userconfig?: boolean;
32
- }
33
-
34
- interface ChromeDocumentSettings extends IDocumentSettings {
35
- directory?: DocumentDirectory;
36
- options?: DocumentComponentOptions<boolean | number>;
37
- export?: ObjectMap<string | FunctionType>;
38
- }
39
-
40
- type OutputType = "useUnsafeReplace" | "productionRelease" | "productionIncremental" | "templateMap" | "userAgentData";
41
-
42
- export interface FormatUri extends Partial<LocationUri> {
43
- dictionary?: string;
44
- }
45
-
46
- export interface FinalizeProcessing<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> {
47
- readonly host: T;
48
- readonly startTime: LogTime;
49
- readonly hashed: Set<DocumentAsset>;
50
- readonly contentMap: StringMap;
51
- readonly bufferMap: ObjectMap<BufferContent>;
52
- readonly cacheMiss: string[];
53
- readonly productionRelease: Undef<true>;
54
- }
55
-
56
- export interface DocumentComponent<T = boolean> extends IDocumentComponent<T, T>, DocumentComponentExtended<T> {}
57
-
58
- export interface DocumentModule extends IDocumentModule {
59
- eval?: DocumentEval;
60
- format?: PlainObject & { uuid?: FormatUri };
61
- settings?: ChromeDocumentSettings;
62
- }
63
-
64
- export interface DocumentAsset extends IDocumentAsset, ChromeAsset {
65
- relativeUrl?: string;
66
- inlineFilename?: string;
67
- srcSet?: string[];
68
- inlineUrl?: string;
69
- inlineUrlMap?: StringMap;
70
- inlineUrlCloud?: string;
71
- inlineUrlCloudMap?: StringMap;
72
- inlineBase64?: string;
73
- modified?: boolean;
74
- }
75
-
76
- export interface UserConfig extends CssRuleData, Omit<DocumentOutput, OutputType> {
77
- useUnsafeHtmlReplace?: boolean;
78
- useUnsafeCssReplace?: boolean;
79
- }
80
-
81
- export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset, V extends ICloud = ICloud<T>> extends IDocument<T, U, DocumentModule, DocumentComponent, DocumentComponentOption, V>, Pick<DocumentOutput, OutputType> {
82
- htmlFile: Null<U>;
83
- cssFiles: U[];
84
- jsFiles: U[];
85
- svgFiles: U[];
86
- baseDirectory: string;
87
- baseUrl: string;
88
- config: UserConfig;
89
- related: Map<U, Set<U>>;
90
- replaced: U[];
91
- formatMap?: ObjectMap<FormatUri>;
92
- setElementSrc(asset: U, element: IXmlElement, value: string): void;
93
- findDataValue(name: string): Undef<string>;
94
- setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
95
- applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
96
- rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
97
- setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
98
- applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
99
- setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
100
- removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
101
- removeServerRoot(value: string): string;
102
- replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
103
- cloudInit(state: CloudScopeOrigin<T, U, V>): void;
104
- cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
105
- cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
106
- cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
107
- get settings(): ChromeDocumentSettings;
108
- get editing(): U[];
109
- get dataSource(): DataSource[];
110
- get elements(): XmlTagNode[];
111
- }
112
-
113
- export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
114
- INTERNAL_ASSIGNUUID: string;
115
- INTERNAL_SERVERROOT: string;
116
- readonly prototype: IChromeDocument<T, U>;
117
- new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
1
+ import type { LocationUri, XmlTagNode } from '@e-mc/types/lib/squared';
2
+
3
+ import type { DocumentConstructor, ICloud, IDocument, IFileManager } from '@e-mc/types/lib';
4
+ import type { DocumentAsset as IDocumentAsset } from '@e-mc/types/lib/document';
5
+ import type { LogTime } from '@e-mc/types/lib/logger';
6
+ import type { DbSourceDataType, DocumentComponentOption, DocumentComponent as IDocumentComponent, DocumentComponentOptions as IDocumentComponentOptions, DocumentDirectory as IDocumentDirectory, DocumentEval as IDocumentEval, DocumentModule as IDocumentModule, DocumentSettings as IDocumentSettings } from '@e-mc/types/lib/settings';
7
+
8
+ import type { CloudScopeOrigin } from '@e-mc/cloud/types';
9
+ import type { IDomWriter, IXmlElement } from '@e-mc/document/parse/types';
10
+
11
+ import type { ChromeAsset, CssRuleData, DataSource, DocumentOutput } from './squared';
12
+
13
+ interface DocumentDirectory extends IDocumentDirectory {
14
+ template?: string;
15
+ data?: string;
16
+ export?: string;
17
+ schema?: string;
18
+ sql?: string;
19
+ }
20
+
21
+ interface DocumentComponentExtended<T> extends DbSourceDataType<T> {
22
+ uri?: T;
23
+ local?: T;
24
+ export?: T;
25
+ }
26
+
27
+ interface DocumentComponentOptions<T> extends IDocumentComponentOptions, DocumentComponentExtended<DocumentComponentOption<T>> {}
28
+
29
+ interface DocumentEval extends IDocumentEval {
30
+ template?: boolean;
31
+ userconfig?: boolean;
32
+ }
33
+
34
+ interface ChromeDocumentSettings extends IDocumentSettings {
35
+ directory?: DocumentDirectory;
36
+ options?: DocumentComponentOptions<boolean | number>;
37
+ export?: ObjectMap<string | FunctionType>;
38
+ }
39
+
40
+ type OutputType = "useUnsafeReplace" | "productionRelease" | "productionIncremental" | "templateMap" | "userAgentData";
41
+
42
+ export interface FormatUri extends Partial<LocationUri> {
43
+ dictionary?: string;
44
+ }
45
+
46
+ export interface FinalizeProcessing<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> {
47
+ readonly host: T;
48
+ readonly startTime: LogTime;
49
+ readonly hashed: Set<DocumentAsset>;
50
+ readonly contentMap: StringMap;
51
+ readonly bufferMap: ObjectMap<BufferContent>;
52
+ readonly cacheMiss: string[];
53
+ readonly productionRelease: Undef<true>;
54
+ }
55
+
56
+ export interface DocumentComponent<T = boolean> extends IDocumentComponent<T, T>, DocumentComponentExtended<T> {}
57
+
58
+ export interface DocumentModule extends IDocumentModule {
59
+ eval?: DocumentEval;
60
+ format?: PlainObject & { uuid?: FormatUri };
61
+ settings?: ChromeDocumentSettings;
62
+ }
63
+
64
+ export interface DocumentAsset extends IDocumentAsset, ChromeAsset {
65
+ relativeUrl?: string;
66
+ inlineFilename?: string;
67
+ srcSet?: string[];
68
+ inlineUrl?: string;
69
+ inlineUrlMap?: StringMap;
70
+ inlineUrlCloud?: string;
71
+ inlineUrlCloudMap?: StringMap;
72
+ inlineBase64?: string;
73
+ modified?: boolean;
74
+ }
75
+
76
+ export interface UserConfig extends CssRuleData, Omit<DocumentOutput, OutputType> {
77
+ useUnsafeHtmlReplace?: boolean;
78
+ useUnsafeCssReplace?: boolean;
79
+ }
80
+
81
+ export interface IChromeDocument<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset, V extends ICloud = ICloud<T>> extends IDocument<T, U, DocumentModule, DocumentComponent, DocumentComponentOption, V>, Pick<DocumentOutput, OutputType> {
82
+ htmlFile: Null<U>;
83
+ cssFiles: U[];
84
+ jsFiles: U[];
85
+ svgFiles: U[];
86
+ baseDirectory: string;
87
+ baseUrl: string;
88
+ config: UserConfig;
89
+ related: Map<U, Set<U>>;
90
+ replaced: U[];
91
+ formatMap?: ObjectMap<FormatUri>;
92
+ setElementSrc(asset: U, element: IXmlElement, value: string): void;
93
+ findDataValue(name: string): Undef<string>;
94
+ setInlinedAttributes(processing: FinalizeProcessing<T, U>): void;
95
+ applyTransforms(processing: FinalizeProcessing<T, U>): Promise<void>;
96
+ rewriteHtml(processing: FinalizeProcessing<T, U>): Promise<void>;
97
+ setElementAttributes(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
98
+ applyDataSource(processing: FinalizeProcessing<T, U>, domBase: IDomWriter): Promise<void>;
99
+ setProductionAttributes(processing: FinalizeProcessing<T, U>): void;
100
+ removeUnusedStyles(source: string, options?: UserConfig): Undef<string>;
101
+ removeServerRoot(value: string): string;
102
+ replaceContent(source: string, match: RegExpExecArray | string, mimeType?: string): Undef<string>;
103
+ cloudInit(state: CloudScopeOrigin<T, U, V>): void;
104
+ cloudObject(state: CloudScopeOrigin<T, U, V>, file: U): boolean;
105
+ cloudUpload(state: CloudScopeOrigin<T, U, V>, file: U, url: string, active: boolean): Promise<boolean>;
106
+ cloudFinalize(state: CloudScopeOrigin<T, U, V>): Promise<unknown[]>;
107
+ get settings(): ChromeDocumentSettings;
108
+ get editing(): U[];
109
+ get dataSource(): DataSource[];
110
+ get elements(): XmlTagNode[];
111
+ }
112
+
113
+ export interface ChromeDocumentConstructor<T extends IFileManager<U>, U extends DocumentAsset = DocumentAsset> extends DocumentConstructor<T, U> {
114
+ INTERNAL_ASSIGNUUID: string;
115
+ INTERNAL_SERVERROOT: string;
116
+ readonly prototype: IChromeDocument<T, U>;
117
+ new(module?: DocumentModule, ...args: unknown[]): IChromeDocument<T, U>;
118
118
  }
@@ -1,114 +1,114 @@
1
- import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine, XmlTagNode } from '@e-mc/types/lib/squared';
2
-
3
- import type { UploadAction } from '@e-mc/types/lib/cloud';
4
- import type { CascadeAction, DbSource } from '@e-mc/types/lib/db';
5
- import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
6
-
7
- interface ImportFrom {
8
- placeholder: string;
9
- original: string;
10
- uri: string;
11
- type?: string;
12
- dynamic?: boolean;
13
- }
14
-
15
- interface DataObject extends CascadeAction {
16
- format?: string;
17
- options?: PlainObject;
18
- }
19
-
20
- export interface UserAgentData {
21
- platform: string;
22
- brand: string;
23
- browser: number;
24
- version: Null<number[]>;
25
- }
26
-
27
- export interface DocumentOutput {
28
- productionRelease?: boolean | string;
29
- productionIncremental?: boolean;
30
- useOriginalHtmlPage?: boolean | string;
31
- useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
32
- stripCommentsAndCDATA?: boolean | string;
33
- normalizeHtmlOutput?: boolean | string;
34
- escapeReservedCharacters?: boolean;
35
- ignoreServerCodeBlocks?: string[];
36
- webBundle?: {
37
- rootDirAlias?: string;
38
- baseUrl?: string;
39
- primaryUrl?: string;
40
- copyTo?: string;
41
- rewriteHtmlPage?: boolean | string;
42
- excludeHtmlPage?: boolean;
43
- excludeTransforms?: boolean;
44
- includeScopes?: string[];
45
- excludeScopes?: string[];
46
- };
47
- templateMap?: TemplateMap;
48
- userAgentData?: Partial<UserAgentData>;
49
- }
50
-
51
- export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
52
-
53
- export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
54
- preserve?: boolean;
55
- static?: boolean;
56
- editing?: boolean;
57
- inlineContent?: string;
58
- originAddress?: boolean;
59
- }
60
-
61
- export interface TemplateMap extends PlainObject {
62
- html?: ObjectMap<StringMap>;
63
- js?: ObjectMap<StringMap>;
64
- css?: ObjectMap<StringMap>;
65
- data?: StringMap;
66
- }
67
-
68
- export interface CssRuleData {
69
- usedVariables?: string[];
70
- usedFontFace?: string[];
71
- usedKeyframes?: string[];
72
- unusedStyles?: string[];
73
- unusedMedia?: string[];
74
- unusedContainer?: string[];
75
- unusedSupports?: string[];
76
- unusedAtRules?: UnusedAtRule[];
77
- }
78
-
79
- export interface UnusedAtRule {
80
- selector?: string;
81
- media?: ConditionProperty;
82
- supports?: ConditionProperty;
83
- container?: CssConditionData & Partial<ConditionProperty>;
84
- layer?: string[];
85
- }
86
-
87
- export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
88
- source: "cloud" | "uri" | "local" | "export" | DbSource;
89
- element?: XmlTagNode;
90
- type?: "text" | "attribute" | "display";
91
- dynamic?: boolean;
92
- value?: StringOfArray | ObjectMap<unknown>;
93
- template?: string;
94
- viewEngine?: ViewEngine | string;
95
- ignoreEmpty?: boolean;
96
- }
97
-
98
- export interface UriDataSource extends DataSource, DataObject {
99
- source: "uri";
100
- }
101
-
102
- export interface LocalDataSource extends DataSource, DataObject {
103
- source: "local";
104
- pathname?: string;
105
- }
106
-
107
- export interface ExportDataSource extends DataSource, CascadeAction {
108
- source: "export";
109
- execute?: FunctionType;
110
- pathname?: string;
111
- settings?: string;
112
- params?: unknown;
113
- persist?: boolean;
1
+ import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine, XmlTagNode } from '@e-mc/types/lib/squared';
2
+
3
+ import type { UploadAction } from '@e-mc/types/lib/cloud';
4
+ import type { CascadeAction, DbSource } from '@e-mc/types/lib/db';
5
+ import type { RequestData as IRequestData } from '@e-mc/types/lib/node';
6
+
7
+ interface ImportFrom {
8
+ placeholder: string;
9
+ original: string;
10
+ uri: string;
11
+ type?: string;
12
+ dynamic?: boolean;
13
+ }
14
+
15
+ interface DataObject extends CascadeAction {
16
+ format?: string;
17
+ options?: PlainObject;
18
+ }
19
+
20
+ export interface UserAgentData {
21
+ platform: string;
22
+ brand: string;
23
+ browser: number;
24
+ version: Null<number[]>;
25
+ }
26
+
27
+ export interface DocumentOutput {
28
+ productionRelease?: boolean | string;
29
+ productionIncremental?: boolean;
30
+ useOriginalHtmlPage?: boolean | string;
31
+ useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
32
+ stripCommentsAndCDATA?: boolean | string;
33
+ normalizeHtmlOutput?: boolean | string;
34
+ escapeReservedCharacters?: boolean;
35
+ ignoreServerCodeBlocks?: string[];
36
+ webBundle?: {
37
+ rootDirAlias?: string;
38
+ baseUrl?: string;
39
+ primaryUrl?: string;
40
+ copyTo?: string;
41
+ rewriteHtmlPage?: boolean | string;
42
+ excludeHtmlPage?: boolean;
43
+ excludeTransforms?: boolean;
44
+ includeScopes?: string[];
45
+ excludeScopes?: string[];
46
+ };
47
+ templateMap?: TemplateMap;
48
+ userAgentData?: Partial<UserAgentData>;
49
+ }
50
+
51
+ export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
52
+
53
+ export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
54
+ preserve?: boolean;
55
+ static?: boolean;
56
+ editing?: boolean;
57
+ inlineContent?: string;
58
+ originAddress?: boolean;
59
+ }
60
+
61
+ export interface TemplateMap extends PlainObject {
62
+ html?: ObjectMap<StringMap>;
63
+ js?: ObjectMap<StringMap>;
64
+ css?: ObjectMap<StringMap>;
65
+ data?: StringMap;
66
+ }
67
+
68
+ export interface CssRuleData {
69
+ usedVariables?: string[];
70
+ usedFontFace?: string[];
71
+ usedKeyframes?: string[];
72
+ unusedStyles?: string[];
73
+ unusedMedia?: string[];
74
+ unusedContainer?: string[];
75
+ unusedSupports?: string[];
76
+ unusedAtRules?: UnusedAtRule[];
77
+ }
78
+
79
+ export interface UnusedAtRule {
80
+ selector?: string;
81
+ media?: ConditionProperty;
82
+ supports?: ConditionProperty;
83
+ container?: CssConditionData & Partial<ConditionProperty>;
84
+ layer?: string[];
85
+ }
86
+
87
+ export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
88
+ source: "cloud" | "uri" | "local" | "export" | DbSource;
89
+ element?: XmlTagNode;
90
+ type?: "text" | "attribute" | "display";
91
+ dynamic?: boolean;
92
+ value?: StringOfArray | ObjectMap<unknown>;
93
+ template?: string;
94
+ viewEngine?: ViewEngine | string;
95
+ ignoreEmpty?: boolean;
96
+ }
97
+
98
+ export interface UriDataSource extends DataSource, DataObject {
99
+ source: "uri";
100
+ }
101
+
102
+ export interface LocalDataSource extends DataSource, DataObject {
103
+ source: "local";
104
+ pathname?: string;
105
+ }
106
+
107
+ export interface ExportDataSource extends DataSource, CascadeAction {
108
+ source: "export";
109
+ execute?: FunctionType;
110
+ pathname?: string;
111
+ settings?: string;
112
+ params?: unknown;
113
+ persist?: boolean;
114
114
  }