@kodiak-ui/babel-plugin
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,12 +0,2 @@ | ||
// are you seeing an error that a default export doesn't exist but your source file has a default export? | ||
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook | ||
// curious why you need to? | ||
// this file exists so that you can import from the entrypoint normally | ||
// except that it points to your source file and you don't need to run build constantly | ||
// which means we need to re-export all of the modules from your source file | ||
// and since export * doesn't include default exports, we need to read your source file | ||
// to check for a default export and re-export it if it exists | ||
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯ | ||
export * from "../src/index"; | ||
export { default } from "../src/index"; | ||
export * from "./declarations/src/index"; | ||
export { default } from "./declarations/src/index"; |
@@ -1,16 +0,7 @@ | ||
"use strict"; | ||
// this file might look strange and you might be wondering what it's for | ||
// it's lets you import your source files by importing this entrypoint | ||
// as you would import it if it was built with preconstruct build | ||
// this file is slightly different to some others though | ||
// it has a require hook which compiles your code with Babel | ||
// this means that you don't have to set up @babel/register or anything like that | ||
// but you can still require this module and it'll be compiled | ||
'use strict'; | ||
// this bit of code imports the require hook and registers it | ||
let unregister = require("../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", ".."); | ||
// this re-exports the source file | ||
module.exports = require("../src/index.ts"); | ||
unregister(); | ||
if (process.env.NODE_ENV === "production") { | ||
module.exports = require("./babel-plugin.cjs.prod.js"); | ||
} else { | ||
module.exports = require("./babel-plugin.cjs.dev.js"); | ||
} |
@@ -1,15 +0,20 @@ | ||
// 👋 hey!! | ||
// you might be reading this and seeing .esm in the filename | ||
// and being confused why there is commonjs below this filename | ||
// DON'T WORRY! | ||
// this is intentional | ||
// it's only commonjs with `preconstruct dev` | ||
// when you run `preconstruct build`, it will be ESM | ||
// why is it commonjs? | ||
// we need to re-export every export from the source file | ||
// but we can't do that with ESM without knowing what the exports are (because default exports aren't included in export/import *) | ||
// and they could change after running `preconstruct dev` so we can't look at the file without forcing people to | ||
// run preconstruct dev again which wouldn't be ideal | ||
// this solution could change but for now, it's working | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function index (babel) { | ||
return { | ||
name: '@kodiak-ui', | ||
visitor: { | ||
JSXAttribute: function JSXAttribute(path, state) { | ||
var _state$opts, _path$node, _path$node$name; | ||
module.exports = require("../src/index.ts") | ||
var attributesToHoist = (state === null || state === void 0 ? void 0 : (_state$opts = state.opts) === null || _state$opts === void 0 ? void 0 : _state$opts.attributesToHoist) || ['sx', 'variants']; | ||
if (attributesToHoist.includes(path === null || path === void 0 ? void 0 : (_path$node = path.node) === null || _path$node === void 0 ? void 0 : (_path$node$name = _path$node.name) === null || _path$node$name === void 0 ? void 0 : _path$node$name.name)) { | ||
var expressionPath = path.get('value.expression'); | ||
expressionPath.hoist(); | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
export default index; |
{ | ||
"name": "@kodiak-ui/babel-plugin", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "dist/babel-plugin.cjs.js", | ||
@@ -17,3 +17,3 @@ "module": "dist/babel-plugin.esm.js", | ||
}, | ||
"gitHead": "952275b2482fe05621f9d8b8e036865af870e87c" | ||
"gitHead": "b567c9aa0482d1f41d92009e372282d2715456f9" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
881060
15
210
2