@gasket/preset-api 7.4.6 → 7.5.1

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.
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, "__esModule", {
3
2
  value: true
4
3
  });
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, "__esModule", {
3
2
  value: true
4
3
  });
@@ -9,9 +8,9 @@ Object.defineProperty(exports, /** @type {import('@gasket/core').Preset} */ "def
9
8
  }
10
9
  });
11
10
  const _module = require("module");
12
- const _presetprompt = /*#__PURE__*/ _interop_require_default(require("./preset-prompt.js"));
13
- const _presetconfig = /*#__PURE__*/ _interop_require_default(require("./preset-config.js"));
14
- const _create = /*#__PURE__*/ _interop_require_default(require("./create.js"));
11
+ const _presetprompt = /*#__PURE__*/ _interop_require_default(require("./preset-prompt.cjs"));
12
+ const _presetconfig = /*#__PURE__*/ _interop_require_default(require("./preset-config.cjs"));
13
+ const _create = /*#__PURE__*/ _interop_require_default(require("./create.cjs"));
15
14
  function _interop_require_default(obj) {
16
15
  return obj && obj.__esModule ? obj : {
17
16
  default: obj
@@ -0,0 +1,102 @@
1
+ // Default Plugins - included by default for all presets
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, /**
6
+ * presetConfig hook
7
+ * @param {Gasket} gasket - Gasket API
8
+ * @param {Create} context - Create context
9
+ * @returns {Promise<CreateContext.presetConfig>} config
10
+ */ "default", {
11
+ enumerable: true,
12
+ get: function() {
13
+ return presetConfig;
14
+ }
15
+ });
16
+ const _plugincommand = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-command"));
17
+ const _plugindocs = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-docs"));
18
+ const _plugindocusaurus = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-docusaurus"));
19
+ const _plugindynamicplugins = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-dynamic-plugins"));
20
+ const _plugingit = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-git"));
21
+ const _pluginlogger = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-logger"));
22
+ const _pluginhttps = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-https"));
23
+ const _pluginwinston = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-winston"));
24
+ const _pluginlint = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-lint"));
25
+ function _interop_require_default(obj) {
26
+ return obj && obj.__esModule ? obj : {
27
+ default: obj
28
+ };
29
+ }
30
+ function _getRequireWildcardCache(nodeInterop) {
31
+ if (typeof WeakMap !== "function") return null;
32
+ var cacheBabelInterop = new WeakMap();
33
+ var cacheNodeInterop = new WeakMap();
34
+ return (_getRequireWildcardCache = function(nodeInterop) {
35
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
+ })(nodeInterop);
37
+ }
38
+ function _interop_require_wildcard(obj, nodeInterop) {
39
+ if (!nodeInterop && obj && obj.__esModule) {
40
+ return obj;
41
+ }
42
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
43
+ return {
44
+ default: obj
45
+ };
46
+ }
47
+ var cache = _getRequireWildcardCache(nodeInterop);
48
+ if (cache && cache.has(obj)) {
49
+ return cache.get(obj);
50
+ }
51
+ var newObj = {
52
+ __proto__: null
53
+ };
54
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
+ for(var key in obj){
56
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
57
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
58
+ if (desc && (desc.get || desc.set)) {
59
+ Object.defineProperty(newObj, key, desc);
60
+ } else {
61
+ newObj[key] = obj[key];
62
+ }
63
+ }
64
+ }
65
+ newObj.default = obj;
66
+ if (cache) {
67
+ cache.set(obj, newObj);
68
+ }
69
+ return newObj;
70
+ }
71
+ async function presetConfig(gasket, context) {
72
+ const plugins = new Set([
73
+ _plugincommand.default,
74
+ _plugindocs.default,
75
+ _plugindocusaurus.default,
76
+ _plugindynamicplugins.default,
77
+ _plugingit.default,
78
+ _pluginhttps.default,
79
+ _pluginlint.default,
80
+ _pluginlogger.default,
81
+ _pluginwinston.default
82
+ ]);
83
+ const frameworkPlugin = context.server === 'express' ? await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-express"))) : await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-fastify")));
84
+ plugins.add(frameworkPlugin.default || frameworkPlugin);
85
+ if ('testPlugins' in context && context.testPlugins.length > 0) {
86
+ await Promise.all(context.testPlugins.map(async (testPlugin)=>{
87
+ const plugin = await Promise.resolve(testPlugin).then((p)=>/*#__PURE__*/ _interop_require_wildcard(require(p)));
88
+ plugins.add(plugin ? plugin.default || plugin : null);
89
+ }));
90
+ }
91
+ if (context.typescript) {
92
+ const typescriptPlugin = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-typescript")));
93
+ plugins.add(typescriptPlugin.default || typescriptPlugin);
94
+ }
95
+ if (context.useSwagger) {
96
+ const swaggerPlugin = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-swagger")));
97
+ plugins.add(swaggerPlugin.default || swaggerPlugin);
98
+ }
99
+ return {
100
+ plugins: Array.from(plugins)
101
+ };
102
+ }
@@ -0,0 +1,50 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ Object.defineProperty(exports, /**
5
+ * presetPrompt hook
6
+ * @param {Gasket} gasket - Gasket API
7
+ * @param {Create} context - Create context
8
+ * @param {Object} utils - Prompt utils
9
+ * @param {Function} utils.prompt - Inquirer prompt
10
+ */ "default", {
11
+ enumerable: true,
12
+ get: function() {
13
+ return presetPrompt;
14
+ }
15
+ });
16
+ const _prompts = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-typescript/prompts"));
17
+ const _prompts1 = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-swagger/prompts"));
18
+ function _interop_require_default(obj) {
19
+ return obj && obj.__esModule ? obj : {
20
+ default: obj
21
+ };
22
+ }
23
+ async function presetPrompt(gasket, context, { prompt }) {
24
+ context.apiApp = true;
25
+ await _prompts.default.promptTypescript(context, prompt);
26
+ await _prompts1.default.promptSwagger(context, prompt);
27
+ if (!('server' in context)) {
28
+ const { server } = await prompt([
29
+ {
30
+ name: 'server',
31
+ message: 'Which server framework would you like to use?',
32
+ type: 'list',
33
+ choices: [
34
+ {
35
+ name: 'Express',
36
+ value: 'express'
37
+ },
38
+ {
39
+ name: 'Fastify',
40
+ value: 'fastify'
41
+ }
42
+ ]
43
+ }
44
+ ]);
45
+ Object.assign(context, {
46
+ server
47
+ });
48
+ return context;
49
+ }
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/preset-api",
3
- "version": "7.4.6",
3
+ "version": "7.5.1",
4
4
  "description": "Create Express-based API with Gasket",
5
5
  "type": "module",
6
6
  "types": "lib/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  ".": {
14
14
  "types": "./lib/index.d.ts",
15
15
  "import": "./lib/index.js",
16
- "require": "./cjs/index.js",
17
- "default": "./cjs/index.js"
16
+ "require": "./cjs/index.cjs",
17
+ "default": "./cjs/index.cjs"
18
18
  },
