@startupjs/bundler 0.57.0-canary.59 → 0.57.0-canary.61

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.
@@ -15,10 +15,11 @@ module.exports = function eliminatorLoader (source) {
15
15
  // - remove accessControl() calls
16
16
  const clientModel = this.query.clientModel
17
17
 
18
- // ensure that this loader is only used on plugins, startupjs.config.js and loadStartupjsConfig.js files
18
+ // ensure that this loader is only used on plugins, startupjs.config.js and loadStartupjsConfig.js files.
19
+ // Or on the client it should also run in model/*.js files
19
20
  if (!(
20
21
  isStartupjsPluginEcosystemFile(filename) ||
21
- (clientModel && hasOrmImport(source))
22
+ (clientModel && isModelFile(filename, source))
22
23
  )) return source
23
24
 
24
25
  const envs = this.query.envs
@@ -106,7 +107,7 @@ module.exports = function eliminatorLoader (source) {
106
107
  // __aggregationHeader({ collection: 'games', name: '$$byGameId' })
107
108
  //
108
109
  functionName: 'aggregation',
109
- magicImports: ['@startupjs/orm', 'startupjs/orm'],
110
+ magicImports: ['startupjs'],
110
111
  requirements: {
111
112
  directNamedExportedAsConst: true
112
113
  },
@@ -138,7 +139,7 @@ module.exports = function eliminatorLoader (source) {
138
139
  // __aggregationHeader({ collection: 'games', name: 'byGameId' })
139
140
  //
140
141
  functionName: 'aggregation',
141
- magicImports: ['@startupjs/orm', 'startupjs/orm'],
142
+ magicImports: ['startupjs'],
142
143
  requirements: {
143
144
  argumentsAmount: 2
144
145
  },
@@ -150,7 +151,7 @@ module.exports = function eliminatorLoader (source) {
150
151
  }, {
151
152
  // remove accessControl() calls (replace with undefined)
152
153
  functionName: 'accessControl',
153
- magicImports: ['@startupjs/orm', 'startupjs/orm'],
154
+ magicImports: ['startupjs'],
154
155
  replaceWith: {
155
156
  remove: true // replace the whole function call with undefined
156
157
  }
@@ -165,6 +166,8 @@ module.exports = function eliminatorLoader (source) {
165
166
  return code
166
167
  }
167
168
 
168
- function hasOrmImport (code) {
169
- return /['"]@?startupjs\/orm['"]/.test(code)
169
+ const MODEL_FILE_REGEX = /(?:^|[.\\/])model[\\/].*\.[mc]?[jt]sx?$/
170
+ const STARTUPJS_REGEX = /['"]startupjs['"]/
171
+ function isModelFile (filename, code) {
172
+ return MODEL_FILE_REGEX.test(filename) && STARTUPJS_REGEX.test(code)
170
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startupjs/bundler",
3
- "version": "0.57.0-canary.59",
3
+ "version": "0.57.0-canary.61",
4
4
  "description": "Opinionated scripts and configs to develop a react-native-web project",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -27,7 +27,7 @@
27
27
  "@startupjs/babel-plugin-startupjs-plugins": "^0.57.0-canary.0",
28
28
  "@startupjs/babel-plugin-transform-react-pug": "^7.0.1-0",
29
29
  "@startupjs/css-to-react-native-transform": "^1.9.0-2",
30
- "@startupjs/server": "^0.57.0-canary.59",
30
+ "@startupjs/server": "^0.57.0-canary.61",
31
31
  "@svgr/core": "^8.1.0",
32
32
  "@svgr/plugin-jsx": "^8.1.0",
33
33
  "@svgr/plugin-svgo": "^8.1.0",
@@ -35,7 +35,7 @@
35
35
  "assets-webpack-plugin": "^7.1.1",
36
36
  "autoprefixer": "^10.4.0",
37
37
  "babel-loader": "^8.2.3",
38
- "babel-preset-startupjs": "^0.57.0-canary.59",
38
+ "babel-preset-startupjs": "^0.57.0-canary.61",
39
39
  "connect": "^3.7.0",
40
40
  "css-loader": "^6.5.0",
41
41
  "css-minimizer-webpack-plugin": "^5.0.0",
@@ -59,5 +59,5 @@
59
59
  "peerDependencies": {
60
60
  "react-native-svg": "*"
61
61
  },
62
- "gitHead": "06ffc4bcb7f89cb64ff554ccbbde2a8c102de3a2"
62
+ "gitHead": "2bf998486cadc27fbc371bb264c49680aa1c3b22"
63
63
  }