@teambit/mdx 1.0.874 → 1.0.876
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/env-template/public/{130.fd2769bf3230b204a5d1.js → 629.6e1344854ebb0dc9a817.js} +1 -1
- package/artifacts/env-template/public/assets-manifest.json +10 -10
- package/artifacts/env-template/public/{compositions.1f1662f01dc47c734ec4.js → compositions.7c04be07295c45d68e98.js} +3 -3
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/{overview.cd022798b093abc0ccce.js → overview.80127976ee4371c7a43a.js} +2 -2
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/{peers.db51ccd720b54e8a8193.js → peers.1c64d2466352485e8b48.js} +1 -1
- package/artifacts/env-template/public/{preview-root.17e7740f9d736e233ce9.js → preview-root.c52feb4ab7319fbdd9c7.js} +1 -1
- package/{compositions-1769631668167.js → compositions-1770309303647.js} +1 -1
- package/dist/mdx.detector.d.ts +12 -1
- package/dist/mdx.detector.js +108 -9
- package/dist/mdx.detector.js.map +1 -1
- package/dist/mdx.detector.spec.js +246 -28
- package/dist/mdx.detector.spec.js.map +1 -1
- package/dist/mdx.main.runtime.js +1 -1
- package/dist/mdx.main.runtime.js.map +1 -1
- package/dist/{preview-1769631668167.js → preview-1770309303647.js} +2 -2
- package/{overview-1769631668167.js → overview-1770309303647.js} +1 -1
- package/package.json +15 -15
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[542],{
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(r,a){if(r){if(typeof r=="string")return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(a==null||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,l){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,l===0){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r2){o=!0,n=r2}finally{try{if(!f&&t.return!=null&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function __bitNormalizeId(id){return id?String(id).trim().replace(/^\/+|\/+$/g,""):""}function __bitActiveComponentId(){try{var hash=window.location.hash;if(!hash)return null;var _hash$slice$split=hash.slice(1).split("?"),_hash$slice$split2=_slicedToArray(_hash$slice$split,1),idPart=_hash$slice$split2[0],id=__bitNormalizeId(idPart),idWithoutVersion=id.split("@")[0];return idWithoutVersion||null}catch{return null}}var __bitActiveId=__bitActiveComponentId();function __bitShouldSurfaceFor(componentId){if(!__bitActiveId)return!1;var act=__bitNormalizeId(__bitActiveId),cmp=__bitNormalizeId(componentId);return!act||!cmp?!1:act===cmp}function __bitSurfaceToOverlay(err,componentId){return;var e,msg}(function(){var _initializeModules=_asyncToGenerator(_regenerator().m(function _callee(){return _regenerator().w(function(_context){for(;;)switch(_context.n){case 0:(0,
|
|
1
|
+
(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[542],{42384:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var _home_circleci_bvm_versions_1_13_47_bit_1_13_47_node_modules_teambit_preview_dist_preview_modules_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(7496),_home_circleci_bit_bit_node_modules_teambit_local_preview_modules_0557d705b67dd1e1bccbac0bd34835a41036cf72_mjs__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(52252);function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r=typeof Symbol=="function"?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r2,n2,o2,i2){var c2=n2&&n2.prototype instanceof Generator?n2:Generator,u2=Object.create(c2.prototype);return _regeneratorDefine2(u2,"_invoke",function(r3,n3,o3){var i3,c3,u3,f2=0,p=o3||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t2,r4){return i3=t2,c3=0,u3=e,G.n=r4,a}};function d(r4,n4){for(c3=r4,u3=n4,t=0;!y&&f2&&!o4&&t<p.length;t++){var o4,i4=p[t],d2=G.p,l=i4[2];r4>3?(o4=l===n4)&&(u3=i4[(c3=i4[4])?5:(c3=3,3)],i4[4]=i4[5]=e):i4[0]<=d2&&((o4=r4<2&&d2<i4[1])?(c3=0,G.v=n4,G.n=i4[1]):d2<l&&(o4=r4<3||i4[0]>n4||n4>l)&&(i4[4]=r4,i4[5]=n4,G.n=l,c3=0))}if(o4||r4>1)return a;throw y=!0,n4}return function(o4,p2,l){if(f2>1)throw TypeError("Generator is already running");for(y&&p2===1&&d(p2,l),c3=p2,u3=l;(t=c3<2?e:u3)||!y;){i3||(c3?c3<3?(c3>1&&(G.n=-1),d(c3,u3)):G.n=u3:G.v=u3);try{if(f2=2,i3){if(c3||(o4="next"),t=i3[o4]){if(!(t=t.call(i3,u3)))throw TypeError("iterator result is not an object");if(!t.done)return t;u3=t.value,c3<2&&(c3=0)}else c3===1&&(t=i3.return)&&t.call(i3),c3<2&&(u3=TypeError("The iterator does not provide a '"+o4+"' method"),c3=1);i3=e}else if((t=(y=G.n<0)?u3:r3.call(n3,G))!==a)break}catch(t2){i3=e,c3=1,u3=t2}finally{f2=1}}return{value:t,done:y}}}(r2,o2,i2),!0),u2}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e2){return Object.setPrototypeOf?Object.setPrototypeOf(e2,GeneratorFunctionPrototype):(e2.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e2,o,"GeneratorFunction")),e2.prototype=Object.create(u),e2}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}_regeneratorDefine2=function(e2,r2,n2,t2){function o(r3,n3){_regeneratorDefine2(e2,r3,function(e3){return this._invoke(r3,n3,e3)})}r2?i?i(e2,r2,{value:n2,enumerable:!t2,configurable:!t2,writable:!t2}):e2[r2]=n2:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n2){return void e(n2)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n2){asyncGeneratorStep(a,r,o,_next,_throw,"next",n2)}function _throw(n2){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n2)}_next(void 0)})}}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(r,a){if(r){if(typeof r=="string")return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(a==null||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,l){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,l===0){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r2){o=!0,n=r2}finally{try{if(!f&&t.return!=null&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function __bitNormalizeId(id){return id?String(id).trim().replace(/^\/+|\/+$/g,""):""}function __bitActiveComponentId(){try{var hash=window.location.hash;if(!hash)return null;var _hash$slice$split=hash.slice(1).split("?"),_hash$slice$split2=_slicedToArray(_hash$slice$split,1),idPart=_hash$slice$split2[0],id=__bitNormalizeId(idPart),idWithoutVersion=id.split("@")[0];return idWithoutVersion||null}catch{return null}}var __bitActiveId=__bitActiveComponentId();function __bitShouldSurfaceFor(componentId){if(!__bitActiveId)return!1;var act=__bitNormalizeId(__bitActiveId),cmp=__bitNormalizeId(componentId);return!act||!cmp?!1:act===cmp}function __bitSurfaceToOverlay(err,componentId){return;var e,msg}(function(){var _initializeModules=_asyncToGenerator(_regenerator().m(function _callee(){return _regenerator().w(function(_context){for(;;)switch(_context.n){case 0:(0,_home_circleci_bvm_versions_1_13_47_bit_1_13_47_node_modules_teambit_preview_dist_preview_modules_js__WEBPACK_IMPORTED_MODULE_0__.uf)("overview",{modulesMap:{default:_home_circleci_bit_bit_node_modules_teambit_local_preview_modules_0557d705b67dd1e1bccbac0bd34835a41036cf72_mjs__WEBPACK_IMPORTED_MODULE_1__.x},isSplitComponentBundle:!0,componentMap:{}});case 1:return _context.a(2)}},_callee)}));function initializeModules(){return _initializeModules.apply(this,arguments)}return initializeModules})()()},94891:()=>{},91044:()=>{},38954:()=>{},71220:()=>{},38854:()=>{}},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[252,320,629,518,866],()=>__webpack_exec__(42384));var __webpack_exports__=__webpack_require__.O()}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Preview</title><script>// Allow to use react dev-tools inside the examples
|
|
2
|
-
try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}</script><style>body { margin: 0; }</style><script defer="defer" src="320.901d818bee5d1e4c5580.js"></script><script defer="defer" src="peers.
|
|
2
|
+
try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}</script><style>body { margin: 0; }</style><script defer="defer" src="320.901d818bee5d1e4c5580.js"></script><script defer="defer" src="peers.1c64d2466352485e8b48.js"></script><script defer="defer" src="629.6e1344854ebb0dc9a817.js"></script><script defer="defer" src="preview-root.c52feb4ab7319fbdd9c7.js"></script><script defer="defer" src="compositions.7c04be07295c45d68e98.js"></script><script defer="defer" src="252.a39dd47690eab9167170.js"></script><script defer="defer" src="overview.80127976ee4371c7a43a.js"></script><link href="static/css/preview-root.dbc84ad7.css" rel="stylesheet"><link href="static/css/compositions.a801ccd3.css" rel="stylesheet"><link href="static/css/252.7feb48c6.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var __webpack_modules__={
|
|
1
|
+
(()=>{"use strict";var __webpack_modules__={96774:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__2)=>{var react__WEBPACK_IMPORTED_MODULE_2___namespace_cache,react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache,_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__2(47717),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__2(58860),react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__2(37953),react_dom__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__2(88705),globalObj=window;guard("TeambitMdxUiMdxScopeContext",_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__),guard("MdxJsReact",_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__),guard("React",react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2))),guard("ReactDom",react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2))),globalObj.TeambitMdxUiMdxScopeContext=_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__,globalObj.MdxJsReact=_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__,globalObj.React=react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2)),globalObj.ReactDom=react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2));function guard(property,expected){var existing=globalObj[property];if(existing===expected&&expected!==void 0)console.warn('[expose-peers] "'+property+'" already exists in global scope, but with correct value');else if(existing!==void 0)throw new Error('[expose-peers] "'+property+'" already exists in the global scope, cannot overwrite')}}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==void 0)return cachedModule.exports;var module=__webpack_module_cache__[moduleId]={id:moduleId,loaded:!1,exports:{}};return __webpack_modules__[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdO={},(()=>{var deferred=[];__webpack_require__.O=(result,chunkIds,fn,priority)=>{if(chunkIds){priority=priority||0;for(var i=deferred.length;i>0&&deferred[i-1][2]>priority;i--)deferred[i]=deferred[i-1];deferred[i]=[chunkIds,fn,priority];return}for(var notFulfilled=1/0,i=0;i<deferred.length;i++){for(var[chunkIds,fn,priority]=deferred[i],fulfilled=!0,j=0;j<chunkIds.length;j++)(priority&!1||notFulfilled>=priority)&&Object.keys(__webpack_require__.O).every(key=>__webpack_require__.O[key](chunkIds[j]))?chunkIds.splice(j--,1):(fulfilled=!1,priority<notFulfilled&&(notFulfilled=priority));if(fulfilled){deferred.splice(i--,1);var r=fn();r!==void 0&&(result=r)}}return result}})(),__webpack_require__.n=module=>{var getter=module&&module.__esModule?()=>module.default:()=>module;return __webpack_require__.d(getter,{a:getter}),getter},(()=>{var getProto=Object.getPrototypeOf?obj=>Object.getPrototypeOf(obj):obj=>obj.__proto__,leafPrototypes;__webpack_require__.t=function(value,mode){if(mode&1&&(value=this(value)),mode&8||typeof value=="object"&&value&&(mode&4&&value.__esModule||mode&16&&typeof value.then=="function"))return value;var ns=Object.create(null);__webpack_require__.r(ns);var def={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var current=mode&2&&value;typeof current=="object"&&!~leafPrototypes.indexOf(current);current=getProto(current))Object.getOwnPropertyNames(current).forEach(key=>def[key]=()=>value[key]);return def.default=()=>value,__webpack_require__.d(ns,def),ns}})(),__webpack_require__.d=(exports,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.nmd=module=>(module.paths=[],module.children||(module.children=[]),module),(()=>{var installedChunks={626:0};__webpack_require__.O.j=chunkId=>installedChunks[chunkId]===0;var webpackJsonpCallback=(parentChunkLoadingFunction,data)=>{var[chunkIds,moreModules,runtime]=data,moduleId,chunkId,i=0;if(chunkIds.some(id=>installedChunks[id]!==0)){for(moduleId in moreModules)__webpack_require__.o(moreModules,moduleId)&&(__webpack_require__.m[moduleId]=moreModules[moduleId]);if(runtime)var result=runtime(__webpack_require__)}for(parentChunkLoadingFunction&&parentChunkLoadingFunction(data);i<chunkIds.length;i++)chunkId=chunkIds[i],__webpack_require__.o(installedChunks,chunkId)&&installedChunks[chunkId]&&installedChunks[chunkId][0](),installedChunks[chunkId]=0;return __webpack_require__.O(result)},chunkLoadingGlobal=self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[];chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null,0)),chunkLoadingGlobal.push=webpackJsonpCallback.bind(null,chunkLoadingGlobal.push.bind(chunkLoadingGlobal))})();var __webpack_exports__=__webpack_require__.O(void 0,[320],()=>__webpack_require__(96774));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[518],{},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[
|
|
1
|
+
"use strict";(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[518],{},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[629,320],()=>__webpack_exec__(92629));var __webpack_exports__=__webpack_require__.O()}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { linkModules } from '/home/circleci/.bvm/versions/1.13.
|
|
2
|
+
import { linkModules } from '/home/circleci/.bvm/versions/1.13.47/bit-1.13.47/node_modules/@teambit/preview/dist/preview-modules.js';
|
|
3
3
|
|
|
4
4
|
// strip leading/trailing slashes from any id we compare
|
|
5
5
|
function __bitNormalizeId(id) {
|
package/dist/mdx.detector.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { DependencyDetector, FileContext } from '@teambit/dependency-resolver';
|
|
2
|
+
import type { Logger } from '@teambit/logger';
|
|
3
|
+
/**
|
|
4
|
+
* Regex-based fallback for extracting import sources from MDX files.
|
|
5
|
+
* Used when compileSync fails due to MDX v3 syntax incompatibilities in user content
|
|
6
|
+
* (e.g. HTML comments, escaped characters, bare variable declarations, unclosed tags).
|
|
7
|
+
*
|
|
8
|
+
* Matches both standard imports (import x from "y") and side-effect imports (import "y").
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectImportsWithRegex(source: string): string[];
|
|
2
11
|
export declare class MDXDependencyDetector implements DependencyDetector {
|
|
3
12
|
private supportedExtensions;
|
|
4
|
-
|
|
13
|
+
private logger?;
|
|
14
|
+
private currentFilename?;
|
|
15
|
+
constructor(supportedExtensions: string[], logger?: Logger);
|
|
5
16
|
isSupported(context: FileContext): boolean;
|
|
6
17
|
detect(source: string): string[];
|
|
7
18
|
}
|
package/dist/mdx.detector.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MDXDependencyDetector = void 0;
|
|
7
|
+
exports.detectImportsWithRegex = detectImportsWithRegex;
|
|
7
8
|
function _mdx() {
|
|
8
9
|
const data = require("@mdx-js/mdx");
|
|
9
10
|
_mdx = function () {
|
|
@@ -18,22 +19,120 @@ function _mdxModules() {
|
|
|
18
19
|
};
|
|
19
20
|
return data;
|
|
20
21
|
}
|
|
22
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
26
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
+
/**
|
|
28
|
+
* MDX options for dependency detection only.
|
|
29
|
+
* Uses the remark plugins from mdxOptions (for frontmatter and import extraction)
|
|
30
|
+
* but excludes rehype plugins like rehypeMdxCodeProps that fail on legacy
|
|
31
|
+
* code fence meta syntax (e.g. `live=true`).
|
|
32
|
+
*
|
|
33
|
+
* Computed lazily to avoid triggering the mdx-v3-options dependency chain
|
|
34
|
+
* (~180 files) during bootstrap for commands that don't need MDX processing.
|
|
35
|
+
*/
|
|
36
|
+
let _detectorMdxOptions;
|
|
37
|
+
function getDetectorMdxOptions() {
|
|
38
|
+
if (!_detectorMdxOptions) {
|
|
39
|
+
_detectorMdxOptions = _objectSpread(_objectSpread({}, _mdxModules().mdxOptions.remarkPlugins && {
|
|
40
|
+
remarkPlugins: _mdxModules().mdxOptions.remarkPlugins
|
|
41
|
+
}), _mdxModules().mdxOptions.jsxImportSource && {
|
|
42
|
+
jsxImportSource: _mdxModules().mdxOptions.jsxImportSource
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return _detectorMdxOptions;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Regex pattern for matching import statements in JavaScript/TypeScript.
|
|
50
|
+
*
|
|
51
|
+
* Structure: /import\s+(?:PATTERN_A|PATTERN_B)/g
|
|
52
|
+
* - The `import\s+` prefix is OUTSIDE the alternation, so both patterns require the import keyword
|
|
53
|
+
*
|
|
54
|
+
* This regex matches two import patterns in an alternation:
|
|
55
|
+
*
|
|
56
|
+
* PATTERN_A (captured in group 1): [type] <specifiers> from "module"
|
|
57
|
+
* - Optional "type" keyword for TypeScript type imports
|
|
58
|
+
* - Specifiers can be: default (x), named ({x}), namespace (* as x), or mixed (x, {y})
|
|
59
|
+
* - Followed by the `from` keyword and quoted module path
|
|
60
|
+
* - Module path is captured in group 1
|
|
61
|
+
*
|
|
62
|
+
* PATTERN_B (captured in group 2): "module"
|
|
63
|
+
* - Side-effect only imports with no specifiers, just quoted module path
|
|
64
|
+
* - The quotes directly follow `import` with only whitespace in between
|
|
65
|
+
* - Module path is captured in group 2
|
|
66
|
+
* - Note: This will NOT match random quoted strings in code (e.g., const x = "foo")
|
|
67
|
+
* because the `import\s+` prefix is required
|
|
68
|
+
*
|
|
69
|
+
* Example matches:
|
|
70
|
+
* import x from "y" -> group 1: "y"
|
|
71
|
+
* import { x } from "y" -> group 1: "y"
|
|
72
|
+
* import * as x from "y" -> group 1: "y"
|
|
73
|
+
* import x, { y } from "z" -> group 1: "z"
|
|
74
|
+
* import type { T } from "y" -> group 1: "y"
|
|
75
|
+
* import "y" -> group 2: "y"
|
|
76
|
+
*
|
|
77
|
+
* Limitations:
|
|
78
|
+
* - Will match imports in comments (e.g., // import "x")
|
|
79
|
+
* - Will match imports in code blocks/strings if they appear to be syntactically valid
|
|
80
|
+
* - These are acceptable trade-offs for the fallback mode
|
|
81
|
+
*/
|
|
82
|
+
const IMPORT_STATEMENT_REGEX = /import\s+(?:(?:type\s+)?(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)(?:\s*,\s*\{[^}]*\}|\s*,\s*\w+)?\s+from\s+['"]([^'"]+)['"]|['"]([^'"]+)['"])/g;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Regex-based fallback for extracting import sources from MDX files.
|
|
86
|
+
* Used when compileSync fails due to MDX v3 syntax incompatibilities in user content
|
|
87
|
+
* (e.g. HTML comments, escaped characters, bare variable declarations, unclosed tags).
|
|
88
|
+
*
|
|
89
|
+
* Matches both standard imports (import x from "y") and side-effect imports (import "y").
|
|
90
|
+
*/
|
|
91
|
+
function detectImportsWithRegex(source) {
|
|
92
|
+
const modules = [];
|
|
93
|
+
let match;
|
|
94
|
+
// Reset regex state before use
|
|
95
|
+
IMPORT_STATEMENT_REGEX.lastIndex = 0;
|
|
96
|
+
while ((match = IMPORT_STATEMENT_REGEX.exec(source)) !== null) {
|
|
97
|
+
// Use whichever capture group matched (group 1 for "from" imports, group 2 for side-effect imports)
|
|
98
|
+
const moduleName = match[1] || match[2];
|
|
99
|
+
if (moduleName) modules.push(moduleName);
|
|
100
|
+
}
|
|
101
|
+
return modules;
|
|
102
|
+
}
|
|
21
103
|
class MDXDependencyDetector {
|
|
22
|
-
constructor(supportedExtensions) {
|
|
104
|
+
constructor(supportedExtensions, logger) {
|
|
23
105
|
this.supportedExtensions = supportedExtensions;
|
|
106
|
+
_defineProperty(this, "logger", void 0);
|
|
107
|
+
_defineProperty(this, "currentFilename", void 0);
|
|
108
|
+
this.logger = logger;
|
|
109
|
+
// Bind detect to preserve `this` context when passed as a detached function.
|
|
110
|
+
this.detect = this.detect.bind(this);
|
|
24
111
|
}
|
|
25
112
|
isSupported(context) {
|
|
113
|
+
// Capture filename for use in detect() warning messages.
|
|
114
|
+
// isSupported is always called immediately before detect() for the same file.
|
|
115
|
+
this.currentFilename = context.filename;
|
|
26
116
|
return this.supportedExtensions.includes(context.ext);
|
|
27
117
|
}
|
|
28
118
|
detect(source) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
119
|
+
const filename = this.currentFilename;
|
|
120
|
+
try {
|
|
121
|
+
var _output$data;
|
|
122
|
+
const output = (0, _mdx().compileSync)(source, getDetectorMdxOptions());
|
|
123
|
+
const imports = ((_output$data = output.data) === null || _output$data === void 0 ? void 0 : _output$data.imports) || [];
|
|
124
|
+
if (!imports.length) return [];
|
|
125
|
+
return imports.map(importSpec => importSpec.fromModule);
|
|
126
|
+
} catch (err) {
|
|
127
|
+
var _this$logger;
|
|
128
|
+
// MDX v3 may fail to compile files with legacy syntax (HTML comments, escaped
|
|
129
|
+
// characters in prose, bare variable declarations, unclosed tags, etc.).
|
|
130
|
+
// Fall back to regex-based import detection which is sufficient for dependency resolution.
|
|
131
|
+
const fileRef = filename ? ` File: ${filename}` : '';
|
|
132
|
+
const msg = `MDX compilation failed, falling back to regex-based import detection.${fileRef} Error: ${err.message}`;
|
|
133
|
+
(_this$logger = this.logger) === null || _this$logger === void 0 || _this$logger.consoleWarning(msg);
|
|
134
|
+
return detectImportsWithRegex(source);
|
|
135
|
+
}
|
|
37
136
|
}
|
|
38
137
|
}
|
|
39
138
|
exports.MDXDependencyDetector = MDXDependencyDetector;
|
package/dist/mdx.detector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_mdx","data","require","_mdxModules","MDXDependencyDetector","constructor","supportedExtensions","isSupported","context","includes","ext","detect","source","_output$data","output","compileSync","mdxOptions","imports","length","files","map","importSpec","fromModule","exports"],"sources":["mdx.detector.ts"],"sourcesContent":["import type { DependencyDetector, FileContext } from '@teambit/dependency-resolver';\nimport { compileSync } from '@mdx-js/mdx';\nimport { mdxOptions } from '@teambit/mdx.modules.mdx-v3-options';\n\ntype ImportSpecifier = {\n /**\n * relative/absolute or module name. e.g. the `y` in the example of `import x from 'y';`\n */\n fromModule: string;\n\n /**\n * is default import (e.g. `import x from 'y';`)\n */\n isDefault?: boolean;\n\n /**\n * the name used to identify the module, e.g. the `x` in the example of `import x from 'y';`\n */\n identifier?: string;\n};\n\nexport class MDXDependencyDetector implements DependencyDetector {\n constructor(private supportedExtensions: string[]) {}\n\n isSupported(context: FileContext): boolean {\n return this.supportedExtensions.includes(context.ext);\n }\n\n detect(source: string): string[] {\n const output = compileSync(source, mdxOptions);\n const imports = (output.data?.imports as ImportSpecifier[]) || [];\n if (!imports.length) return [];\n const files: string[] = imports.map((importSpec) => {\n return importSpec.fromModule;\n });\n\n return files;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAmBO,MAAMG,qBAAqB,CAA+B;EAC/DC,WAAWA,CAASC,mBAA6B,EAAE;IAAA,KAA/BA,mBAA6B,GAA7BA,mBAA6B;EAAG;EAEpDC,WAAWA,CAACC,OAAoB,EAAW;IACzC,OAAO,IAAI,CAACF,mBAAmB,CAACG,QAAQ,CAACD,OAAO,CAACE,GAAG,CAAC;EACvD;EAEAC,MAAMA,CAACC,MAAc,EAAY;IAAA,IAAAC,YAAA;IAC/B,MAAMC,MAAM,GAAG,IAAAC,kBAAW,EAACH,MAAM,EAAEI,wBAAU,CAAC;IAC9C,MAAMC,OAAO,GAAG,EAAAJ,YAAA,GAACC,MAAM,CAACb,IAAI,cAAAY,YAAA,uBAAXA,YAAA,CAAaI,OAAO,KAA0B,EAAE;IACjE,IAAI,CAACA,OAAO,CAACC,MAAM,EAAE,OAAO,EAAE;IAC9B,MAAMC,KAAe,GAAGF,OAAO,CAACG,GAAG,CAAEC,UAAU,IAAK;MAClD,OAAOA,UAAU,CAACC,UAAU;IAC9B,CAAC,CAAC;IAEF,OAAOH,KAAK;EACd;AACF;AAACI,OAAA,CAAAnB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_mdx","data","require","_mdxModules","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_detectorMdxOptions","getDetectorMdxOptions","mdxOptions","remarkPlugins","jsxImportSource","IMPORT_STATEMENT_REGEX","detectImportsWithRegex","source","modules","match","lastIndex","exec","moduleName","MDXDependencyDetector","constructor","supportedExtensions","logger","detect","bind","isSupported","context","currentFilename","filename","includes","ext","_output$data","output","compileSync","imports","map","importSpec","fromModule","err","_this$logger","fileRef","msg","message","consoleWarning","exports"],"sources":["mdx.detector.ts"],"sourcesContent":["import type { DependencyDetector, FileContext } from '@teambit/dependency-resolver';\nimport { compileSync } from '@mdx-js/mdx';\nimport { mdxOptions } from '@teambit/mdx.modules.mdx-v3-options';\nimport type { Logger } from '@teambit/logger';\n\ntype ImportSpecifier = {\n /**\n * relative/absolute or module name. e.g. the `y` in the example of `import x from 'y';`\n */\n fromModule: string;\n\n /**\n * is default import (e.g. `import x from 'y';`)\n */\n isDefault?: boolean;\n\n /**\n * the name used to identify the module, e.g. the `x` in the example of `import x from 'y';`\n */\n identifier?: string;\n};\n\n/**\n * MDX options for dependency detection only.\n * Uses the remark plugins from mdxOptions (for frontmatter and import extraction)\n * but excludes rehype plugins like rehypeMdxCodeProps that fail on legacy\n * code fence meta syntax (e.g. `live=true`).\n *\n * Computed lazily to avoid triggering the mdx-v3-options dependency chain\n * (~180 files) during bootstrap for commands that don't need MDX processing.\n */\nlet _detectorMdxOptions: Record<string, any> | undefined;\nfunction getDetectorMdxOptions() {\n if (!_detectorMdxOptions) {\n _detectorMdxOptions = {\n ...(mdxOptions.remarkPlugins && { remarkPlugins: mdxOptions.remarkPlugins }),\n ...(mdxOptions.jsxImportSource && { jsxImportSource: mdxOptions.jsxImportSource }),\n };\n }\n return _detectorMdxOptions;\n}\n\n/**\n * Regex pattern for matching import statements in JavaScript/TypeScript.\n *\n * Structure: /import\\s+(?:PATTERN_A|PATTERN_B)/g\n * - The `import\\s+` prefix is OUTSIDE the alternation, so both patterns require the import keyword\n *\n * This regex matches two import patterns in an alternation:\n *\n * PATTERN_A (captured in group 1): [type] <specifiers> from \"module\"\n * - Optional \"type\" keyword for TypeScript type imports\n * - Specifiers can be: default (x), named ({x}), namespace (* as x), or mixed (x, {y})\n * - Followed by the `from` keyword and quoted module path\n * - Module path is captured in group 1\n *\n * PATTERN_B (captured in group 2): \"module\"\n * - Side-effect only imports with no specifiers, just quoted module path\n * - The quotes directly follow `import` with only whitespace in between\n * - Module path is captured in group 2\n * - Note: This will NOT match random quoted strings in code (e.g., const x = \"foo\")\n * because the `import\\s+` prefix is required\n *\n * Example matches:\n * import x from \"y\" -> group 1: \"y\"\n * import { x } from \"y\" -> group 1: \"y\"\n * import * as x from \"y\" -> group 1: \"y\"\n * import x, { y } from \"z\" -> group 1: \"z\"\n * import type { T } from \"y\" -> group 1: \"y\"\n * import \"y\" -> group 2: \"y\"\n *\n * Limitations:\n * - Will match imports in comments (e.g., // import \"x\")\n * - Will match imports in code blocks/strings if they appear to be syntactically valid\n * - These are acceptable trade-offs for the fallback mode\n */\nconst IMPORT_STATEMENT_REGEX =\n /import\\s+(?:(?:type\\s+)?(?:\\{[^}]*\\}|\\*\\s+as\\s+\\w+|\\w+)(?:\\s*,\\s*\\{[^}]*\\}|\\s*,\\s*\\w+)?\\s+from\\s+['\"]([^'\"]+)['\"]|['\"]([^'\"]+)['\"])/g;\n\n/**\n * Regex-based fallback for extracting import sources from MDX files.\n * Used when compileSync fails due to MDX v3 syntax incompatibilities in user content\n * (e.g. HTML comments, escaped characters, bare variable declarations, unclosed tags).\n *\n * Matches both standard imports (import x from \"y\") and side-effect imports (import \"y\").\n */\nexport function detectImportsWithRegex(source: string): string[] {\n const modules: string[] = [];\n let match: RegExpExecArray | null;\n // Reset regex state before use\n IMPORT_STATEMENT_REGEX.lastIndex = 0;\n while ((match = IMPORT_STATEMENT_REGEX.exec(source)) !== null) {\n // Use whichever capture group matched (group 1 for \"from\" imports, group 2 for side-effect imports)\n const moduleName = match[1] || match[2];\n if (moduleName) modules.push(moduleName);\n }\n return modules;\n}\n\nexport class MDXDependencyDetector implements DependencyDetector {\n private logger?: Logger;\n private currentFilename?: string;\n\n constructor(\n private supportedExtensions: string[],\n logger?: Logger\n ) {\n this.logger = logger;\n // Bind detect to preserve `this` context when passed as a detached function.\n this.detect = this.detect.bind(this);\n }\n\n isSupported(context: FileContext): boolean {\n // Capture filename for use in detect() warning messages.\n // isSupported is always called immediately before detect() for the same file.\n this.currentFilename = context.filename;\n return this.supportedExtensions.includes(context.ext);\n }\n\n detect(source: string): string[] {\n const filename = this.currentFilename;\n try {\n const output = compileSync(source, getDetectorMdxOptions());\n const imports = (output.data?.imports as ImportSpecifier[]) || [];\n if (!imports.length) return [];\n return imports.map((importSpec) => importSpec.fromModule);\n } catch (err: any) {\n // MDX v3 may fail to compile files with legacy syntax (HTML comments, escaped\n // characters in prose, bare variable declarations, unclosed tags, etc.).\n // Fall back to regex-based import detection which is sufficient for dependency resolution.\n const fileRef = filename ? ` File: ${filename}` : '';\n const msg = `MDX compilation failed, falling back to regex-based import detection.${fileRef} Error: ${err.message}`;\n this.logger?.consoleWarning(msg);\n return detectImportsWithRegex(source);\n }\n }\n}\n"],"mappings":";;;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiE,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAA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eAAe,GAAGD,OAAO,CAACE,QAAQ;IACvC,OAAO,IAAI,CAACP,mBAAmB,CAACQ,QAAQ,CAACH,OAAO,CAACI,GAAG,CAAC;EACvD;EAEAP,MAAMA,CAACV,MAAc,EAAY;IAC/B,MAAMe,QAAQ,GAAG,IAAI,CAACD,eAAe;IACrC,IAAI;MAAA,IAAAI,YAAA;MACF,MAAMC,MAAM,GAAG,IAAAC,kBAAW,EAACpB,MAAM,EAAEN,qBAAqB,CAAC,CAAC,CAAC;MAC3D,MAAM2B,OAAO,GAAG,EAAAH,YAAA,GAACC,MAAM,CAAC9D,IAAI,cAAA6D,YAAA,uBAAXA,YAAA,CAAaG,OAAO,KAA0B,EAAE;MACjE,IAAI,CAACA,OAAO,CAAC9C,MAAM,EAAE,OAAO,EAAE;MAC9B,OAAO8C,OAAO,CAACC,GAAG,CAAEC,UAAU,IAAKA,UAAU,CAACC,UAAU,CAAC;IAC3D,CAAC,CAAC,OAAOC,GAAQ,EAAE;MAAA,IAAAC,YAAA;MACjB;MACA;MACA;MACA,MAAMC,OAAO,GAAGZ,QAAQ,GAAG,UAAUA,QAAQ,EAAE,GAAG,EAAE;MACpD,MAAMa,GAAG,GAAG,wEAAwED,OAAO,WAAWF,GAAG,CAACI,OAAO,EAAE;MACnH,CAAAH,YAAA,OAAI,CAACjB,MAAM,cAAAiB,YAAA,eAAXA,YAAA,CAAaI,cAAc,CAACF,GAAG,CAAC;MAChC,OAAO7B,sBAAsB,CAACC,MAAM,CAAC;IACvC;EACF;AACF;AAAC+B,OAAA,CAAAzB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -7,35 +7,253 @@ function _chai() {
|
|
|
7
7
|
};
|
|
8
8
|
return data;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
function _mdx() {
|
|
11
|
+
const data = require("@mdx-js/mdx");
|
|
12
|
+
_mdx = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _mdx2() {
|
|
18
|
+
const data = require("./mdx.detector");
|
|
19
|
+
_mdx2 = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
// Mock @mdx-js/mdx and @teambit/mdx.modules.mdx-v3-options to avoid loading ESM-only
|
|
25
|
+
// modules (100+ packages in the unified/remark/rehype ecosystem) that Jest cannot
|
|
26
|
+
// handle in CJS mode due to missing require export conditions and ESM syntax.
|
|
27
|
+
jest.mock('@mdx-js/mdx', () => ({
|
|
28
|
+
compileSync: jest.fn()
|
|
29
|
+
}));
|
|
30
|
+
jest.mock('@teambit/mdx.modules.mdx-v3-options', () => ({
|
|
31
|
+
mdxOptions: {
|
|
32
|
+
remarkPlugins: [],
|
|
33
|
+
jsxImportSource: 'react'
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
const mockCompileSync = _mdx().compileSync;
|
|
37
|
+
describe('MDXDependencyDetector', () => {
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
mockCompileSync.mockReset();
|
|
40
|
+
});
|
|
41
|
+
describe('detect - compileSync path', () => {
|
|
42
|
+
it('should return modules from compileSync imports data', () => {
|
|
43
|
+
mockCompileSync.mockReturnValue({
|
|
44
|
+
data: {
|
|
45
|
+
imports: [{
|
|
46
|
+
fromModule: 'react'
|
|
47
|
+
}, {
|
|
48
|
+
fromModule: '@teambit/design.ui.button'
|
|
49
|
+
}]
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
53
|
+
(0, _chai().expect)(detector.detect('any source')).to.deep.equal(['react', '@teambit/design.ui.button']);
|
|
54
|
+
});
|
|
55
|
+
it('should return empty array when compileSync returns no imports', () => {
|
|
56
|
+
mockCompileSync.mockReturnValue({
|
|
57
|
+
data: {
|
|
58
|
+
imports: []
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
62
|
+
(0, _chai().expect)(detector.detect('# Just markdown')).to.deep.equal([]);
|
|
63
|
+
});
|
|
64
|
+
it('should return empty array when imports data is undefined', () => {
|
|
65
|
+
mockCompileSync.mockReturnValue({
|
|
66
|
+
data: {}
|
|
67
|
+
});
|
|
68
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
69
|
+
(0, _chai().expect)(detector.detect('# No imports')).to.deep.equal([]);
|
|
70
|
+
});
|
|
71
|
+
it('should pass source and options to compileSync', () => {
|
|
72
|
+
mockCompileSync.mockReturnValue({
|
|
73
|
+
data: {
|
|
74
|
+
imports: []
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
78
|
+
detector.detect('test source');
|
|
79
|
+
(0, _chai().expect)(mockCompileSync.mock.calls.length).to.equal(1);
|
|
80
|
+
(0, _chai().expect)(mockCompileSync.mock.calls[0][0]).to.equal('test source');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('detect - regex fallback on compileSync failure', () => {
|
|
84
|
+
beforeEach(() => {
|
|
85
|
+
mockCompileSync.mockImplementation(() => {
|
|
86
|
+
throw new Error('MDX compilation failed');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
it('should fallback to regex when compileSync throws', () => {
|
|
90
|
+
const src = `import React from 'react';`;
|
|
91
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
92
|
+
(0, _chai().expect)(detector.detect(src)).to.deep.equal(['react']);
|
|
93
|
+
});
|
|
94
|
+
it('should detect imports when MDX contains HTML comments', () => {
|
|
95
|
+
const src = `
|
|
96
|
+
import React from 'react';
|
|
97
|
+
import { Button } from '@teambit/base-ui.inputs.button';
|
|
98
|
+
|
|
99
|
+
<!-- This is an HTML comment that breaks MDX v3 -->
|
|
100
|
+
# Hello World
|
|
101
|
+
`;
|
|
102
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
103
|
+
(0, _chai().expect)(detector.detect(src)).to.deep.equal(['react', '@teambit/base-ui.inputs.button']);
|
|
104
|
+
});
|
|
105
|
+
it('should detect imports when MDX contains unclosed tags', () => {
|
|
106
|
+
const src = `
|
|
107
|
+
import { Card } from '@teambit/design.ui.card';
|
|
108
|
+
|
|
109
|
+
<div>
|
|
110
|
+
# Content
|
|
111
|
+
`;
|
|
112
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
113
|
+
(0, _chai().expect)(detector.detect(src)).to.deep.equal(['@teambit/design.ui.card']);
|
|
114
|
+
});
|
|
115
|
+
it('should detect imports when MDX contains escaped characters', () => {
|
|
116
|
+
const src = `
|
|
117
|
+
import Component from './component';
|
|
118
|
+
|
|
119
|
+
Here's some text with \\escaped\\characters that MDX v3 doesn't like
|
|
120
|
+
`;
|
|
121
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
122
|
+
(0, _chai().expect)(detector.detect(src)).to.deep.equal(['./component']);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
describe('isSupported', () => {
|
|
126
|
+
it('should return true for supported extensions', () => {
|
|
127
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx', 'md']);
|
|
128
|
+
(0, _chai().expect)(detector.isSupported({
|
|
129
|
+
ext: 'mdx',
|
|
130
|
+
filename: 'test.mdx'
|
|
131
|
+
})).to.be.true;
|
|
132
|
+
(0, _chai().expect)(detector.isSupported({
|
|
133
|
+
ext: 'md',
|
|
134
|
+
filename: 'test.md'
|
|
135
|
+
})).to.be.true;
|
|
136
|
+
});
|
|
137
|
+
it('should return false for unsupported extensions', () => {
|
|
138
|
+
const detector = new (_mdx2().MDXDependencyDetector)(['mdx']);
|
|
139
|
+
(0, _chai().expect)(detector.isSupported({
|
|
140
|
+
ext: 'ts',
|
|
141
|
+
filename: 'test.ts'
|
|
142
|
+
})).to.be.false;
|
|
143
|
+
});
|
|
144
|
+
});
|
|
12
145
|
});
|
|
146
|
+
describe('detectImportsWithRegex', () => {
|
|
147
|
+
it('should detect default import', () => {
|
|
148
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)('import x from "y";')).to.deep.equal(['y']);
|
|
149
|
+
});
|
|
150
|
+
it('should detect star import', () => {
|
|
151
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)('import * as y from "y";')).to.deep.equal(['y']);
|
|
152
|
+
});
|
|
153
|
+
it('should detect named import', () => {
|
|
154
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)('import { x } from "y";')).to.deep.equal(['y']);
|
|
155
|
+
});
|
|
156
|
+
it('should detect side-effect import', () => {
|
|
157
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)('import "y";')).to.deep.equal(['y']);
|
|
158
|
+
});
|
|
159
|
+
it('should detect multiple imports', () => {
|
|
160
|
+
const src = `
|
|
161
|
+
import React from 'react';
|
|
162
|
+
import { Button } from '@teambit/design.ui.button';
|
|
163
|
+
import * as utils from './utils';
|
|
164
|
+
`;
|
|
165
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal(['react', '@teambit/design.ui.button', './utils']);
|
|
166
|
+
});
|
|
167
|
+
it('should detect imports with single quotes', () => {
|
|
168
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(`import x from 'single-quotes';`)).to.deep.equal(['single-quotes']);
|
|
169
|
+
});
|
|
170
|
+
it('should detect imports with double quotes', () => {
|
|
171
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(`import x from "double-quotes";`)).to.deep.equal(['double-quotes']);
|
|
172
|
+
});
|
|
173
|
+
it('should detect imports with mixed quote styles', () => {
|
|
174
|
+
const src = `
|
|
175
|
+
import a from 'single';
|
|
176
|
+
import b from "double";
|
|
177
|
+
`;
|
|
178
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal(['single', 'double']);
|
|
179
|
+
});
|
|
180
|
+
it('should detect TypeScript type imports', () => {
|
|
181
|
+
const src = `
|
|
182
|
+
import type { MyType } from 'my-types';
|
|
183
|
+
import { Component } from 'my-component';
|
|
184
|
+
`;
|
|
185
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal(['my-types', 'my-component']);
|
|
186
|
+
});
|
|
187
|
+
it('should detect default and named imports combined', () => {
|
|
188
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(`import React, { useState } from 'react';`)).to.deep.equal(['react']);
|
|
189
|
+
});
|
|
190
|
+
it('should detect imports with multiple named imports', () => {
|
|
191
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(`import { foo, bar, baz } from 'multi-named';`)).to.deep.equal(['multi-named']);
|
|
192
|
+
});
|
|
193
|
+
it('should detect side-effect only imports', () => {
|
|
194
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(`import 'side-effect';`)).to.deep.equal(['side-effect']);
|
|
195
|
+
});
|
|
196
|
+
it('should detect scoped package imports', () => {
|
|
197
|
+
const src = `
|
|
198
|
+
import { Button } from '@scope/package';
|
|
199
|
+
import Utils from '@company/utils';
|
|
200
|
+
`;
|
|
201
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal(['@scope/package', '@company/utils']);
|
|
202
|
+
});
|
|
203
|
+
it('should detect relative path imports', () => {
|
|
204
|
+
const src = `
|
|
205
|
+
import Local from './local';
|
|
206
|
+
import Parent from '../parent';
|
|
207
|
+
import Deep from '../../deep/path';
|
|
208
|
+
`;
|
|
209
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal(['./local', '../parent', '../../deep/path']);
|
|
210
|
+
});
|
|
211
|
+
it('should handle imports with extra whitespace', () => {
|
|
212
|
+
const src = `
|
|
213
|
+
import { foo , bar } from 'whitespace' ;
|
|
214
|
+
import * as util from 'util' ;
|
|
215
|
+
`;
|
|
216
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal(['whitespace', 'util']);
|
|
217
|
+
});
|
|
218
|
+
it('should detect imports mixed with complex MDX content', () => {
|
|
219
|
+
const src = `
|
|
220
|
+
import React from 'react';
|
|
221
|
+
import { Button } from '@teambit/design.ui.button';
|
|
222
|
+
|
|
223
|
+
<!-- HTML comment -->
|
|
224
|
+
# Title
|
|
13
225
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
226
|
+
Some text with \\escaped characters
|
|
227
|
+
|
|
228
|
+
<Button>Click me</Button>
|
|
229
|
+
`;
|
|
230
|
+
const detected = (0, _mdx2().detectImportsWithRegex)(src);
|
|
231
|
+
(0, _chai().expect)(detected).to.include('react');
|
|
232
|
+
(0, _chai().expect)(detected).to.include('@teambit/design.ui.button');
|
|
233
|
+
});
|
|
234
|
+
it('should match imports in code blocks (known limitation)', () => {
|
|
235
|
+
const src = `
|
|
236
|
+
import React from 'react';
|
|
237
|
+
|
|
238
|
+
\`\`\`jsx
|
|
239
|
+
import Example from 'example-in-code-block';
|
|
240
|
+
\`\`\`
|
|
241
|
+
`;
|
|
242
|
+
const detected = (0, _mdx2().detectImportsWithRegex)(src);
|
|
243
|
+
(0, _chai().expect)(detected).to.include('react');
|
|
244
|
+
(0, _chai().expect)(detected).to.include('example-in-code-block');
|
|
245
|
+
});
|
|
246
|
+
it('should return empty array for file with no imports', () => {
|
|
247
|
+
const src = `
|
|
248
|
+
# Just a title
|
|
249
|
+
|
|
250
|
+
Some content without any imports.
|
|
251
|
+
`;
|
|
252
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)(src)).to.deep.equal([]);
|
|
253
|
+
});
|
|
254
|
+
it('should return empty array for empty file', () => {
|
|
255
|
+
(0, _chai().expect)((0, _mdx2().detectImportsWithRegex)('')).to.deep.equal([]);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
40
258
|
|
|
41
259
|
//# sourceMappingURL=mdx.detector.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","it","expect","to","equal"],"sources":["mdx.detector.spec.ts"],"sourcesContent":["import { expect } from 'chai';\n\nit('should work', () => {\n expect(true).to.equal(true);\n});\n\n// // Skip these mdx detector test cases since esm imports are not well-supported in jest tester\n// import { MDXDependencyDetector } from './mdx.detector';\n//\n// describe('MDXDependencyDetector', () => {\n// function expectDependencies(src: string, expectedDeps: string[]) {\n// expect(new MDXDependencyDetector(['mdx']).detect(src)).to.deep.equal(expectedDeps);\n// }\n// describe('detect', () => {\n// it('should correctly detect default import', () => {\n// const src = 'import x from \"y\";';\n// expectDependencies(src, ['y']);\n// });\n// it('should correctly detect star import', () => {\n// const src = 'import * as y from \"y\";';\n// expectDependencies(src, ['y']);\n// });\n// it('should correctly detect named import', () => {\n// const src = 'import { x } from \"y\";';\n// expectDependencies(src, ['y']);\n// });\n// it('should correctly detect import with no identifier', () => {\n// const src = 'import \"y\";';\n// expectDependencies(src, ['y']);\n// });\n// });\n// });\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEAE,EAAE,CAAC,aAAa,EAAE,MAAM;EACtB,IAAAC,cAAM,EAAC,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,IAAI,CAAC;AAC7B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_mdx","_mdx2","jest","mock","compileSync","fn","mdxOptions","remarkPlugins","jsxImportSource","mockCompileSync","describe","beforeEach","mockReset","it","mockReturnValue","imports","fromModule","detector","MDXDependencyDetector","expect","detect","to","deep","equal","calls","length","mockImplementation","Error","src","isSupported","ext","filename","be","true","false","detectImportsWithRegex","detected","include"],"sources":["mdx.detector.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { compileSync } from '@mdx-js/mdx';\n\n// Mock @mdx-js/mdx and @teambit/mdx.modules.mdx-v3-options to avoid loading ESM-only\n// modules (100+ packages in the unified/remark/rehype ecosystem) that Jest cannot\n// handle in CJS mode due to missing require export conditions and ESM syntax.\njest.mock('@mdx-js/mdx', () => ({\n compileSync: jest.fn(),\n}));\njest.mock('@teambit/mdx.modules.mdx-v3-options', () => ({\n mdxOptions: { remarkPlugins: [], jsxImportSource: 'react' },\n}));\n\nconst mockCompileSync = compileSync as jest.Mock;\n\nimport { MDXDependencyDetector, detectImportsWithRegex } from './mdx.detector';\n\ndescribe('MDXDependencyDetector', () => {\n beforeEach(() => {\n mockCompileSync.mockReset();\n });\n\n describe('detect - compileSync path', () => {\n it('should return modules from compileSync imports data', () => {\n mockCompileSync.mockReturnValue({\n data: { imports: [{ fromModule: 'react' }, { fromModule: '@teambit/design.ui.button' }] },\n });\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect('any source')).to.deep.equal(['react', '@teambit/design.ui.button']);\n });\n\n it('should return empty array when compileSync returns no imports', () => {\n mockCompileSync.mockReturnValue({ data: { imports: [] } });\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect('# Just markdown')).to.deep.equal([]);\n });\n\n it('should return empty array when imports data is undefined', () => {\n mockCompileSync.mockReturnValue({ data: {} });\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect('# No imports')).to.deep.equal([]);\n });\n\n it('should pass source and options to compileSync', () => {\n mockCompileSync.mockReturnValue({ data: { imports: [] } });\n const detector = new MDXDependencyDetector(['mdx']);\n detector.detect('test source');\n expect(mockCompileSync.mock.calls.length).to.equal(1);\n expect(mockCompileSync.mock.calls[0][0]).to.equal('test source');\n });\n });\n\n describe('detect - regex fallback on compileSync failure', () => {\n beforeEach(() => {\n mockCompileSync.mockImplementation(() => {\n throw new Error('MDX compilation failed');\n });\n });\n\n it('should fallback to regex when compileSync throws', () => {\n const src = `import React from 'react';`;\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect(src)).to.deep.equal(['react']);\n });\n\n it('should detect imports when MDX contains HTML comments', () => {\n const src = `\nimport React from 'react';\nimport { Button } from '@teambit/base-ui.inputs.button';\n\n<!-- This is an HTML comment that breaks MDX v3 -->\n# Hello World\n `;\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect(src)).to.deep.equal(['react', '@teambit/base-ui.inputs.button']);\n });\n\n it('should detect imports when MDX contains unclosed tags', () => {\n const src = `\nimport { Card } from '@teambit/design.ui.card';\n\n<div>\n# Content\n `;\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect(src)).to.deep.equal(['@teambit/design.ui.card']);\n });\n\n it('should detect imports when MDX contains escaped characters', () => {\n const src = `\nimport Component from './component';\n\nHere's some text with \\\\escaped\\\\characters that MDX v3 doesn't like\n `;\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.detect(src)).to.deep.equal(['./component']);\n });\n });\n\n describe('isSupported', () => {\n it('should return true for supported extensions', () => {\n const detector = new MDXDependencyDetector(['mdx', 'md']);\n expect(detector.isSupported({ ext: 'mdx', filename: 'test.mdx' } as any)).to.be.true;\n expect(detector.isSupported({ ext: 'md', filename: 'test.md' } as any)).to.be.true;\n });\n\n it('should return false for unsupported extensions', () => {\n const detector = new MDXDependencyDetector(['mdx']);\n expect(detector.isSupported({ ext: 'ts', filename: 'test.ts' } as any)).to.be.false;\n });\n });\n});\n\ndescribe('detectImportsWithRegex', () => {\n it('should detect default import', () => {\n expect(detectImportsWithRegex('import x from \"y\";')).to.deep.equal(['y']);\n });\n\n it('should detect star import', () => {\n expect(detectImportsWithRegex('import * as y from \"y\";')).to.deep.equal(['y']);\n });\n\n it('should detect named import', () => {\n expect(detectImportsWithRegex('import { x } from \"y\";')).to.deep.equal(['y']);\n });\n\n it('should detect side-effect import', () => {\n expect(detectImportsWithRegex('import \"y\";')).to.deep.equal(['y']);\n });\n\n it('should detect multiple imports', () => {\n const src = `\nimport React from 'react';\nimport { Button } from '@teambit/design.ui.button';\nimport * as utils from './utils';\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal(['react', '@teambit/design.ui.button', './utils']);\n });\n\n it('should detect imports with single quotes', () => {\n expect(detectImportsWithRegex(`import x from 'single-quotes';`)).to.deep.equal(['single-quotes']);\n });\n\n it('should detect imports with double quotes', () => {\n expect(detectImportsWithRegex(`import x from \"double-quotes\";`)).to.deep.equal(['double-quotes']);\n });\n\n it('should detect imports with mixed quote styles', () => {\n const src = `\nimport a from 'single';\nimport b from \"double\";\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal(['single', 'double']);\n });\n\n it('should detect TypeScript type imports', () => {\n const src = `\nimport type { MyType } from 'my-types';\nimport { Component } from 'my-component';\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal(['my-types', 'my-component']);\n });\n\n it('should detect default and named imports combined', () => {\n expect(detectImportsWithRegex(`import React, { useState } from 'react';`)).to.deep.equal(['react']);\n });\n\n it('should detect imports with multiple named imports', () => {\n expect(detectImportsWithRegex(`import { foo, bar, baz } from 'multi-named';`)).to.deep.equal(['multi-named']);\n });\n\n it('should detect side-effect only imports', () => {\n expect(detectImportsWithRegex(`import 'side-effect';`)).to.deep.equal(['side-effect']);\n });\n\n it('should detect scoped package imports', () => {\n const src = `\nimport { Button } from '@scope/package';\nimport Utils from '@company/utils';\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal(['@scope/package', '@company/utils']);\n });\n\n it('should detect relative path imports', () => {\n const src = `\nimport Local from './local';\nimport Parent from '../parent';\nimport Deep from '../../deep/path';\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal(['./local', '../parent', '../../deep/path']);\n });\n\n it('should handle imports with extra whitespace', () => {\n const src = `\nimport { foo , bar } from 'whitespace' ;\nimport * as util from 'util' ;\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal(['whitespace', 'util']);\n });\n\n it('should detect imports mixed with complex MDX content', () => {\n const src = `\nimport React from 'react';\nimport { Button } from '@teambit/design.ui.button';\n\n<!-- HTML comment -->\n# Title\n\nSome text with \\\\escaped characters\n\n<Button>Click me</Button>\n `;\n const detected = detectImportsWithRegex(src);\n expect(detected).to.include('react');\n expect(detected).to.include('@teambit/design.ui.button');\n });\n\n it('should match imports in code blocks (known limitation)', () => {\n const src = `\nimport React from 'react';\n\n\\`\\`\\`jsx\nimport Example from 'example-in-code-block';\n\\`\\`\\`\n `;\n const detected = detectImportsWithRegex(src);\n expect(detected).to.include('react');\n expect(detected).to.include('example-in-code-block');\n });\n\n it('should return empty array for file with no imports', () => {\n const src = `\n# Just a title\n\nSome content without any imports.\n `;\n expect(detectImportsWithRegex(src)).to.deep.equal([]);\n });\n\n it('should return empty array for empty file', () => {\n expect(detectImportsWithRegex('')).to.deep.equal([]);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAcA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAA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ChB;AACA;AACA;AACA,KAAK;IACD,IAAAT,cAAM,EAAC,IAAAgB,8BAAsB,EAACP,GAAG,CAAC,CAAC,CAACP,EAAE,CAACC,IAAI,CAACC,KAAK,CAAC,EAAE,CAAC;EACvD,CAAC,CAAC;EAEFV,EAAE,CAAC,0CAA0C,EAAE,MAAM;IACnD,IAAAM,cAAM,EAAC,IAAAgB,8BAAsB,EAAC,EAAE,CAAC,CAAC,CAACd,EAAE,CAACC,IAAI,CAACC,KAAK,CAAC,EAAE,CAAC;EACtD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/dist/mdx.main.runtime.js
CHANGED
|
@@ -144,7 +144,7 @@ class MDXMain {
|
|
|
144
144
|
const logger = loggerAspect.createLogger(_mdx().MDXAspect.id);
|
|
145
145
|
const mdxEnv = envs.merge(new (_mdx5().MdxEnv)(react, logger, multiCompiler, compiler, docs), react.reactEnv);
|
|
146
146
|
envs.registerEnv(mdxEnv);
|
|
147
|
-
depResolver.registerDetector(new (_mdx2().MDXDependencyDetector)(config.extensions));
|
|
147
|
+
depResolver.registerDetector(new (_mdx2().MDXDependencyDetector)(config.extensions, logger));
|
|
148
148
|
docs.registerDocReader(new (_mdx3().MDXDocReader)(config.extensions));
|
|
149
149
|
if (generator) {
|
|
150
150
|
const envContext = new (_envs().EnvContext)(_componentId().ComponentID.fromString(_react().ReactAspect.id), loggerAspect, workerMain, harmony);
|