Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 17, 2024
2 parents 45cc788 + 94a1c25 commit 6856848
Show file tree
Hide file tree
Showing 41 changed files with 4,574 additions and 5,166 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/mdsvex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: mdsvex

on:
push:
branches:
- main
paths-ignore:
- 'site/**'
pull_request:
branches:
- main
paths-ignore:
- 'site/**'

Expand Down Expand Up @@ -43,7 +47,7 @@ jobs:
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm i --frozen-lockfile
- run: pnpm test
- run: pnpm test:run
- run: pnpm -r build
env:
CI: true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/npm-previews.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: npm-previews

on:
pull_request:
branches:
- main
paths-ignore:
- 'site/**'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
branches:
- master
- main

jobs:
release:
Expand Down
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"version": "0.8.5",
"description": "Markdown preprocessor for Svelte",
"repository": "https://github.com/pngwn/MDsveX",
"type": "module",
"scripts": {
"lint": "prettier --check .",
"format": "prettier --write .",
"test": "pnpm -r --filter=!site test",
"test:filter": "uvu -r ts-node/register",
"test:run": "vitest run . **/*.spec.ts ",
"release": "pnpm -r build && changeset publish",
"changeset:add": "changeset add",
"changeset:version": "changeset version && pnpm i --lockfile-only",
Expand All @@ -26,19 +27,23 @@
"devDependencies": {
"@changesets/changelog-github": "^0.4.0",
"@changesets/cli": "^2.16.0",
"@rollup/plugin-typescript": "^8.2.1",
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^14.14.44",
"esm": "^3.2.25",
"prettier": "^2.2.1",
"rollup": "^2.77.4-1",
"rollup-plugin-dts": "^3.0.1",
"ts-node": "^9.1.1",
"rollup": "^4.20.0",
"rollup-plugin-dts": "^6.1.1",
"typescript": "^4.2.4",
"uvu": "^0.5.1",
"watchlist": "^0.2.3"
},
"dependencies": {
"tslib": "^2.3.1"
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-sucrase": "^5.0.2",
"rollup-plugin-node-globals": "^1.4.0",
"tslib": "^2.3.1",
"vitest": "^2.0.5"
},
"engines": {
"pnpm": "^9.1.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/mdsvex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# mdsvex

## 0.12.3

### Patch Changes

- [#637](https://github.com/pngwn/MDsveX/pull/637) [`9e8165f`](https://github.com/pngwn/MDsveX/commit/9e8165f981f52ef0b05cbb93335a7ac664d9e50c) Thanks [@pngwn](https://github.com/pngwn)! - fix layout path resolution

## 0.12.2

### Patch Changes
Expand Down
15 changes: 5 additions & 10 deletions packages/mdsvex/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "mdsvex",
"version": "0.12.2",
"version": "0.12.3",
"description": "Markdown preprocessor for Svelte",
"type": "module",
"exports": {
".": {
"require": "./dist/main.cjs",
"default": "./dist/main.mjs"
}
},
"./package.json": "./package.json"
},
"main": "dist/main.cjs",
"module": "dist/main.mjs",
"repository": "https://github.com/pngwn/MDsveX",
"scripts": {
"build": "rollup -c",
"test": "uvu -r ts-node/register test test.ts$"
"test": "vitest . **/*.spec.ts"
},
"files": [
"dist/*",
Expand All @@ -29,10 +31,6 @@
"author": "pngwn <[email protected]>",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^2.4.2",
"@rollup/plugin-sucrase": "^5.0.2",
"@starptech/prettyhtml-hast-to-html": "^0.10.0",
"@types/acorn": "^4.0.5",
"@types/escape-html": "^1.0.0",
Expand All @@ -54,9 +52,6 @@
"remark-slug": "^6.0.0",
"retext": "^7.0.1",
"retext-smartypants": "^4.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-svelte": "^5.1.1",
"shiki": "^0.9.3",
"svelte": "^4.0.0",
Expand Down
13 changes: 6 additions & 7 deletions packages/mdsvex/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import resolve from '@rollup/plugin-node-resolve';
import node from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from 'rollup-plugin-json';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import json from '@rollup/plugin-json';
import sucrase from '@rollup/plugin-sucrase';
import dts from 'rollup-plugin-dts';
import replace from '@rollup/plugin-replace';
import { readFileSync } from 'fs';
import { resolve } from 'path';

import pkg from './package.json';
const pkg = JSON.parse(readFileSync(resolve('package.json'), 'utf-8'));

export default [
{
plugins: [
resolve({ preferBuiltins: true }),
node({ preferBuiltins: true }),
commonjs({ namedExports: { 'svelte/compiler': ['parse'] } }),
json(),
sucrase({ transforms: ['typescript'] }),
Expand Down
7 changes: 5 additions & 2 deletions packages/mdsvex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import extract_frontmatter from 'remark-frontmatter';
import remark2rehype from 'remark-rehype';
//@ts-ignore
import hast_to_html from '@starptech/prettyhtml-hast-to-html';
import { createRequire } from 'module';

import { mdsvex_parser } from './parsers';
import {
Expand Down Expand Up @@ -126,13 +127,15 @@ function to_posix(_path: string): string {
return _path.replace(/\\/g, '/');
}

const _require = import.meta.url ? createRequire(import.meta.url) : require;

function resolve_layout(layout_path: string): string {
try {
return to_posix(require.resolve(layout_path));
return to_posix(_require.resolve(layout_path));
} catch (e) {
try {
const _path = join(process.cwd(), layout_path);
return to_posix(require.resolve(_path));
return to_posix(_require.resolve(_path));
} catch (e) {
throw new Error(
`The layout path you provided couldn't be found at either ${layout_path} or ${join(
Expand Down
Loading

0 comments on commit 6856848

Please sign in to comment.