babel-plugin-exercize
babel-plugin-exercize copied to clipboard
小册《babel插件通关秘籍》实战案例代码
fix auto-document ext
Process exited with code 1 Since Acorn 8.0.0, options.ecmaVersion is required. Defaulting to 2020, but this will stop working in the future. exercize-acorn-plugin-guang-keyword/node_modules/acorn/dist/acorn.js:434 Uncaught TypeError TypeError: Cannot read property 'allowHashBang'...
有引入时,路径修改
[email protected] 好人一生平安。
`exercize-type-checker/src/type-checker-entry3.js` ```js function resolveType(targetType) { const tsTypeAnnotationMap = { TSStringKeyword: "string", TSNumberKeyword: "number", }; switch (targetType.type) { case "TSTypeAnnotation": return tsTypeAnnotationMap[targetType.typeAnnotation.type]; // 失效了, 调试发现targetType对象没有TSTypeAnnotation属性 case "NumberTypeAnnotation": return "number"; case "StringTypeAnnotation":...
# 对应小册第 16 节, isImportSpecifier 应该修改为 isImportDefaultSpecifier 原文中描述:当然 default import 和 namespace import 取 id 的方式不一样,需要分别处理下。 ``` if (specifierPath.isImportSpecifier()) { state.trackerImportId = specifierPath.toString(); } else if(specifierPath.isImportNamespaceSpecifier()) { state.trackerImportId = specifierPath.get('local').toString();...
如果 locations: true 想要保留 AST 在源码中的位置信息,会导致调用this.finishNode({value: 'guang'},'GuangStatement')时缺失位置信息,需要将{value: 'guang'}改为传入的参数node,node中包含了位置信息。