babel-preset-startupjs 0.60.0-canary.7 → 0.60.0-canary.9

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.
Files changed (2) hide show
  1. package/index.js +9 -1
  2. package/package.json +9 -3
package/index.js CHANGED
@@ -34,6 +34,8 @@
34
34
  * is part of the startupjs ecosystem (a plugin, startupjs.config.js, loadStartupjsConfig.js or a model file).
35
35
  * Default: a function that returns true for all startupjs plugin ecosystem files. And also
36
36
  * when clientOnly is true, it also returns true for model/*.js files to keep only client-relevant code there.
37
+ * docgen - Whether to enable docgen features - magic exports of JSON schemas from TypeScript interfaces.
38
+ * Default: false
37
39
  */
38
40
  const { createStartupjsFileChecker, CONFIG_FILENAME_REGEX } = require('./utils.js')
39
41
  const PLUGIN_KEYS = ['name', 'for', 'order', 'enabled']
@@ -52,7 +54,8 @@ module.exports = (api, {
52
54
  useRequireContext = true,
53
55
  clientOnly = true,
54
56
  envs = ['features', 'isomorphic', 'client'],
55
- isStartupjsFile = createStartupjsFileChecker({ clientOnly })
57
+ isStartupjsFile = createStartupjsFileChecker({ clientOnly }),
58
+ docgen = false
56
59
  } = {}) => {
57
60
  const isMetro = api.caller(caller => caller?.name === 'metro')
58
61
 
@@ -89,6 +92,11 @@ module.exports = (api, {
89
92
  ]
90
93
  }, {
91
94
  plugins: [
95
+ docgen && [require('@startupjs/babel-plugin-ts-to-json-schema'), {
96
+ magicExportName: '_PropsJsonSchema',
97
+ interfaceMatch: 'export interface'
98
+ }],
99
+
92
100
  // transform pug to jsx. This generates a bunch of new AST nodes
93
101
  // (it's important to do this first before any dead code elimination runs)
94
102
  transformPug && [require('cssxjs/babel/plugin-react-pug'), { classAttribute: 'styleName' }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-startupjs",
3
- "version": "0.60.0-canary.7",
3
+ "version": "0.60.0-canary.9",
4
4
  "description": "Babel preset for compiling StartupJS app on server, web, native",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -15,9 +15,15 @@
15
15
  "@babel/core": "^7.9.0",
16
16
  "@babel/plugin-syntax-jsx": "^7.0.0",
17
17
  "@babel/plugin-syntax-typescript": "^7.23.3",
18
+ "@startupjs/babel-plugin-eliminator": "^0.60.0-canary.0",
18
19
  "@startupjs/babel-plugin-i18n-extract": "^0.60.0-canary.7",
19
20
  "@startupjs/babel-plugin-startupjs": "^0.60.0-canary.7",
20
- "@startupjs/babel-plugin-startupjs-debug": "^0.60.0-canary.7"
21
+ "@startupjs/babel-plugin-startupjs-debug": "^0.60.0-canary.7",
22
+ "@startupjs/babel-plugin-startupjs-plugins": "^0.60.0-canary.0",
23
+ "@startupjs/babel-plugin-ts-to-json-schema": "^0.60.0-canary.9"
21
24
  },
22
- "gitHead": "68c5c8e9757e263133c36a24f46ba35efc9b87b8"
25
+ "peerDependencies": {
26
+ "cssxjs": "*"
27
+ },
28
+ "gitHead": "d314ca5e6c7b96f6692fb0eb31990eebab31566f"
23
29
  }