19
19
  "./package.json": "./package.json"
20
20
  },
@@ -27,27 +27,25 @@
27
27
  "bugs": "https://github.com/godaddy/gasket/issues",
28
28
  "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-preset-api",
29
29
  "dependencies": {
30
- "@gasket/plugin-command": "^7.4.3",
30
+ "@gasket/plugin-docs": "^7.4.5",
31
31
  "@gasket/plugin-cypress": "^7.5.1",
32
- "@gasket/plugin-docs": "^7.4.4",
33
- "@gasket/plugin-docusaurus": "^7.4.3",
34
- "@gasket/plugin-dynamic-plugins": "^7.3.8",
35
- "@gasket/plugin-express": "^7.4.1",
32
+ "@gasket/plugin-docusaurus": "^7.4.4",
36
33
  "@gasket/plugin-fastify": "^7.4.3",
37
- "@gasket/plugin-git": "^7.4.3",
38
- "@gasket/plugin-https": "^7.3.8",
34
+ "@gasket/plugin-dynamic-plugins": "^7.4.0",
35
+ "@gasket/plugin-git": "^7.4.4",
36
+ "@gasket/plugin-command": "^7.5.0",
37
+ "@gasket/plugin-https": "^7.3.9",
39
38
  "@gasket/plugin-jest": "^7.5.3",
40
39
  "@gasket/plugin-lint": "^7.4.1",
41
40
  "@gasket/plugin-logger": "^7.3.5",
42
- "@gasket/plugin-mocha": "^7.5.3",
43
- "@gasket/plugin-swagger": "^7.3.8",
44
41
  "@gasket/plugin-typescript": "^7.4.4",
45
- "@gasket/plugin-vitest": "^7.0.3",
42
+ "@gasket/plugin-swagger": "^7.3.8",
43
+ "@gasket/plugin-mocha": "^7.5.3",
44
+ "@gasket/plugin-vitest": "^7.1.0",
45
+ "@gasket/plugin-express": "^7.4.1",
46
46
  "@gasket/plugin-winston": "^7.3.5"
47
47
  },
