Lei OT 4 months ago
parent 524b1e4770
commit 488811502c

@ -20,22 +20,17 @@ srcItems.forEach((item) => {
}
}
});
// console.log('🍕🍕🍕', utilsFiles);
// console.log('🍕🍕', hasIndexFiles);
const indexEntries = [];
hasIndexFiles.forEach(subDir => {
indexEntries.push(...generateEntries(['index.js'], subDir));
});
// src/index.js
indexEntries.push(...generateEntries(['index.js']));
// console.log('🍕', indexEntries);
// return;
function generateEntries(files, parentDir) {
// Create entries with both ESM and CJS outputs
const _Entries = files.flatMap((file) => {
const moduleName = path.basename(file, '.js');
// console.log('🍕', file, moduleName);
return [
// ESM output

@ -654,9 +654,9 @@ export const getNestedValue = (obj, keyArr) => {
/**
* 计算笛卡尔积
* @param {object[]} arr
* @param {string} sep '_'
* @param {number} index 0
* @param {string} prefix ''
* @param {string} [sep='_']
* @param {number} [index=0]
* @param {string} [prefix='']
*/
export const cartesianProductArray = (arr, sep = '_', index = 0, prefix = '') => {
let result = [];
@ -669,6 +669,11 @@ export const cartesianProductArray = (arr, sep = '_', index = 0, prefix = '') =>
return result;
};
/**
* @param {string} [str='']
* @param {boolean} [withFlag=true]
* @returns {string}
*/
export const stringToColour = (str = '', withFlag = true) => {
var hash = 0;
if (str.length === 0) return hash;
@ -812,6 +817,9 @@ export const clearAllCaches = async (cb) => {
}
};
/**
* 动态载入JS
*/
export const loadScript = (src) => {
return new Promise((resolve, reject) => {
const script = document.createElement('script');

@ -158,8 +158,7 @@ export function postStream(url, obj) {
}
export function delJSON(url, obj) {
const host = /^https?:\/\//i.test(url) ? '': HT_HOST;
return fetch(`${host}${url}`, {
return fetch(`${url}`, {
method: 'DELETE',
body: JSON.stringify(obj),
headers: {

Loading…
Cancel
Save