yozorajs / yozora Goto Github PK
View Code? Open in Web Editor NEWA customizable markup parser for resolving markdown-like syntax strings into AST and vice versa.
Home Page: https://yozora.guanghechen.com
License: MIT License
A customizable markup parser for resolving markdown-like syntax strings into AST and vice versa.
Home Page: https://yozora.guanghechen.com
License: MIT License
When you try and use the DefaultParser
from @yozora/core-parser
using the cjs lib you get the following error:
TypeError: invariant is not a function
at consumeNewOpener (https://cigod8.csb.app/node_modules/@yozora/core-parser/lib/cjs/index.cjs:143:13)
at Object.consume (https://cigod8.csb.app/node_modules/@yozora/core-parser/lib/cjs/index.cjs:303:13)
at matchBlockTokens (https://cigod8.csb.app/node_modules/@yozora/core-parser/lib/cjs/index.cjs:793:27)
at Object.process (https://cigod8.csb.app/node_modules/@yozora/core-parser/lib/cjs/index.cjs:736:32)
at CustomParser.parse (https://cigod8.csb.app/node_modules/@yozora/core-parser/lib/cjs/index.cjs:975:32)
at Object.eval (https://cigod8.csb.app/src/CustomParser.test.ts:15:25)
at https://codesandbox.io/static/js/3.09a963795.chunk.js:1:338381
at new Promise (<anonymous>)
at t.callAsyncFn (https://codesandbox.io/static/js/3.09a963795.chunk.js:1:338040)
at https://codesandbox.io/static/js/7.916d1bd34.chunk.js:1:6522
at c (https://codesandbox.io/static/js/vendors~app~embed~sandbox~sandbox-startup.7424373eb.chunk.js:1:4328)
Here is a code sandbox for the problem:
https://codesandbox.io/s/delicate-haze-cigod8?file=/index.html
The @yozora/invariant/lib/cjs/index.cjs
looks like:
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
...
function invariant(condition, message) {
...
}
exports.default = invariant;
exports.invariant = invariant;
which comes from https://github.com/yozorajs/yozora/blob/main/packages/invariant/src/index.ts
export function invariant(
condition: boolean,
message?: string | (() => string),
): asserts condition {
...
}
export default invariant
The problem occurs when @yozora/core-parse/lib/cjs/index.cjs
requires the @yozora/invariant'
, expecting the default to be the invariant
function.
var invariant = require('@yozora/invariant');
But for this to work it would need to use the default:
var invariant = require('@yozora/invariant').default;
I am no rollup expert but I think it may be something to do with this issue: rollup/rollup#1961
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.