48
48
  "devDependencies": {
49
- "@swc/cli": "^0.6.0",
50
- "@swc/core": "^1.10.18",
51
49
  "@types/jest": "^29.5.14",
52
50
  "@types/node": "^20.17.19",
53
51
  "cross-env": "^7.0.3",
@@ -59,8 +57,9 @@
59
57
  "jest": "^29.7.0",
60
58
  "nodemon": "^3.1.9",
61
59
  "typescript": "^5.8.2",
62
- "@gasket/plugin-metadata": "^7.4.5",
63
- "create-gasket-app": "^7.4.8"
60
+ "@gasket/plugin-metadata": "^7.5.1",
61
+ "@gasket/cjs": "^7.0.0",
62
+ "create-gasket-app": "^7.4.10"
64
63
  },
65
64
  "eslintConfig": {
66
65
  "extends": [
@@ -83,11 +82,10 @@
83
82
  "transform": {}
84
83
  },
85
84
  "scripts": {
86
- "build": "swc lib -d cjs --delete-dir-on-start --strip-leading-paths && cp lib/index.d.ts cjs/",
85
+ "build": "gasket-cjs ./lib",
87
86
  "build:watch": "pnpm run build --watch",
88
87
  "lint": "eslint .",
89
88
  "lint:fix": "pnpm run lint --fix",
90
- "postbuild": "node -e \"require('fs').writeFileSync('cjs/package.json', '{}')\"",
91
89
  "posttest": "pnpm run lint",
92
90
  "test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
93
91
  "test:coverage": "jest --coverage",
package/cjs/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import '@gasket/plugin-express';
2
- import '@gasket/plugin-fastify';
3
- import '@gasket/plugin-https';
4
- import '@gasket/plugin-lint';
5
- import '@gasket/plugin-winston';
@@ -1,143 +0,0 @@
1
- // Default Plugins - included by default for all presets
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, /**
7
- * presetConfig hook
8
- * @param {Gasket} gasket - Gasket API
9
- * @param {Create} context - Create context
10
- * @returns {Promise<CreateContext.presetConfig>} config
11
- */ "default", {
12
- enumerable: true,
13
- get: function() {
14
- return presetConfig;
15
- }
16
- });
17
- const _plugincommand = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-command"));
18
- const _plugindocs = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-docs"));
19
- const _plugindocusaurus = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-docusaurus"));
20
- const _plugindynamicplugins = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-dynamic-plugins"));
21
- const _plugingit = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-git"));
22
- const _pluginlogger = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-logger"));
23
- const _pluginhttps = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-https"));
24
- const _pluginwinston = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-winston"));
25
- const _pluginlint = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-lint"));
26
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
27
- try {
28
- var info = gen[key](arg);
29
- var value = info.value;
30
- } catch (error) {
31
- reject(error);
32
- return;
33
- }
34
- if (info.done) {
35
- resolve(value);
36
- } else {
37
- Promise.resolve(value).then(_next, _throw);
38
- }
39
- }
40
- function _async_to_generator(fn) {
41
- return function() {
42
- var self = this, args = arguments;
43
- return new Promise(function(resolve, reject) {
44
- var gen = fn.apply(self, args);
45
- function _next(value) {
46
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
47
- }
48
- function _throw(err) {
49
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
50
- }
51
- _next(undefined);
52
- });
53
- };
54
- }
55
- function _interop_require_default(obj) {
56
- return obj && obj.__esModule ? obj : {
57
- default: obj
58
- };
59
- }
60
- function _getRequireWildcardCache(nodeInterop) {
61
- if (typeof WeakMap !== "function") return null;
62
- var cacheBabelInterop = new WeakMap();
63
- var cacheNodeInterop = new WeakMap();
64
- return (_getRequireWildcardCache = function(nodeInterop) {
65
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
66
- })(nodeInterop);
67
- }
68
- function _interop_require_wildcard(obj, nodeInterop) {
69
- if (!nodeInterop && obj && obj.__esModule) {
70
- return obj;
71
- }
72
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
73
- return {
74
- default: obj
75
- };
76
- }
77
- var cache = _getRequireWildcardCache(nodeInterop);
78
- if (cache && cache.has(obj)) {
79
- return cache.get(obj);
80
- }
81
- var newObj = {
82
- __proto__: null
83
- };
84
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
85
- for(var key in obj){
86
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
87
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
88
- if (desc && (desc.get || desc.set)) {
89
- Object.defineProperty(newObj, key, desc);
90
- } else {
91
- newObj[key] = obj[key];
92
- }
93
- }
94
- }
95
- newObj.default = obj;
96
- if (cache) {
97
- cache.set(obj, newObj);
98
- }
99
- return newObj;
100
- }
101
- function presetConfig(gasket, context) {
102
- return _presetConfig.apply(this, arguments);
103
- }
104
- function _presetConfig() {
105
- _presetConfig = _async_to_generator(function*(gasket, context) {
106
- const plugins = new Set([
107
- _plugincommand.default,
108
- _plugindocs.default,
109
- _plugindocusaurus.default,
110
- _plugindynamicplugins.default,
111
- _plugingit.default,
112
- _pluginhttps.default,
113
- _pluginlint.default,
114
- _pluginlogger.default,
115
- _pluginwinston.default
116
- ]);
117
- const frameworkPlugin = context.server === 'express' ? yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-express"))) : yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-fastify")));
118
- plugins.add(frameworkPlugin.default || frameworkPlugin);
119
- if ('testPlugins' in context && context.testPlugins.length > 0) {
120
- yield Promise.all(context.testPlugins.map(/*#__PURE__*/ function() {
121
- var _ref = _async_to_generator(function*(testPlugin) {
122
- const plugin = yield Promise.resolve(testPlugin).then((p)=>/*#__PURE__*/ _interop_require_wildcard(require(p)));
123
- plugins.add(plugin ? plugin.default || plugin : null);
124
- });
125
- return function(testPlugin) {
126
- return _ref.apply(this, arguments);
127
- };
128
- }()));
129
- }
130
- if (context.typescript) {
131
- const typescriptPlugin = yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-typescript")));
132
- plugins.add(typescriptPlugin.default || typescriptPlugin);
133
- }
134
- if (context.useSwagger) {
135
- const swaggerPlugin = yield Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@gasket/plugin-swagger")));
136
- plugins.add(swaggerPlugin.default || swaggerPlugin);
137
- }
138
- return {
139
- plugins: Array.from(plugins)
140
- };
141
- });
142
- return _presetConfig.apply(this, arguments);
143
- }
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, /**
6
- * presetPrompt hook
7
- * @param {Gasket} gasket - Gasket API
8
- * @param {Create} context - Create context
9
- * @param {Object} utils - Prompt utils
10
- * @param {Function} utils.prompt - Inquirer prompt
11
- */ "default", {
12
- enumerable: true,
13
- get: function() {
14
- return presetPrompt;
15
- }
16
- });
17
- const _prompts = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-typescript/prompts"));
18
- const _prompts1 = /*#__PURE__*/ _interop_require_default(require("@gasket/plugin-swagger/prompts"));
19
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
20
- try {
21
- var info = gen[key](arg);
22
- var value = info.value;
23
- } catch (error) {
24
- reject(error);
25
- return;
26
- }
27
- if (info.done) {
28
- resolve(value);
29
- } else {
30
- Promise.resolve(value).then(_next, _throw);
31
- }
32
- }
33
- function _async_to_generator(fn) {
34
- return function() {
35
- var self = this, args = arguments;
36
- return new Promise(function(resolve, reject) {
37
- var gen = fn.apply(self, args);
38
- function _next(value) {
39
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
40
- }
41
- function _throw(err) {
42
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
43
- }
44
- _next(undefined);
45
- });
46
- };
47
- }
48
- function _interop_require_default(obj) {
49
- return obj && obj.__esModule ? obj : {
50
- default: obj
51
- };
52
- }
53
- function presetPrompt(gasket, context, _) {
54
- return _presetPrompt.apply(this, arguments);
55
- }
56
- function _presetPrompt() {
57
- _presetPrompt = _async_to_generator(function*(gasket, context, { prompt }) {
58
- context.apiApp = true;
59
- yield _prompts.default.promptTypescript(context, prompt);
60
- yield _prompts1.default.promptSwagger(context, prompt);
61
- if (!('server' in context)) {
62
- const { server } = yield prompt([
63
- {
64
- name: 'server',
65
- message: 'Which server framework would you like to use?',
66
- type: 'list',
67
- choices: [
68
- {
69
- name: 'Express',
70
- value: 'express'
71
- },
72
- {
73
- name: 'Fastify',
74
- value: 'fastify'
75
- }
76
- ]
77
- }
78
- ]);
79
- Object.assign(context, {
80
- server
81
- });
82
- return context;
83
- }
84
- });
85
- return _presetPrompt.apply(this, arguments);
86
- }