@aurodesignsystem/auro-library 5.14.1 → 5.14.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/CHANGELOG.md +7 -0
- package/bin/generateDocs.mjs +4 -210
- package/bin/generateDocs_index.mjs +4 -210
- package/dist/_chunks/chunk-2MOEVVSZ.mjs +308 -0
- package/dist/_chunks/chunk-H7YO7ERJ.mjs +69 -0
- package/dist/_chunks/chunk-JLCAYVRX.mjs +84 -0
- package/dist/_chunks/chunk-RKBXVLA5.mjs +5983 -0
- package/dist/_chunks/chunk-TDFKN2EP.mjs +38 -0
- package/dist/_chunks/chunk-UY4SIQT6.mjs +201 -0
- package/dist/_chunks/chunk-V7YBXHAI.mjs +32379 -0
- package/dist/bin/generateDocs.mjs +152 -0
- package/dist/bin/generateDocs_index.mjs +152 -0
- package/dist/build/generateDocs.mjs +18 -0
- package/dist/build/generateReadme.mjs +49 -0
- package/dist/build/generateWcaComponent.mjs +6657 -0
- package/dist/build/processors/defaultDocsProcessor.mjs +16 -0
- package/dist/build/processors/defaultDotGithubSync.mjs +12 -0
- package/dist/build/syncGithubFiles.mjs +18 -0
- package/dist/utils/auroTemplateFiller.mjs +8 -0
- package/dist/utils/sharedFileProcessorUtils.mjs +31 -0
- package/package.json +10 -5
- package/scripts/build/generateDocs.mjs +4 -24
- package/scripts/build/generateReadme.mjs +4 -60
- package/scripts/build/generateWcaComponent.mjs +4 -43
- package/scripts/build/postinstall.mjs +10 -10
- package/scripts/build/pre-commit.mjs +13 -7
- package/scripts/build/processors/defaultDocsProcessor.mjs +4 -83
- package/scripts/build/processors/defaultDotGithubSync.mjs +4 -83
- package/scripts/build/syncGithubFiles.mjs +4 -25
- package/scripts/utils/ansiColors.mjs +119 -0
- package/scripts/utils/auroLibraryUtils.mjs +87 -51
- package/scripts/utils/auroTemplateFiller.mjs +4 -178
- package/scripts/utils/logger.mjs +27 -16
- package/scripts/utils/sharedFileProcessorUtils.mjs +4 -270
- package/scripts/build/deprecatedProseToFieldPlugin.spec.js +0 -188
- package/scripts/runtime/ClickTracker/test/ClickTracker.test.js +0 -424
- package/scripts/runtime/FocusTrap/test/FocusTrap.test.js +0 -168
- package/scripts/runtime/Focusables/test/Focusables.test.js +0 -185
- package/scripts/runtime/dateUtilities/dateFormatter.test.js +0 -284
- package/scripts/runtime/dateUtilities/dateUtilities.test.js +0 -80
- package/scripts/runtime/floatingUI/test/floatingUI.test.js +0 -189
- package/scripts/runtime/floatingUI.test.js +0 -478
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
__require,
|
|
36
|
+
__commonJS,
|
|
37
|
+
__toESM
|
|
38
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import{createRequire as __auroCreateRequire}from'node:module';const require=__auroCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
AuroTemplateFiller
|
|
4
|
+
} from "./chunk-RKBXVLA5.mjs";
|
|
5
|
+
import {
|
|
6
|
+
AuroLibraryUtils,
|
|
7
|
+
Logger
|
|
8
|
+
} from "./chunk-2MOEVVSZ.mjs";
|
|
9
|
+
import {
|
|
10
|
+
require_markdown_magic
|
|
11
|
+
} from "./chunk-V7YBXHAI.mjs";
|
|
12
|
+
import {
|
|
13
|
+
__toESM
|
|
14
|
+
} from "./chunk-TDFKN2EP.mjs";
|
|
15
|
+
|
|
16
|
+
// src/utils/sharedFileProcessorUtils.mjs
|
|
17
|
+
var mdMagic = __toESM(require_markdown_magic(), 1);
|
|
18
|
+
import fs2 from "node:fs/promises";
|
|
19
|
+
import path2 from "node:path";
|
|
20
|
+
|
|
21
|
+
// scripts/utils/auroFileHandler.mjs
|
|
22
|
+
import fs from "node:fs/promises";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
var AuroFileHandler = class {
|
|
25
|
+
/**
|
|
26
|
+
* Check if a file exists.
|
|
27
|
+
* @param {string} filePath - The file path to check.
|
|
28
|
+
* @returns {Promise<boolean>}
|
|
29
|
+
*/
|
|
30
|
+
static async exists(filePath) {
|
|
31
|
+
try {
|
|
32
|
+
await fs.access(filePath);
|
|
33
|
+
return true;
|
|
34
|
+
} catch (_err) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Try to read a file and return its contents.
|
|
40
|
+
* @param {string} filePath - The file path to read.
|
|
41
|
+
* @returns {Promise<null|string>}
|
|
42
|
+
*/
|
|
43
|
+
static async tryReadFile(filePath) {
|
|
44
|
+
try {
|
|
45
|
+
return await fs.readFile(filePath, { encoding: "utf-8" });
|
|
46
|
+
} catch (err) {
|
|
47
|
+
Logger.error(`Error reading file: ${filePath}, ${err.message}`);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Try to write a file with the given contents.
|
|
53
|
+
* @param {string} filePath - The file path to write to.
|
|
54
|
+
* @param {string} fileContents - The contents to write to the file.
|
|
55
|
+
* @returns {Promise<boolean>}
|
|
56
|
+
*/
|
|
57
|
+
static async tryWriteFile(filePath, fileContents) {
|
|
58
|
+
try {
|
|
59
|
+
const dirname = path.dirname(filePath);
|
|
60
|
+
await fs.mkdir(dirname, { recursive: true });
|
|
61
|
+
await fs.writeFile(filePath, fileContents, { encoding: "utf-8" });
|
|
62
|
+
return true;
|
|
63
|
+
} catch (err) {
|
|
64
|
+
Logger.error(`Error writing file: ${filePath}, ${err.message}`);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Try to copy a file from one location to another.
|
|
70
|
+
* @param {string} source - The source file path.
|
|
71
|
+
* @param {string} destination - The destination file path.
|
|
72
|
+
* @returns {Promise<boolean>}
|
|
73
|
+
*/
|
|
74
|
+
static async tryCopyFile(source, destination) {
|
|
75
|
+
try {
|
|
76
|
+
await fs.copyFile(source, destination);
|
|
77
|
+
return true;
|
|
78
|
+
} catch (err) {
|
|
79
|
+
Logger.error(`Error copying file: ${source}, ${err.message}`);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/utils/sharedFileProcessorUtils.mjs
|
|
86
|
+
var applyMarkdownMagic = mdMagic.default;
|
|
87
|
+
var MD_MAGIC_CONFIG = {
|
|
88
|
+
matchWord: "AURO-GENERATED-CONTENT",
|
|
89
|
+
output: {
|
|
90
|
+
directory: "./",
|
|
91
|
+
applyTransformsToSource: true
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var auroLibraryUtils = new AuroLibraryUtils();
|
|
95
|
+
var templateFiller = new AuroTemplateFiller();
|
|
96
|
+
var nonEsmComponents = [
|
|
97
|
+
"combobox",
|
|
98
|
+
"datepicker",
|
|
99
|
+
"menu",
|
|
100
|
+
"pane",
|
|
101
|
+
"select"
|
|
102
|
+
];
|
|
103
|
+
function fromAuroComponentRoot(pathLike) {
|
|
104
|
+
if (pathLike.startsWith("/")) {
|
|
105
|
+
return path2.join(auroLibraryUtils.getProjectRootPath, pathLike.slice(1));
|
|
106
|
+
}
|
|
107
|
+
return path2.join(auroLibraryUtils.getProjectRootPath, pathLike);
|
|
108
|
+
}
|
|
109
|
+
function generateWCGeneratorUrl(branchOrTag, fileNameWithPath) {
|
|
110
|
+
const baseRepoUrl = "https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator";
|
|
111
|
+
const isTag = branchOrTag.startsWith("v") && /^\d+\.\d+\.\d+(-.*)?$/.test(branchOrTag.slice(1));
|
|
112
|
+
if (isTag) {
|
|
113
|
+
return `${baseRepoUrl}/refs/tags/${branchOrTag}/${fileNameWithPath}`;
|
|
114
|
+
}
|
|
115
|
+
if (branchOrTag !== "master") {
|
|
116
|
+
return `${baseRepoUrl}/refs/heads/${branchOrTag}/${fileNameWithPath}`;
|
|
117
|
+
}
|
|
118
|
+
return `${baseRepoUrl}/master/${fileNameWithPath}`;
|
|
119
|
+
}
|
|
120
|
+
function generateReadmeUrl(branchOrTag = "master", variantOverride = "") {
|
|
121
|
+
const nameExtractionData = templateFiller.values;
|
|
122
|
+
let variantString = "";
|
|
123
|
+
if (!nonEsmComponents.includes(nameExtractionData.name)) {
|
|
124
|
+
variantString = "_esm";
|
|
125
|
+
}
|
|
126
|
+
if (variantOverride !== "") {
|
|
127
|
+
variantString = variantOverride;
|
|
128
|
+
}
|
|
129
|
+
return generateWCGeneratorUrl(
|
|
130
|
+
branchOrTag,
|
|
131
|
+
`componentDocs/README${variantString}.md`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
async function retrieveRemoteFileCopy(input) {
|
|
135
|
+
const bareFileName = input.fileName;
|
|
136
|
+
Logger.log(`Retrieving latest "${bareFileName}" file...`);
|
|
137
|
+
const contents = await fetch(input.remoteUrl, {
|
|
138
|
+
redirect: "follow"
|
|
139
|
+
}).then((r) => r.text());
|
|
140
|
+
await AuroFileHandler.tryWriteFile(input.fileName, contents);
|
|
141
|
+
}
|
|
142
|
+
async function runMarkdownMagicOnFile(input, output, extraMdMagicConfig = {}) {
|
|
143
|
+
await applyMarkdownMagic(output, {
|
|
144
|
+
...MD_MAGIC_CONFIG,
|
|
145
|
+
...extraMdMagicConfig
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async function optionallyCopyFile(input, output, overwrite = true) {
|
|
149
|
+
if (await AuroFileHandler.exists(output) && !overwrite) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (!await AuroFileHandler.tryCopyFile(input, output)) {
|
|
153
|
+
throw new Error(`Error copying "${input}" file to output ${output}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function processContentForFile(config) {
|
|
157
|
+
const { input: rawInput, output, mdMagicConfig, extraVars = {} } = config;
|
|
158
|
+
const derivedInputPath = typeof rawInput === "string" ? rawInput : rawInput.fileName;
|
|
159
|
+
const segments = derivedInputPath.split("/");
|
|
160
|
+
const bareFileName = segments[segments.length - 1];
|
|
161
|
+
if (typeof rawInput === "object") {
|
|
162
|
+
await retrieveRemoteFileCopy(rawInput);
|
|
163
|
+
}
|
|
164
|
+
await optionallyCopyFile(
|
|
165
|
+
derivedInputPath,
|
|
166
|
+
output,
|
|
167
|
+
rawInput.overwrite ?? true
|
|
168
|
+
);
|
|
169
|
+
if (output.endsWith(".md")) {
|
|
170
|
+
await runMarkdownMagicOnFile(derivedInputPath, output, mdMagicConfig);
|
|
171
|
+
}
|
|
172
|
+
let fileContents = await fs2.readFile(output, { encoding: "utf-8" });
|
|
173
|
+
if (config.preProcessors) {
|
|
174
|
+
for (const processor of config.preProcessors) {
|
|
175
|
+
fileContents = processor(fileContents);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
fileContents = templateFiller.replaceTemplateValues(fileContents, extraVars);
|
|
179
|
+
if (config.postProcessors) {
|
|
180
|
+
for (const processor of config.postProcessors) {
|
|
181
|
+
fileContents = processor(fileContents);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (!await AuroFileHandler.tryWriteFile(output, fileContents)) {
|
|
185
|
+
throw new Error(`Error writing "${bareFileName}" file to output ${output}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
MD_MAGIC_CONFIG,
|
|
191
|
+
auroLibraryUtils,
|
|
192
|
+
templateFiller,
|
|
193
|
+
nonEsmComponents,
|
|
194
|
+
fromAuroComponentRoot,
|
|
195
|
+
generateWCGeneratorUrl,
|
|
196
|
+
generateReadmeUrl,
|
|
197
|
+
retrieveRemoteFileCopy,
|
|
198
|
+
runMarkdownMagicOnFile,
|
|
199
|
+
optionallyCopyFile,
|
|
200
|
+
processContentForFile
|
|
201
|
+
};
|