Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump eslint from 9.19.0 to 9.20.0 #386

Open
wants to merge 2 commits into
base: 4.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/configuration/default-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default {
engine: {
render: null,
},
extensions: [],
files: {
css: {
name: "index",
Expand Down
5 changes: 0 additions & 5 deletions docs/configuration/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ The render function for your templates. The function will be called with an obje
}
```

## `extensions`

default: `[]`<br>
type: `array`

## `projectName`

default: `"miyagi"`<br>
Expand Down
2 changes: 0 additions & 2 deletions lib/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export default {
},
engine: {
render: null,
options: {},
},
extensions: [],
files: {
css: {
abbr: "css",
Expand Down
23 changes: 1 addition & 22 deletions lib/init/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ async function updateFileContents(events) {
*
*/
async function handleFileChange() {
for (const extension of global.config.extensions) {
const ext = Array.isArray(extension) ? extension[0] : extension;
const opts =
Array.isArray(extension) && extension[1] ? extension[1] : { locales: {} };

if (ext.callbacks?.fileChanged) {
await ext.callbacks.fileChanged(opts);
}
}

// a directory has been changed
if (
triggeredEvents.some(
Expand Down Expand Up @@ -290,7 +280,7 @@ export default function Watcher(server) {
});
});

const { components, docs, assets, extensions } = global.config;
const { components, docs, assets } = global.config;

const foldersToWatch = [
...assets.folder.map((f) => path.join(global.config.assets.root, f)),
Expand Down Expand Up @@ -321,17 +311,6 @@ export default function Watcher(server) {
foldersToWatch.push(docs.folder);
}

for (const extension of extensions) {
const ext = Array.isArray(extension) ? extension[0] : extension;
const opts =
Array.isArray(extension) && extension[1] ? extension[1] : { locales: {} };

if (ext.extendWatcher) {
const watch = ext.extendWatcher(opts);
foldersToWatch.push(path.join(watch.folder, watch.lang));
}
}

if (global.config.userFileName) {
fs.watch(global.config.userFileName, async (eventType) => {
if (eventType === "change") {
Expand Down
8 changes: 1 addition & 7 deletions lib/mocks/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import deepMerge from "deepmerge";
import * as helpers from "../helpers.js";
import { resolveRefs } from "./resolve/ref.js";
import { resolveTpls } from "./resolve/tpl.js";
import { extendTemplateData } from "../render/helpers.js";

/**
* @param {string} method
Expand Down Expand Up @@ -56,12 +55,7 @@ export const resolveData = async function (data, component, rootData) {
);
const { data: tplsResolved, messages: tplMessages } =
await resolveTpls(refsResolved);
const renderKeyResolved = overwriteRenderKey(tplsResolved);
const resolved = await extendTemplateData(
global.config,
renderKeyResolved,
component,
);
const resolved = overwriteRenderKey(tplsResolved);

return {
merged: mergedWithGlobalData,
Expand Down
3 changes: 0 additions & 3 deletions lib/mocks/resolve/tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import path from "path";

import * as helpers from "../../helpers.js";
import { t } from "../../i18n/index.js";
import { extendTemplateData } from "../../render/helpers.js";
import { overwriteRenderKey } from "../resolve.js";

/**
Expand Down Expand Up @@ -198,8 +197,6 @@ async function render(entry) {
try {
fs.statSync(component.paths.tpl.full);

data = await extendTemplateData(global.config, data, component);

return new Promise((resolve1) => {
global.app.render(component.paths.tpl.full, data ?? {}, (err, html) => {
if (err) {
Expand Down
26 changes: 0 additions & 26 deletions lib/render/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@
* @module renderHelpers
*/

import path from "path";

/**
* @param {object} config - the user configuration object
* @param {object} data - the mock data object that will be passed into the component
* @param {object} component
* @returns {Promise<object>} the extended data object
*/
export const extendTemplateData = async (config, data, component) => {
for (const extension of config.extensions) {
if (extension) {
const ext = Array.isArray(extension) ? extension[0] : extension;

if (ext.extendTemplateData) {
data = await ext.extendTemplateData(
path.join(config.components.folder, component.paths.tpl.short),
{},
data,
);
}
}
}

return data;
};

export const getUserUiConfig = (cookies = {}) => {
const projectName = global.config.projectName.replaceAll(" ", "-");
const mode = cookies[`miyagi_${projectName}_mode`];
Expand Down
31 changes: 23 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.