Skip to content
Merged
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
4 changes: 3 additions & 1 deletion packages/assemble-lite/helper/io-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const asyncGlob = async (globPattern) => {
return [];
}

const files = await glob(globPattern, {});
// consumers (e.g. pv-stylemark) build absolute patterns via path.resolve, which uses
// backslashes on windows — since glob v9 those count as escape characters and match nothing
const files = await glob(globPattern, { windowsPathsNoEscape: true });

// sort to keep partial/page/data registration order deterministic
// make sure to use absolute paths and that platform separator is used
Expand Down
8 changes: 5 additions & 3 deletions packages/pv-stylemark/tasks/lsg/getLsgData.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { resolve, parse: pathParse, normalize, relative: relPath, join } = requir
const { marked } = require("marked");
const frontmatter = require("front-matter");
const { glob } = require("glob");
const slash = require("slash");

const { resolveApp, getAppConfig } = require("../../helper/paths");

Expand Down Expand Up @@ -113,8 +114,9 @@ const getLsgDataForPath = async (markdownPath) => {

const { name, dir } = pathParse(markdownPath);
const componentsSrc = resolveApp(getAppConfig().componentsSrc);
const componentPath = relPath(componentsSrc, dir);
const srcPath = relPath(componentsSrc, markdownPath);
// forward slashes even on windows — these end up in urls and rendered markup
const componentPath = slash(relPath(componentsSrc, dir));
const srcPath = slash(relPath(componentsSrc, markdownPath));

const { attributes: frontmatterData, body: fileContentBody } = frontmatter(fileContent);

Expand Down Expand Up @@ -241,7 +243,7 @@ function cleanMarkdownFromExecutableCodeBlocks(markdownContent, name, componentP
if (groups.language === "html") {
// html file will be generated for html code blocks without a referenced file
const examplePath = groups.examplePath ? groups.examplePath : `${groups.exampleName}.html`;
const markupUrl = join("../components", componentPath, examplePath);
const markupUrl = slash(join("../components", componentPath, examplePath));
replacement += `<dds-example name="${groups.exampleName}" path="${name}-${groups.exampleName}.html${groups.search ?? ""}${groups.hash ?? ""}" ${groups.examplePath && !groups.params.hidden ? `markup-url="${markupUrl}"`: ""}></dds-example>`
}
if (groups.content && !groups.params.hidden) {
Expand Down
5 changes: 3 additions & 2 deletions packages/pv-stylemark/webpack-plugin/getFilesToWatch.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const { asyncGlob } = require("@pro-vision/assemble-lite/helper/io-helper");

const { getAppConfig, join } = require("../helper/paths");
const { getAppConfig, join, resolveApp } = require("../helper/paths");

const { componentsSrc, cdPagesSrc, cdTemplatesSrc, lsgIndex, hbsHelperSrc } = getAppConfig();

const getFilesToWatch = async () => {
const files = {
staticStylemarkFiles: [
lsgIndex,
// absolute native path, comparable to webpack's modifiedFiles / fileDependencies
resolveApp(lsgIndex),
// stylemark .md files
...(await asyncGlob(join(componentsSrc, "**/*.md"))),
],
Expand Down
Loading