@wix/origami-transforms 0.1.43 → 0.1.45
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.
- package/package.json +4 -4
- package/src/jsxPlugins/origamiCompatibility/componentBindings.js +3 -14
- package/src/jsxPlugins/origamiCompatibility/index.js +1 -2
- package/dist/jsxPlugins/origamiCompatibility/rules/containerProps.d.ts +0 -4
- package/src/jsxPlugins/origamiCompatibility/rules/containerProps.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/origami-transforms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "Babel and PostCSS checks and transforms for Wix origami page files.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@babel/types": "^7.25.2",
|
|
22
22
|
"@wix/sdk": "^1.21.13",
|
|
23
23
|
"@wix/origami-fonts": "1.0.4",
|
|
24
|
-
"@wix/origami-system-components": "1.10.
|
|
24
|
+
"@wix/origami-system-components": "1.10.12",
|
|
25
25
|
"postcss": "^8.5.3",
|
|
26
26
|
"postcss-custom-media": "^12.0.1",
|
|
27
|
-
"@wix/origami-bi": "0.
|
|
27
|
+
"@wix/origami-bi": "0.15.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.0.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
},
|
|
77
77
|
"type": "module",
|
|
78
78
|
"types": "./dist/index.d.ts",
|
|
79
|
-
"falconPackageHash": "
|
|
79
|
+
"falconPackageHash": "958ed81df85b44b8034ffb538b07017bdcd02228061485c3183dcc2b"
|
|
80
80
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Resolve Origami component identity from named virtual-module imports
|
|
2
|
-
//
|
|
3
|
-
// components with the same JSX tag name are left alone.
|
|
1
|
+
// Resolve Origami component identity from named virtual-module imports. Local aliases keep that
|
|
2
|
+
// identity; unrelated local components with the same JSX tag name are left alone.
|
|
4
3
|
|
|
5
4
|
const ORIGAMI_MODULES = new Set(['document', 'document/components', 'wixEditorElements'])
|
|
6
5
|
|
|
@@ -9,17 +8,7 @@ const importedName = specifier => {
|
|
|
9
8
|
return specifier.imported.type === 'Identifier' ? specifier.imported.name : specifier.imported.value
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
const componentName = (source, specifier) =>
|
|
13
|
-
if (ORIGAMI_MODULES.has(source)) return importedName(specifier)
|
|
14
|
-
|
|
15
|
-
const match = /^@wix\/origami-system-components\/([^/]+)$/u.exec(source)
|
|
16
|
-
if (!match) return undefined
|
|
17
|
-
const name = match[1]
|
|
18
|
-
const imported = importedName(specifier)
|
|
19
|
-
return specifier.type === 'ImportDefaultSpecifier' || imported === name || imported === 'default'
|
|
20
|
-
? name
|
|
21
|
-
: undefined
|
|
22
|
-
}
|
|
11
|
+
const componentName = (source, specifier) => (ORIGAMI_MODULES.has(source) ? importedName(specifier) : undefined)
|
|
23
12
|
|
|
24
13
|
/**
|
|
25
14
|
* @param {object} program
|
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { basename } from 'node:path'
|
|
9
9
|
import { collectComponentBindings } from './componentBindings.js'
|
|
10
|
-
import { containerPropsRule } from './rules/containerProps.js'
|
|
11
10
|
import { richTextHtmlRule } from './rules/richTextHtml.js'
|
|
12
11
|
|
|
13
12
|
const STRUCTURE_FILE = 'structure.jsx'
|
|
14
13
|
|
|
15
|
-
const RULES = [
|
|
14
|
+
const RULES = [richTextHtmlRule]
|
|
16
15
|
|
|
17
16
|
/** Origami component name -> the rules that force props on it. */
|
|
18
17
|
const RULES_BY_COMPONENT = new Map(
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Container components need a `containerProps` object to satisfy the piler component contract.
|
|
2
|
-
|
|
3
|
-
import { types as t } from '@babel/core'
|
|
4
|
-
import { findAttribute } from '../ast.js'
|
|
5
|
-
|
|
6
|
-
export const containerPropsRule = {
|
|
7
|
-
components: ['Section', 'RefComponent', 'HeaderSection', 'FooterSection'],
|
|
8
|
-
apply: openingElement => {
|
|
9
|
-
if (findAttribute(openingElement.attributes, 'containerProps')) return
|
|
10
|
-
|
|
11
|
-
openingElement.attributes.push(
|
|
12
|
-
t.jsxAttribute(t.jsxIdentifier('containerProps'), t.jsxExpressionContainer(t.objectExpression([])))
|
|
13
|
-
)
|
|
14
|
-
},
|
|
15
|
-
}
|