creevey 0.9.0-beta.8 → 0.9.0-beta.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.
@@ -77,7 +77,7 @@ const Tools = _ref => {
77
77
  }
78
78
 
79
79
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_components.IconButton, {
80
- href: "http://localhost:".concat(__CREEVEY_CLIENT_PORT__ || __CREEVEY_SERVER_PORT__, "/?").concat((0, _qs.stringify)({
80
+ href: "http://localhost:".concat(__CREEVEY_CLIENT_PORT__ || __CREEVEY_SERVER_PORT__ || 3000, "/?").concat((0, _qs.stringify)({
81
81
  testPath: (0, _helpers.getTestPath)(test)
82
82
  })),
83
83
  target: "_blank",
@@ -3,24 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports._managerWebpack = _managerWebpack;
7
6
  exports.config = config;
8
7
  exports.managerEntries = managerEntries;
9
8
 
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
- var _shelljs = require("shelljs");
13
-
14
- var _webpack = require("webpack");
15
-
16
- var _helpers = require("../../server/storybook/helpers");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
9
  function config() {
25
10
  let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
26
11
  return [...entry, require.resolve('./decorator')];
@@ -29,34 +14,4 @@ function config() {
29
14
  function managerEntries() {
30
15
  let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
31
16
  return [...entry, require.resolve('./register')];
32
- }
33
-
34
- function _managerWebpack(config, options) {
35
- var _options$presets$appl, _options$presets;
36
-
37
- // TODO How to execute with non-webpack bundlers
38
- if (options.configType == 'PRODUCTION' && options.skipExtract != true) {
39
- const args = [];
40
- if (options.creeveyPreExtract) args.push("--require \"".concat(options.creeveyPreExtract, "\""));
41
- args.push(_path.default.join(__dirname, '../../cli'));
42
- args.push("--extract \"".concat(options.outputDir, "\""));
43
- if (options.creeveyConfigPath) args.push("--config \"".concat(options.creeveyConfigPath, "\""));
44
- (0, _shelljs.exec)("node ".concat(args.join(' ')), {
45
- async: true
46
- });
47
- }
48
-
49
- return ((_options$presets$appl = (_options$presets = options.presets) === null || _options$presets === void 0 ? void 0 : _options$presets.apply('webpackInstance')) !== null && _options$presets$appl !== void 0 ? _options$presets$appl : Promise.resolve(undefined)).then(webpack => webpack !== null && webpack !== void 0 ? webpack : Promise.resolve("".concat((0, _helpers.resolveFromStorybookCoreServer)('webpack'))).then(s => _interopRequireWildcard(require(s)))).then(webpack => {
50
- var _config$plugins, _options$creeveyPort;
51
-
52
- const {
53
- DefinePlugin = _webpack.DefinePlugin
54
- } = webpack !== null && webpack !== void 0 ? webpack : {};
55
- (_config$plugins = config.plugins) === null || _config$plugins === void 0 ? void 0 : _config$plugins.push(new DefinePlugin({
56
- __CREEVEY_SERVER_HOST__: options.creeveyHost,
57
- __CREEVEY_SERVER_PORT__: (_options$creeveyPort = options.creeveyPort) !== null && _options$creeveyPort !== void 0 ? _options$creeveyPort : 3000,
58
- __CREEVEY_CLIENT_PORT__: options.clientPort
59
- }));
60
- return config;
61
- });
62
17
  }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.managerEntries = managerEntries;
7
+ exports.previewAnnotations = void 0;
8
+
9
+ const previewAnnotations = function () {
10
+ let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11
+ return [...entry, require.resolve('./preview')];
12
+ };
13
+
14
+ exports.previewAnnotations = previewAnnotations;
15
+
16
+ function managerEntries() {
17
+ let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18
+ return [...entry, require.resolve('./register')];
19
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _withCreevey = require("./withCreevey");
9
+
10
+ const preview = {
11
+ decorators: [(0, _withCreevey.withCreevey)()]
12
+ };
13
+ var _default = preview;
14
+ exports.default = _default;
@@ -58,7 +58,7 @@ export const Tools = _ref => {
58
58
  }
59
59
 
60
60
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(IconButton, {
61
- href: "http://localhost:".concat(__CREEVEY_CLIENT_PORT__ || __CREEVEY_SERVER_PORT__, "/?").concat(stringify({
61
+ href: "http://localhost:".concat(__CREEVEY_CLIENT_PORT__ || __CREEVEY_SERVER_PORT__ || 3000, "/?").concat(stringify({
62
62
  testPath: getTestPath(test)
63
63
  })),
64
64
  target: "_blank",
@@ -1,7 +1,3 @@
1
- import path from 'path';
2
- import { exec } from 'shelljs';
3
- import { DefinePlugin as FallbackDefinePlugin } from 'webpack';
4
- import { resolveFromStorybookCoreServer } from '../../server/storybook/helpers';
5
1
  export function config() {
6
2
  let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7
3
  return [...entry, require.resolve('./decorator')];
@@ -9,33 +5,4 @@ export function config() {
9
5
  export function managerEntries() {
10
6
  let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11
7
  return [...entry, require.resolve('./register')];
12
- }
13
- export function _managerWebpack(config, options) {
14
- var _options$presets$appl, _options$presets;
15
-
16
- // TODO How to execute with non-webpack bundlers
17
- if (options.configType == 'PRODUCTION' && options.skipExtract != true) {
18
- const args = [];
19
- if (options.creeveyPreExtract) args.push("--require \"".concat(options.creeveyPreExtract, "\""));
20
- args.push(path.join(__dirname, '../../cli'));
21
- args.push("--extract \"".concat(options.outputDir, "\""));
22
- if (options.creeveyConfigPath) args.push("--config \"".concat(options.creeveyConfigPath, "\""));
23
- exec("node ".concat(args.join(' ')), {
24
- async: true
25
- });
26
- }
27
-
28
- return ((_options$presets$appl = (_options$presets = options.presets) === null || _options$presets === void 0 ? void 0 : _options$presets.apply('webpackInstance')) !== null && _options$presets$appl !== void 0 ? _options$presets$appl : Promise.resolve(undefined)).then(webpack => webpack !== null && webpack !== void 0 ? webpack : import(resolveFromStorybookCoreServer('webpack'))).then(webpack => {
29
- var _config$plugins, _options$creeveyPort;
30
-
31
- const {
32
- DefinePlugin = FallbackDefinePlugin
33
- } = webpack !== null && webpack !== void 0 ? webpack : {};
34
- (_config$plugins = config.plugins) === null || _config$plugins === void 0 ? void 0 : _config$plugins.push(new DefinePlugin({
35
- __CREEVEY_SERVER_HOST__: options.creeveyHost,
36
- __CREEVEY_SERVER_PORT__: (_options$creeveyPort = options.creeveyPort) !== null && _options$creeveyPort !== void 0 ? _options$creeveyPort : 3000,
37
- __CREEVEY_CLIENT_PORT__: options.clientPort
38
- }));
39
- return config;
40
- });
41
8
  }
@@ -0,0 +1,8 @@
1
+ export const previewAnnotations = function () {
2
+ let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3
+ return [...entry, require.resolve('./preview')];
4
+ };
5
+ export function managerEntries() {
6
+ let entry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7
+ return [...entry, require.resolve('./register')];
8
+ }
@@ -0,0 +1,5 @@
1
+ import { withCreevey } from './withCreevey';
2
+ const preview = {
3
+ decorators: [withCreevey()]
4
+ };
5
+ export default preview;
@@ -1,23 +1,2 @@
1
- import { Configuration } from 'webpack';
2
1
  export declare function config(entry?: string[]): string[];
3
2
  export declare function managerEntries(entry?: string[]): string[];
4
- declare global {
5
- const __CREEVEY_SERVER_HOST__: string;
6
- const __CREEVEY_SERVER_PORT__: number;
7
- const __CREEVEY_CLIENT_PORT__: number | null;
8
- }
9
- export interface CreeveyAddonOptions {
10
- creeveyConfigPath?: string;
11
- creeveyPreExtract?: string;
12
- creeveyHost?: string;
13
- creeveyPort?: number;
14
- clientPort?: number;
15
- configType: string;
16
- configDir: string;
17
- outputDir: string;
18
- skipExtract?: boolean;
19
- presets?: {
20
- apply: <T>(preset: string) => Promise<T | undefined>;
21
- };
22
- }
23
- export declare function _managerWebpack(config: Configuration, options: CreeveyAddonOptions): Promise<Configuration>;
@@ -0,0 +1,2 @@
1
+ export declare const previewAnnotations: (entry?: never[]) => string[];
2
+ export declare function managerEntries(entry?: string[]): string[];
@@ -0,0 +1,4 @@
1
+ declare const preview: {
2
+ decorators: import("@storybook/addons").MakeDecoratorResult[];
3
+ };
4
+ export default preview;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "addon",
14
14
  "test"
15
15
  ],
16
- "version": "0.9.0-beta.8",
16
+ "version": "0.9.0-beta.9",
17
17
  "bin": {
18
18
  "creevey": "./lib/cjs/cli.js"
19
19
  },
@@ -29,6 +29,7 @@
29
29
  },
30
30
  "./preset": "./preset/index.js",
31
31
  "./preset/ie11": "./preset/ie11.js",
32
+ "./preset/sb7": "./preset/sb7.js",
32
33
  "./lib/esm/client/addon/decorator.js": "./lib/esm/client/addon/decorator.js"
33
34
  },
34
35
  "main": "lib/cjs/index.js",
package/preset/sb7.js ADDED
@@ -0,0 +1,5 @@
1
+ /* eslint-disable node/no-missing-require, @typescript-eslint/no-unsafe-assignment */
2
+
3
+ module.exports = {
4
+ ...require('../lib/cjs/client/addon/preset.sb7'),
5
+ };
@@ -0,0 +1,5 @@
1
+ /* eslint-disable no-var */
2
+
3
+ declare var __CREEVEY_SERVER_HOST__: string;
4
+ declare var __CREEVEY_SERVER_PORT__: number;
5
+ declare var __CREEVEY_CLIENT_PORT__: number | null;