@symbo.ls/create 2.11.322 → 2.11.351

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.
@@ -50,6 +50,7 @@ const createDomqlElement = (App, options) => {
50
50
  const components = (0, import_prepare.prepareComponents)(options);
51
51
  const designSystem = scratcDesignSystem;
52
52
  const snippets = (0, import_prepare.prepareUtils)(options);
53
+ (0, import_prepare.preparePackages)({ functions: snippets, utils: snippets, ...options.files });
53
54
  const define = options.define || import_define.defaultDefine;
54
55
  const routerOptions = (0, import_router.initRouter)(App, options);
55
56
  const extend = (0, import_syncExtend.applySyncDebug)([App], options);
@@ -32,6 +32,7 @@ __export(prepare_exports, {
32
32
  prepareComponents: () => prepareComponents,
33
33
  prepareDesignSystem: () => prepareDesignSystem,
34
34
  prepareDocument: () => prepareDocument,
35
+ preparePackages: () => preparePackages,
35
36
  preparePages: () => preparePages,
36
37
  prepareState: () => prepareState,
37
38
  prepareUtils: () => prepareUtils
@@ -67,6 +68,14 @@ const prepareComponents = (options) => {
67
68
  const prepareUtils = (options) => {
68
69
  return { ...utils, ...utils.scratchUtils, ...options.snippets || options.utils || {} };
69
70
  };
71
+ const preparePackages = (options) => {
72
+ if (window.packages) {
73
+ window.packages = (0, import_utils.merge)(window.packages, options);
74
+ } else {
75
+ window.packages = options;
76
+ window.require = (key) => window.packages[key];
77
+ }
78
+ };
70
79
  const prepareDesignSystem = (options, key) => {
71
80
  const [scratcDesignhSystem, emotion, registry] = (0, import_initEmotion.initEmotion)(key, options);
72
81
  return [scratcDesignhSystem, emotion, registry];
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.11.322",
3
+ "version": "2.11.351",
4
4
  "license": "MIT",
5
- "gitHead": "d2cfbfab6d0298270d9a930d27ba34b621c800e8",
5
+ "gitHead": "7467ad3cc2fb752e3a484df743e88422938756f7",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -8,7 +8,7 @@ import * as uikit from '@symbo.ls/uikit'
8
8
  import { defaultDefine } from './define'
9
9
  import { initRouter } from './router'
10
10
  import { applySyncDebug } from './syncExtend'
11
- import { prepareComponents, prepareDesignSystem, prepareDocument, preparePages, prepareState, prepareUtils } from './prepare'
11
+ import { prepareComponents, prepareDesignSystem, prepareDocument, preparePackages, preparePages, prepareState, prepareUtils } from './prepare'
12
12
 
13
13
  const SYMBOLS_KEY = process.env.SYMBOLS_KEY
14
14
 
@@ -23,6 +23,7 @@ export const createDomqlElement = (App, options) => {
23
23
  const components = prepareComponents(options)
24
24
  const designSystem = scratcDesignSystem
25
25
  const snippets = prepareUtils(options)
26
+ preparePackages({ functions: snippets, utils: snippets, ...options.files })
26
27
 
27
28
  const define = options.define || defaultDefine
28
29
 
package/src/prepare.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { isString, deepMerge, deepCloneWithExtend } from '@domql/utils'
3
+ import { isString, deepMerge, deepCloneWithExtend, merge } from '@domql/utils'
4
4
  import { initEmotion } from './initEmotion'
5
5
 
6
6
  import * as uikit from '@symbo.ls/uikit'
@@ -35,6 +35,15 @@ export const prepareUtils = options => {
35
35
  return { ...utils, ...utils.scratchUtils, ...(options.snippets || options.utils || {}) }
36
36
  }
37
37
 
38
+ export const preparePackages = options => {
39
+ if (window.packages) {
40
+ window.packages = merge(window.packages, options)
41
+ } else {
42
+ window.packages = options
43
+ window.require = (key) => window.packages[key]
44
+ }
45
+ }
46
+
38
47
  export const prepareDesignSystem = (options, key) => {
39
48
  const [scratcDesignhSystem, emotion, registry] = initEmotion(key, options)
40
49
  return [scratcDesignhSystem, emotion, registry]